[HACKERS] Re: [GENERAL] Performance issue with libpq prepared queries on 9.3 and 9.4

2014-11-13 Thread Sam Saffron
Thank you so much! So to recap the general way to reproduce this issue is: create table products(id int primary key, type varchar); insert into products select generate_series(1,1), 'aaa'; insert into products select generate_series(10001,2), 'bbb'; create index idx on products(type); pre

Re: [HACKERS] Re: [GENERAL] Performance issue with libpq prepared queries on 9.3 and 9.4

2014-11-13 Thread Tom Lane
David Johnston writes: > ​While "planner hints" comes to mind...on the SQL side can we extend the > "PREPARE" command with two additional keywords?​ > ​PREPARE > name [ ( data_type [, ...] ) ] [ > [NO] GENERIC > ​] ​ > ​AS statement Don't really see the point. The OP's problem is t

Re: [HACKERS] Re: [GENERAL] Performance issue with libpq prepared queries on 9.3 and 9.4

2014-11-13 Thread David Johnston
On Thu, Nov 13, 2014 at 5:47 PM, Tom Lane wrote: > David G Johnston writes: > > Tom Lane-2 wrote > >> In the meantime, I assume that your real data contains a small > percentage > >> of values other than these two? If so, maybe cranking up the statistics > >> target would help. If the planner

Re: [HACKERS] Re: [GENERAL] Performance issue with libpq prepared queries on 9.3 and 9.4

2014-11-13 Thread Tom Lane
David G Johnston writes: > Tom Lane-2 wrote >> In the meantime, I assume that your real data contains a small percentage >> of values other than these two? If so, maybe cranking up the statistics >> target would help. If the planner knows that there are more than two >> values in the column, I t

[HACKERS] Re: [GENERAL] Performance issue with libpq prepared queries on 9.3 and 9.4

2014-11-13 Thread David G Johnston
Tom Lane-2 wrote > In the meantime, I assume that your real data contains a small percentage > of values other than these two? If so, maybe cranking up the statistics > target would help. If the planner knows that there are more than two > values in the column, I think it would be less optimistic