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

Commitd206c01

Browse files
committed
Introduce clauselist_selectivity_hook
1 parentfa25dfc commitd206c01

File tree

6 files changed

+27
-1
lines changed

6 files changed

+27
-1
lines changed

‎contrib/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ include $(top_builddir)/src/Makefile.global
66

77
SUBDIRS =\
88
amcheck\
9+
pg_index_stats\
910
auth_delay\
1011
auto_explain\
1112
basic_archive\

‎src/backend/optimizer/path/clausesel.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,11 @@ clauselist_selectivity_ext(PlannerInfo *root,
128128
ListCell*l;
129129
intlistidx;
130130

131+
if (clauselist_selectivity_hook)
132+
s1=clauselist_selectivity_hook(root,clauses,varRelid,jointype,
133+
sjinfo,&estimatedclauses,
134+
use_extended_stats);
135+
131136
/*
132137
* If there's exactly one clause, just go directly to
133138
* clause_selectivity_ext(). None of what we might do below is relevant.

‎src/backend/statistics/extended_stats.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1712,7 +1712,7 @@ statext_is_compatible_clause(PlannerInfo *root, Node *clause, Index relid,
17121712
* 0-based 'clauses' indexes we estimate for and also skip clause items that
17131713
* already have a bit set.
17141714
*/
1715-
staticSelectivity
1715+
Selectivity
17161716
statext_mcv_clauselist_selectivity(PlannerInfo*root,List*clauses,intvarRelid,
17171717
JoinTypejointype,SpecialJoinInfo*sjinfo,
17181718
RelOptInfo*rel,Bitmapset**estimatedclauses,

‎src/backend/utils/adt/selfuncs.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@
146146
/* Hooks for plugins to get control when we ask for stats */
147147
get_relation_stats_hook_typeget_relation_stats_hook=NULL;
148148
get_index_stats_hook_typeget_index_stats_hook=NULL;
149+
clauselist_selectivity_hook_typeclauselist_selectivity_hook=NULL;
149150

150151
staticdoubleeqsel_internal(PG_FUNCTION_ARGS,boolnegate);
151152
staticdoubleeqjoinsel_inner(Oidopfuncoid,Oidcollation,

‎src/include/statistics/statistics.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,14 @@ extern void BuildRelationExtStatistics(Relation onerel, bool inh, double totalro
104104
externintComputeExtStatisticsRows(Relationonerel,
105105
intnatts,VacAttrStats**vacattrstats);
106106
externboolstatext_is_kind_built(HeapTuplehtup,chartype);
107+
externSelectivitystatext_mcv_clauselist_selectivity(PlannerInfo*root,
108+
List*clauses,
109+
intvarRelid,
110+
JoinTypejointype,
111+
SpecialJoinInfo*sjinfo,
112+
RelOptInfo*rel,
113+
Bitmapset**estimatedclauses,
114+
boolis_or);
107115
externSelectivitydependencies_clauselist_selectivity(PlannerInfo*root,
108116
List*clauses,
109117
intvarRelid,

‎src/include/utils/selfuncs.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,17 @@ typedef bool (*get_index_stats_hook_type) (PlannerInfo *root,
148148
VariableStatData*vardata);
149149
externPGDLLIMPORTget_index_stats_hook_typeget_index_stats_hook;
150150

151+
/* Hooks for plugins to get control when we ask for selectivity estimation */
152+
typedefSelectivity (*clauselist_selectivity_hook_type) (
153+
PlannerInfo*root,
154+
List*clauses,
155+
intvarRelid,
156+
JoinTypejointype,
157+
SpecialJoinInfo*sjinfo,
158+
Bitmapset**estimatedclauses,
159+
booluse_extended_stats);
160+
externPGDLLIMPORTclauselist_selectivity_hook_typeclauselist_selectivity_hook;
161+
151162
/* Functions in selfuncs.c */
152163

153164
externvoidexamine_variable(PlannerInfo*root,Node*node,intvarRelid,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp