pgsql: Modify prefix_selectivity() so that it will never estimate the

From: tgl(at)postgresql(dot)org (Tom Lane)
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Modify prefix_selectivity() so that it will never estimate the
Date: 2008-03-08 22:41:38
Message-ID: 20080308224138.9CACA753F33@cvs.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Log Message:
-----------
Modify prefix_selectivity() so that it will never estimate the selectivity
of the generated range condition var >= 'foo' AND var < 'fop' as being less
than what eqsel() would estimate for var = 'foo'. This is intuitively
reasonable and it gets rid of the need for some entirely ad-hoc coding we
formerly used to reject bogus estimates. The basic problem here is that
if the prefix is more than a few characters long, the two boundary values
are too close together to be distinguishable by comparison to the column
histogram, resulting in a selectivity estimate of zero, which is often
not very sane. Change motivated by an example from Peter Eisentraut.

Arguably this is a bug fix, but I'll refrain from back-patching it
for the moment.

Modified Files:
--------------
pgsql/src/backend/utils/adt:
selfuncs.c (r1.243 -> r1.244)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/adt/selfuncs.c?r1=1.243&r2=1.244)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2008-03-09 00:32:09 pgsql: Change patternsel() so that instead of switching from a pure
Previous Message Tom Lane 2008-03-08 21:58:07 pgsql: Refactor heap_page_prune so that instead of changing item states