Re: [PERFORM] Planner selects slow "Bitmap Heap Scan" when "Index Scan" is faster

2012-04-06 Thread Jeff Janes
On Wed, Apr 4, 2012 at 6:47 AM, Kim Hansen wrote: > Hi All > > I have a query where the planner makes a wrong cost estimate, it looks > like it underestimates the cost of a "Bitmap Heap Scan" compared to an > "Index Scan". > > This it the two plans, I have also pasted them below: >  Slow (189ms):

Re: [PERFORM] bad plan

2012-04-06 Thread Julien Cigar
On 04/05/2012 21:47, Ants Aasma wrote: On Thu, Apr 5, 2012 at 2:47 PM, Julien Cigar wrote: - http://www.pastie.org/3731956 : with default config - http://www.pastie.org/3731960 : this is with enable_seq_scan = off It looks like the join selectivity of (context_to_context_links, ancestors) is b

Re: [PERFORM] Planner selects slow "Bitmap Heap Scan" when "Index Scan" is faster

2012-04-06 Thread Kim Hansen
On Thu, Apr 5, 2012 at 17:34, Kevin Grittner wrote: > Kim Hansen wrote: > >> I have a query where the planner makes a wrong cost estimate, it >> looks like it underestimates the cost of a "Bitmap Heap Scan" >> compared to an "Index Scan". > >> What can I do to fix the cost estimate? > > Could you