Re: Huge overestimation in rows expected results in bad plan

From: bricklen <bricklen(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Huge overestimation in rows expected results in bad plan
Date: 2010-11-09 23:39:24
Message-ID: AANLkTimxv5HeSSuL5_+6bUDvicE39wNheToT2Ow3mC1x@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Tue, Nov 9, 2010 at 3:29 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> bricklen <bricklen(at)gmail(dot)com> writes:
>> I have a query that is getting a pretty bad plan due to a massively
>> incorrect count of expected rows.
>
> The query doesn't seem to match the plan.  Where is that OR (c.id =
> 38441828354::bigint) condition coming from?
>
>                        regards, tom lane
>

Ah sorry, I was testing it with and without that part. Here is the
corrected query, with that as part of the join condition:

explain analyze
select c.id, c.transactionid, c.clickgenerated, c.confirmed,
c.rejected, cr.rejectedreason
from conversion c
inner join conversionrejected cr on cr.idconversion = c.id or c.id = 38441828354
where date = '2010-11-06'
and idaction = 12906
and idaffiliate = 198338
order by transactionid;

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Tom Lane 2010-11-09 23:55:12 Re: Huge overestimation in rows expected results in bad plan
Previous Message Tom Lane 2010-11-09 23:29:40 Re: Huge overestimation in rows expected results in bad plan