Re: Proposal - improve eqsel estimates by including histogram bucket numdistinct statistics - Mailing list pgsql-hackers

From Gregory Stark
Subject Re: Proposal - improve eqsel estimates by including histogram bucket numdistinct statistics
Date
Msg-id 87od683lpa.fsf@oxford.xeocode.com
Whole thread Raw
In response to Re: Proposal - improve eqsel estimates by including histogram bucket numdistinct statistics  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Proposal - improve eqsel estimates by including histogram bucket numdistinct statistics  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
"Tom Lane" <tgl@sss.pgh.pa.us> writes:

> Gregory Stark <stark@enterprisedb.com> writes:
>> The screw case I've seen is when you have a large partitioned table where
>> constraint_exclusion fails to exclude the irrelevant partitions. You're going
>> to get 0 rows from all but the one partition which contains the 1 row you're
>> looking for. But since each partition is clamped to 1 you end up with an
>> estimate of a few hundred rows coming out of the Append node.
>
>> The natural way to kill this is to allow fractional rows for these scans.
>
> No, the right fix is to fix the constraint-exclusion failure.

There are always going to be cases where that's not possible.

It's possible that the second option I described -- teaching Append when to
use something other than sum() -- would only work in the cases where
constraint exclusion could be fixed though. In which case having fractional
row counts might actually be necessary. 

--  Gregory Stark EnterpriseDB          http://www.enterprisedb.com Ask me about EnterpriseDB's Slony Replication
support!


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Proposal - improve eqsel estimates by including histogram bucket numdistinct statistics
Next
From: Tom Lane
Date:
Subject: Re: Proposal - improve eqsel estimates by including histogram bucket numdistinct statistics