Re: BUG #5539: Generally incorrect planner estimations on join with UNION ALL

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Maksym Boguk <Maxim(dot)Boguk(at)gmail(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #5539: Generally incorrect planner estimations on join with UNION ALL
Date: 2010-07-09 19:49:58
Message-ID: AANLkTik4k7fc0CcBRztUdVnrFGV3YD_OYT3WBa5Fe7gG@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Sat, Jul 3, 2010 at 8:47 PM, Maksym Boguk <Maxim(dot)Boguk(at)gmail(dot)com> wrote:
> notable planner had correctly estimated amount of rows in one side of the
> join:
> (Append  (cost=0.00..0.98 rows=2 width=4))
> and planner hard correctly estimated amount of rows in the another side of
> the join:
> Index Scan using t3_value_key on t3  (cost=0.00..0.49 rows=1 width=8)
>
> And instead of use 2(from append)*1(from scan on t3)=2 as final row
> estimation, planner chooses use heuristic value 1000.

2 isn't necessarily correct, because the two rows on the outer side
needn't match the 1 row on the inner side - it could be less.

But I agree with you that the estimate of 1000 doesn't seem to make
much sense. I'm not sure where that's coming from.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise Postgres Company

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2010-07-09 21:15:34 Re: BUG #5548: ERROR: invalid attnum ## for rangetable entry on EXPLAIN VERBOSE, not on EXPLAIN
Previous Message Tom Lane 2010-07-09 18:04:15 Re: BUG #5548: ERROR: invalid attnum ## for rangetable entry on EXPLAIN VERBOSE, not on EXPLAIN