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

From Zeugswetter Andreas OSB sIT
Subject Re: Proposal - improve eqsel estimates by including histogram bucket numdistinct statistics
Date
Msg-id 6DAFE8F5425AB84DB3FCA4537D829A561BBF8B9246@M0164.s-mxs.net
Whole thread Raw
In response to Re: Proposal - improve eqsel estimates by including histogram bucket numdistinct statistics  ("Nathan Boley" <npboley@gmail.com>)
Responses Re: Proposal - improve eqsel estimates by including histogram bucket numdistinct statistics  (Gregory Stark <stark@enterprisedb.com>)
List pgsql-hackers
> Obviously we run into problems when
> a) we have a poor estimate for ndistinct - but then we have
> worse problems
> b) our length measure doesn't correspond well with ndistinct
> in an interval

One more problem with low ndistinct values is that the condition might very well
hit no rows at all. But Idea 1 will largely overestimate the number of hits.

e.g. char(2) field has a histogram bin for 'a1' - 'b1' ndistinct is 2 because actual
values in the bin are 'a1' and 'a2'. A query for 'a3' now has a bogus estimate of nrowsperbin / 2.

I think for low ndistinct values we will want to know the exact
value + counts and not a bin. So I think we will want additional stats rows
that represent "value 'a1' stats".

Andreas



pgsql-hackers by date:

Previous
From: Mark Cave-Ayland
Date:
Subject: Re: Strange issue with GiST index scan taking far too long
Next
From: Mark Cave-Ayland
Date:
Subject: Re: Strange issue with GiST index scan taking far too long