Re: Proposal - improve eqsel estimates by including histogram bucket numdistinct statistics

From: Gregory Stark <stark(at)enterprisedb(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Nathan Boley" <npboley(at)gmail(dot)com>, "Jeff Davis" <pgsql(at)j-davis(dot)com>, "Zeugswetter Andreas OSB sIT" <Andreas(dot)Zeugswetter(at)s-itsolutions(dot)at>, "PostgreSQL-development" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposal - improve eqsel estimates by including histogram bucket numdistinct statistics
Date: 2008-06-11 08:40:12
Message-ID: 878wxc2wlv.fsf@oxford.xeocode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

"Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:

> Gregory Stark <stark(at)enterprisedb(dot)com> writes:
>> 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.
>
> The above is just armwaving. IMHO, if you don't understand the
> structure of the table set then you're not going to be able to get the
> desired behavior via fractional rowcounts either.

That's only a specific subset of cases. You could just as easily have quals
which are only coincidentally related to the partition key or even not related
at all, just very selective and produce no records from some partitions.

The bottom line is that if you have a large table our statistics do a good job
estimating the selectivity of a where clause with the minimum clamped to 1. If
you partition it into 100 partitions then the minimum is clamped to 100.

--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com
Ask me about EnterpriseDB's On-Demand Production Tuning

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Merlin Moncure 2008-06-11 14:03:51 Re: math error or rounding problem Money type
Previous Message Heikki Linnakangas 2008-06-11 08:25:37 B-tree "finish incomplete split" bug