Re: Slow query: bitmap scan troubles - Mailing list pgsql-performance

From Claudio Freire
Subject Re: Slow query: bitmap scan troubles
Date
Msg-id CAGTBQpYmSNjV5QsnuQdYqYjJnVGrphUVeFm9nxPOfi5oG5-9UQ@mail.gmail.com
Whole thread Raw
In response to Re: Slow query: bitmap scan troubles  (Jeff Janes <jeff.janes@gmail.com>)
Responses Re: Slow query: bitmap scan troubles  (Jeff Janes <jeff.janes@gmail.com>)
List pgsql-performance
On Thu, Dec 6, 2012 at 2:27 PM, Jeff Janes <jeff.janes@gmail.com> wrote:
> On Wed, Dec 5, 2012 at 9:43 AM, Claudio Freire <klaussfreire@gmail.com> wrote:
>> On Wed, Dec 5, 2012 at 2:39 PM, Jeff Janes <jeff.janes@gmail.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.

But the final result set isn't further worked on (except for the
aggregate), which means it doesn't affect the cost by much.


pgsql-performance by date:

Previous
From: Jeff Janes
Date:
Subject: Re: Slow query: bitmap scan troubles
Next
From: Jeff Janes
Date:
Subject: Re: Slow query: bitmap scan troubles