pgsql: When estimating the selectivity of an inequality "column > - Mailing list pgsql-committers

From tgl@postgresql.org (Tom Lane)
Subject pgsql: When estimating the selectivity of an inequality "column >
Date
Msg-id 20100104024440.7C621753FB7@cvs.postgresql.org
Whole thread Raw
List pgsql-committers
Log Message:
-----------
When estimating the selectivity of an inequality "column > constant" or
"column < constant", and the comparison value is in the first or last
histogram bin or outside the histogram entirely, try to fetch the actual
column min or max value using an index scan (if there is an index on the
column).  If successful, replace the lower or upper histogram bound with
that value before carrying on with the estimate.  This limits the
estimation error caused by moving min/max values when the comparison
value is close to the min or max.  Per a complaint from Josh Berkus.

It is tempting to consider using this mechanism for mergejoinscansel as well,
but that would inject index fetches into main-line join estimation not just
endpoint cases.  I'm refraining from that until we can get a better handle
on the costs of doing this type of lookup.

Modified Files:
--------------
    pgsql/src/backend/executor:
        nodeHash.c (r1.125 -> r1.126)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/executor/nodeHash.c?r1=1.125&r2=1.126)
    pgsql/src/backend/tsearch:
        ts_selfuncs.c (r1.6 -> r1.7)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/tsearch/ts_selfuncs.c?r1=1.6&r2=1.7)
    pgsql/src/backend/utils/adt:
        selfuncs.c (r1.266 -> r1.267)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/adt/selfuncs.c?r1=1.266&r2=1.267)
    pgsql/src/backend/utils/cache:
        lsyscache.c (r1.165 -> r1.166)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/cache/lsyscache.c?r1=1.165&r2=1.166)
    pgsql/src/include/utils:
        lsyscache.h (r1.130 -> r1.131)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/utils/lsyscache.h?r1=1.130&r2=1.131)

pgsql-committers by date:

Previous
From: itagaki@postgresql.org (Takahiro Itagaki)
Date:
Subject: pgsql: Silence compiler warning about printf format for HANDLE.
Next
From: mhasegawa@pgfoundry.org (User Mhasegawa)
Date:
Subject: pgbulkload - pgbulkload: Add pgut-be header file.