Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit40608e7

Browse files
committed
When estimating the selectivity of an inequality "column > constant" or
"column < constant", and the comparison value is in the first or lasthistogram bin or outside the histogram entirely, try to fetch the actualcolumn min or max value using an index scan (if there is an index on thecolumn). If successful, replace the lower or upper histogram bound withthat value before carrying on with the estimate. This limits theestimation error caused by moving min/max values when the comparisonvalue 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 justendpoint cases. I'm refraining from that until we can get a better handleon the costs of doing this type of lookup.
1 parent89a091e commit40608e7

File tree

5 files changed

+322
-28
lines changed

5 files changed

+322
-28
lines changed

‎src/backend/executor/nodeHash.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/executor/nodeHash.c,v 1.125 2010/01/02 16:57:41 momjian Exp $
11+
* $PostgreSQL: pgsql/src/backend/executor/nodeHash.c,v 1.126 2010/01/04 02:44:39 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -1006,6 +1006,7 @@ ExecHashBuildSkewHash(HashJoinTable hashtable, Hash *node, int mcvsToUse)
10061006

10071007
if (get_attstatsslot(statsTuple,node->skewColType,node->skewColTypmod,
10081008
STATISTIC_KIND_MCV,InvalidOid,
1009+
NULL,
10091010
&values,&nvalues,
10101011
&numbers,&nnumbers))
10111012
{

‎src/backend/tsearch/ts_selfuncs.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $PostgreSQL: pgsql/src/backend/tsearch/ts_selfuncs.c,v 1.6 2010/01/02 16:57:53 momjian Exp $
10+
* $PostgreSQL: pgsql/src/backend/tsearch/ts_selfuncs.c,v 1.7 2010/01/04 02:44:39 tgl Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -170,6 +170,7 @@ tsquerysel(VariableStatData *vardata, Datum constval)
170170
if (get_attstatsslot(vardata->statsTuple,
171171
TEXTOID,-1,
172172
STATISTIC_KIND_MCELEM,InvalidOid,
173+
NULL,
173174
&values,&nvalues,
174175
&numbers,&nnumbers))
175176
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp