aboutsummaryrefslogtreecommitdiff
path: root/src/backend/executor/nodeHash.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2010-01-04 02:44:40 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2010-01-04 02:44:40 +0000
commit40608e7f949fb7e4025c0ddd5be01939adc79eec (patch)
tree6224ccf4598dbefef46282831eb43ec6ce1923f0 /src/backend/executor/nodeHash.c
parent89a091edd24f23e6abffa215548b38ec538b9d2f (diff)
downloadpostgresql-40608e7f949fb7e4025c0ddd5be01939adc79eec.tar.gz
postgresql-40608e7f949fb7e4025c0ddd5be01939adc79eec.zip
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.
Diffstat (limited to 'src/backend/executor/nodeHash.c')
-rw-r--r--src/backend/executor/nodeHash.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/backend/executor/nodeHash.c b/src/backend/executor/nodeHash.c
index 34e8f4149ee..558a780229c 100644
--- a/src/backend/executor/nodeHash.c
+++ b/src/backend/executor/nodeHash.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/executor/nodeHash.c,v 1.125 2010/01/02 16:57:41 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/executor/nodeHash.c,v 1.126 2010/01/04 02:44:39 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -1006,6 +1006,7 @@ ExecHashBuildSkewHash(HashJoinTable hashtable, Hash *node, int mcvsToUse)
if (get_attstatsslot(statsTuple, node->skewColType, node->skewColTypmod,
STATISTIC_KIND_MCV, InvalidOid,
+ NULL,
&values, &nvalues,
&numbers, &nnumbers))
{