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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Apr 4, 2012 at 6:47 AM, Kim Hansen <kim@xxxxxxxxxxx> 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): http://explain.depesz.com/s/2Wq
>  Fast (21ms): http://explain.depesz.com/s/ThQ

Could you do explain (analyze, buffers)?

Did you run these queries multiple times in both orders?  If you just
ran them once each, in the order indicated, then the bitmap scan may
have done the hard work of reading all the needed buffers into cache,
and the index scan then got to enjoy that cache.

Cheers,

Jeff

-- 
Sent via pgsql-performance mailing list (pgsql-performance@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance



[Postgresql General]     [Postgresql PHP]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Yosemite]

  Powered by Linux