Re: Slow query: bitmap scan troubles

From: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
To: Claudio Freire <klaussfreire(at)gmail(dot)com>
Cc: postgresql(at)foo(dot)me(dot)uk, postgres performance list <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Slow query: bitmap scan troubles
Date: 2012-12-06 17:27:48
Message-ID: CAMkU=1xXdiB+chgqwzWoN+7qqag9DeMTtDA1HWQYvuot6yDyJg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-performance

On Wed, Dec 5, 2012 at 9:43 AM, Claudio Freire <klaussfreire(at)gmail(dot)com> wrote:
> On Wed, Dec 5, 2012 at 2:39 PM, Jeff Janes <jeff(dot)janes(at)gmail(dot)com> wrote:
>> I'm not sure that this change would fix your problem, because it might
>> also change the costs of the alternative plans in a way that
>> neutralizes things. But I suspect it would fix it. Of course, a
>> correct estimate of the join size would also fix it--you have kind of
>> a perfect storm here.
>
> As far as I can see on the explain, the misestimation is 3x~4x not 200x.

It is 3x (14085 vs 4588) for selectivity on one of the tables, "Index
Only Scan using idx_trade_id_book on trade".

But for the join of both tables it is estimate 2120 vs actual 11.

Cheers,

Jeff

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2012-12-06 17:33:23 Re: Serious problem: media recovery fails after system or PostgreSQL crash
Previous Message Tom Lane 2012-12-06 17:21:32 Re: Functional dependency in GROUP BY through JOINs

Browse pgsql-performance by date

  From Date Subject
Next Message Claudio Freire 2012-12-06 20:05:09 Re: Slow query: bitmap scan troubles
Previous Message postgresql 2012-12-06 14:10:29 Re: Slow query: bitmap scan troubles