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

Commit4a7fcd7

Browse files
committed
Arrange the code with current PG master - 2
1 parent2a99c02 commit4a7fcd7

18 files changed

+575
-518
lines changed

‎aqo.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -282,9 +282,8 @@ extern double predict_for_relation(List *restrict_clauses, List *selectivities,
282282
List*relsigns,int*fss);
283283

284284
/* Query execution statistics collecting hooks */
285-
voidaqo_ExecutorStart(QueryDesc*queryDesc,inteflags);
286-
voidaqo_ExecutorRun(QueryDesc*queryDesc,ScanDirectiondirection,
287-
uint64count,boolexecute_once);
285+
boolaqo_ExecutorStart(QueryDesc*queryDesc,inteflags);
286+
voidaqo_ExecutorRun(QueryDesc*queryDesc,ScanDirectiondirection,uint64count);
288287
voidaqo_ExecutorEnd(QueryDesc*queryDesc);
289288

290289
/* Automatic query tuning */

‎aqo_master.patch

Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c
2-
index18a5af6b91..18c2ed3bfd 100644
2+
index19ffcc2cacb..93934d42e30 100644
33
--- a/src/backend/commands/explain.c
44
+++ b/src/backend/commands/explain.c
5-
@@ -25,6 +25,7 @@
5+
@@ -27,6 +27,7 @@
66
#include "nodes/extensible.h"
77
#include "nodes/makefuncs.h"
88
#include "nodes/nodeFuncs.h"
99
+#include "optimizer/cost.h"
1010
#include "parser/analyze.h"
1111
#include "parser/parsetree.h"
1212
#include "rewrite/rewriteHandler.h"
13-
@@ -48,6 +49,12 @@ ExplainOneQuery_hook_type ExplainOneQuery_hook = NULL;
13+
@@ -50,6 +51,12 @@ ExplainOneQuery_hook_type ExplainOneQuery_hook = NULL;
1414
/* Hook for plugins to get control in explain_get_index_name() */
1515
explain_get_index_name_hook_type explain_get_index_name_hook = NULL;
1616

@@ -21,9 +21,9 @@ index 18a5af6b91..18c2ed3bfd 100644
2121
+ExplainOneNode_hook_type ExplainOneNode_hook = NULL;
2222
+
2323

24-
/* Instrumentation data for SERIALIZE option */
25-
typedef struct SerializeMetrics
26-
@@ -805,6 +812,10 @@ ExplainOnePlan(PlannedStmt *plannedstmt,IntoClause *into, ExplainState *es,
24+
/*
25+
* Various places within need to convert bytes to kilobytes. Round these up
26+
@@ -815,6 +822,10 @@ ExplainOnePlan(PlannedStmt *plannedstmt,CachedPlan *cplan,
2727
ExplainPropertyFloat("Execution Time", "ms", 1000.0 * totaltime, 3,
2828
es);
2929

@@ -34,7 +34,7 @@ index 18a5af6b91..18c2ed3bfd 100644
3434
ExplainCloseGroup("Query", NULL, true, es);
3535
}
3636

37-
@@ -2001,6 +2012,9 @@ ExplainNode(PlanState *planstate, List *ancestors,
37+
@@ -2009,6 +2020,9 @@ ExplainNode(PlanState *planstate, List *ancestors,
3838
}
3939
}
4040

@@ -45,7 +45,7 @@ index 18a5af6b91..18c2ed3bfd 100644
4545
if (es->format == EXPLAIN_FORMAT_TEXT)
4646
appendStringInfoChar(es->str, '\n');
4747
diff --git a/src/backend/optimizer/path/costsize.c b/src/backend/optimizer/path/costsize.c
48-
index2bb6db1df7..ac95740598 100644
48+
index256568d05a2..914f6124e67 100644
4949
--- a/src/backend/optimizer/path/costsize.c
5050
+++ b/src/backend/optimizer/path/costsize.c
5151
@@ -109,6 +109,11 @@
@@ -68,7 +68,7 @@ index 2bb6db1df7..ac95740598 100644
6868

6969

7070
/*
71-
@@ -5309,6 +5313,58 @@ approx_tuple_count(PlannerInfo *root, JoinPath *path, List *quals)
71+
@@ -5318,6 +5322,58 @@ approx_tuple_count(PlannerInfo *root, JoinPath *path, List *quals)
7272
}
7373

7474

@@ -127,7 +127,7 @@ index 2bb6db1df7..ac95740598 100644
127127
/*
128128
* set_baserel_size_estimates
129129
*Set the size estimates for the given base relation.
130-
@@ -5325,19 +5381,10 @@ approx_tuple_count(PlannerInfo *root, JoinPath *path, List *quals)
130+
@@ -5334,19 +5390,10 @@ approx_tuple_count(PlannerInfo *root, JoinPath *path, List *quals)
131131
void
132132
set_baserel_size_estimates(PlannerInfo *root, RelOptInfo *rel)
133133
{
@@ -148,7 +148,7 @@ index 2bb6db1df7..ac95740598 100644
148148

149149
cost_qual_eval(&rel->baserestrictcost, rel->baserestrictinfo, root);
150150

151-
@@ -5348,13 +5395,33 @@ set_baserel_size_estimates(PlannerInfo *root, RelOptInfo *rel)
151+
@@ -5357,13 +5404,33 @@ set_baserel_size_estimates(PlannerInfo *root, RelOptInfo *rel)
152152
* get_parameterized_baserel_size
153153
*Make a size estimate for a parameterized scan of a base relation.
154154
*
@@ -184,7 +184,7 @@ index 2bb6db1df7..ac95740598 100644
184184
{
185185
List *allclauses;
186186
doublenrows;
187-
@@ -5383,6 +5450,36 @@ get_parameterized_baserel_size(PlannerInfo *root, RelOptInfo *rel,
187+
@@ -5392,6 +5459,36 @@ get_parameterized_baserel_size(PlannerInfo *root, RelOptInfo *rel,
188188
* set_joinrel_size_estimates
189189
*Set the size estimates for the given join relation.
190190
*
@@ -221,7 +221,7 @@ index 2bb6db1df7..ac95740598 100644
221221
* The rel's targetlist must have been constructed already, and a
222222
* restriction clause list that matches the given component rels must
223223
* be provided.
224-
@@ -5402,11 +5499,11 @@ get_parameterized_baserel_size(PlannerInfo *root, RelOptInfo *rel,
224+
@@ -5411,11 +5508,11 @@ get_parameterized_baserel_size(PlannerInfo *root, RelOptInfo *rel,
225225
* build_joinrel_tlist, and baserestrictcost is not used for join rels.
226226
*/
227227
void
@@ -238,7 +238,7 @@ index 2bb6db1df7..ac95740598 100644
238238
{
239239
rel->rows = calc_joinrel_size_estimate(root,
240240
rel,
241-
@@ -5422,6 +5519,35 @@ set_joinrel_size_estimates(PlannerInfo *root, RelOptInfo *rel,
241+
@@ -5431,6 +5528,35 @@ set_joinrel_size_estimates(PlannerInfo *root, RelOptInfo *rel,
242242
* get_parameterized_joinrel_size
243243
*Make a size estimate for a parameterized scan of a join relation.
244244
*
@@ -274,7 +274,7 @@ index 2bb6db1df7..ac95740598 100644
274274
* 'rel' is the joinrel under consideration.
275275
* 'outer_path', 'inner_path' are (probably also parameterized) Paths that
276276
*produce the relations being joined.
277-
@@ -5434,11 +5560,11 @@ set_joinrel_size_estimates(PlannerInfo *root, RelOptInfo *rel,
277+
@@ -5443,11 +5569,11 @@ set_joinrel_size_estimates(PlannerInfo *root, RelOptInfo *rel,
278278
* set_joinrel_size_estimates must have been applied already.
279279
*/
280280
double
@@ -291,7 +291,7 @@ index 2bb6db1df7..ac95740598 100644
291291
{
292292
doublenrows;
293293

294-
@@ -6153,7 +6279,7 @@ set_foreign_size_estimates(PlannerInfo *root, RelOptInfo *rel)
294+
@@ -6162,7 +6288,7 @@ set_foreign_size_estimates(PlannerInfo *root, RelOptInfo *rel)
295295
/* Should only be applied to base relations */
296296
Assert(rel->relid > 0);
297297

@@ -300,7 +300,7 @@ index 2bb6db1df7..ac95740598 100644
300300

301301
cost_qual_eval(&rel->baserestrictcost, rel->baserestrictinfo, root);
302302

303-
@@ -6446,7 +6572,7 @@ page_size(double tuples, int width)
303+
@@ -6455,7 +6581,7 @@ page_size(double tuples, int width)
304304
* Estimate the fraction of the work that each worker will do given the
305305
* number of workers budgeted for the path.
306306
*/
@@ -310,7 +310,7 @@ index 2bb6db1df7..ac95740598 100644
310310
{
311311
doubleparallel_divisor = path->parallel_workers;
312312
diff --git a/src/backend/optimizer/plan/createplan.c b/src/backend/optimizer/plan/createplan.c
313-
indexc13586c537..2f889570de 100644
313+
index75e2b0b9036..8641c0c594a 100644
314314
--- a/src/backend/optimizer/plan/createplan.c
315315
+++ b/src/backend/optimizer/plan/createplan.c
316316
@@ -72,6 +72,7 @@
@@ -321,7 +321,7 @@ index c13586c537..2f889570de 100644
321321

322322
static Plan *create_plan_recurse(PlannerInfo *root, Path *best_path,
323323
int flags);
324-
@@ -551,6 +552,10 @@ create_plan_recurse(PlannerInfo *root, Path *best_path, int flags)
324+
@@ -548,6 +549,10 @@ create_plan_recurse(PlannerInfo *root, Path *best_path, int flags)
325325
break;
326326
}
327327

@@ -332,7 +332,7 @@ index c13586c537..2f889570de 100644
332332
return plan;
333333
}
334334

335-
@@ -5458,6 +5463,7 @@ copy_generic_path_info(Plan *dest, Path *src)
335+
@@ -5451,6 +5456,7 @@ copy_generic_path_info(Plan *dest, Path *src)
336336
dest->plan_width = src->pathtarget->width;
337337
dest->parallel_aware = src->parallel_aware;
338338
dest->parallel_safe = src->parallel_safe;
@@ -341,10 +341,10 @@ index c13586c537..2f889570de 100644
341341

342342
/*
343343
diff --git a/src/backend/optimizer/plan/planner.c b/src/backend/optimizer/plan/planner.c
344-
index0f423e9684..8cd228baa1 100644
344+
indexa4d523dcb0f..ed5cd3651f5 100644
345345
--- a/src/backend/optimizer/plan/planner.c
346346
+++ b/src/backend/optimizer/plan/planner.c
347-
@@ -144,7 +144,8 @@ static List *extract_rollup_sets(List *groupingSets);
347+
@@ -143,7 +143,8 @@ static List *extract_rollup_sets(List *groupingSets);
348348
static List *reorder_grouping_sets(List *groupingSets, List *sortclause);
349349
static void standard_qp_callback(PlannerInfo *root, void *extra);
350350
static double get_number_of_groups(PlannerInfo *root,
@@ -354,7 +354,7 @@ index 0f423e9684..8cd228baa1 100644
354354
grouping_sets_data *gd,
355355
List *target_list);
356356
static RelOptInfo *create_grouping_paths(PlannerInfo *root,
357-
@@ -3697,7 +3698,8 @@ standard_qp_callback(PlannerInfo *root, void *extra)
357+
@@ -3552,7 +3553,8 @@ standard_qp_callback(PlannerInfo *root, void *extra)
358358
*/
359359
static double
360360
get_number_of_groups(PlannerInfo *root,
@@ -364,7 +364,7 @@ index 0f423e9684..8cd228baa1 100644
364364
grouping_sets_data *gd,
365365
List *target_list)
366366
{
367-
@@ -3734,7 +3736,7 @@ get_number_of_groups(PlannerInfo *root,
367+
@@ -3589,7 +3591,7 @@ get_number_of_groups(PlannerInfo *root,
368368
GroupingSetData *gs = lfirst_node(GroupingSetData, lc3);
369369
doublenumGroups = estimate_num_groups(root,
370370
groupExprs,
@@ -373,7 +373,7 @@ index 0f423e9684..8cd228baa1 100644
373373
&gset,
374374
NULL);
375375

376-
@@ -3760,7 +3762,7 @@ get_number_of_groups(PlannerInfo *root,
376+
@@ -3615,7 +3617,7 @@ get_number_of_groups(PlannerInfo *root,
377377
GroupingSetData *gs = lfirst_node(GroupingSetData, lc2);
378378
doublenumGroups = estimate_num_groups(root,
379379
groupExprs,
@@ -382,7 +382,7 @@ index 0f423e9684..8cd228baa1 100644
382382
&gset,
383383
NULL);
384384

385-
@@ -3777,8 +3779,8 @@ get_number_of_groups(PlannerInfo *root,
385+
@@ -3632,8 +3634,8 @@ get_number_of_groups(PlannerInfo *root,
386386
groupExprs = get_sortgrouplist_exprs(root->processed_groupClause,
387387
target_list);
388388

@@ -393,7 +393,7 @@ index 0f423e9684..8cd228baa1 100644
393393
}
394394
}
395395
else if (parse->groupingSets)
396-
@@ -4168,7 +4170,8 @@ create_ordinary_grouping_paths(PlannerInfo *root, RelOptInfo *input_rel,
396+
@@ -4024,7 +4026,8 @@ create_ordinary_grouping_paths(PlannerInfo *root, RelOptInfo *input_rel,
397397
* Estimate number of groups.
398398
*/
399399
dNumGroups = get_number_of_groups(root,
@@ -403,7 +403,7 @@ index 0f423e9684..8cd228baa1 100644
403403
gd,
404404
extra->targetList);
405405

406-
@@ -7405,13 +7408,15 @@ create_partial_grouping_paths(PlannerInfo *root,
406+
@@ -7308,13 +7311,15 @@ create_partial_grouping_paths(PlannerInfo *root,
407407
if (cheapest_total_path != NULL)
408408
dNumPartialGroups =
409409
get_number_of_groups(root,
@@ -422,7 +422,7 @@ index 0f423e9684..8cd228baa1 100644
422422
extra->targetList);
423423

424424
diff --git a/src/backend/optimizer/util/relnode.c b/src/backend/optimizer/util/relnode.c
425-
indexd7266e4cdb..7e5b771d9f 100644
425+
indexff507331a06..068b63b9b47 100644
426426
--- a/src/backend/optimizer/util/relnode.c
427427
+++ b/src/backend/optimizer/util/relnode.c
428428
@@ -286,6 +286,7 @@ build_simple_rel(PlannerInfo *root, int relid, RelOptInfo *parent)
@@ -488,18 +488,18 @@ index d7266e4cdb..7e5b771d9f 100644
488488

489489
return ppi;
490490
diff --git a/src/backend/utils/adt/selfuncs.c b/src/backend/utils/adt/selfuncs.c
491-
index08fa6774d9..034b434773 100644
491+
index5b35debc8ff..06a7bebe4f8 100644
492492
--- a/src/backend/utils/adt/selfuncs.c
493493
+++ b/src/backend/utils/adt/selfuncs.c
494-
@@ -146,6 +146,7 @@
494+
@@ -147,6 +147,7 @@
495495
/* Hooks for plugins to get control when we ask for stats */
496496
get_relation_stats_hook_type get_relation_stats_hook = NULL;
497497
get_index_stats_hook_type get_index_stats_hook = NULL;
498498
+estimate_num_groups_hook_type estimate_num_groups_hook = NULL;
499499

500500
static double eqsel_internal(PG_FUNCTION_ARGS, bool negate);
501501
static double eqjoinsel_inner(Oid opfuncoid, Oid collation,
502-
@@ -3345,6 +3346,20 @@ add_unique_group_var(PlannerInfo *root, List *varinfos,
502+
@@ -3355,6 +3356,20 @@ add_unique_group_var(PlannerInfo *root, List *varinfos,
503503
return varinfos;
504504
}
505505

@@ -521,7 +521,7 @@ index 08fa6774d9..034b434773 100644
521521
* estimate_num_groups- Estimate number of groups in a grouped query
522522
*
523523
diff --git a/src/include/commands/explain.h b/src/include/commands/explain.h
524-
index3ab0aae78f..5a257cdb0a 100644
524+
index64547bd9b9c..74792f1a8cf 100644
525525
--- a/src/include/commands/explain.h
526526
+++ b/src/include/commands/explain.h
527527
@@ -87,6 +87,18 @@ extern PGDLLIMPORT ExplainOneQuery_hook_type ExplainOneQuery_hook;
@@ -544,10 +544,10 @@ index 3ab0aae78f..5a257cdb0a 100644
544544
extern void ExplainQuery(ParseState *pstate, ExplainStmt *stmt,
545545
ParamListInfo params, DestReceiver *dest);
546546
diff --git a/src/include/nodes/pathnodes.h b/src/include/nodes/pathnodes.h
547-
index07e2415398..1413fbf03c 100644
547+
indexfbf05322c75..8fcb1fadda6 100644
548548
--- a/src/include/nodes/pathnodes.h
549549
+++ b/src/include/nodes/pathnodes.h
550-
@@ -1049,6 +1049,16 @@ typedef struct RelOptInfo
550+
@@ -1073,6 +1073,16 @@ typedef struct RelOptInfo
551551
List **partexprs pg_node_attr(read_write_ignore);
552552
/* Nullable partition key expressions */
553553
List **nullable_partexprs pg_node_attr(read_write_ignore);
@@ -564,7 +564,7 @@ index 07e2415398..1413fbf03c 100644
564564
} RelOptInfo;
565565

566566
/*
567-
@@ -1586,6 +1596,10 @@ typedef struct ParamPathInfo
567+
@@ -1615,6 +1625,10 @@ typedef struct ParamPathInfo
568568
Cardinality ppi_rows;/* estimated number of result tuples */
569569
List *ppi_clauses;/* join clauses available from outer rels */
570570
Bitmapset *ppi_serials;/* set of rinfo_serial for enforced quals */
@@ -576,10 +576,10 @@ index 07e2415398..1413fbf03c 100644
576576

577577

578578
diff --git a/src/include/nodes/plannodes.h b/src/include/nodes/plannodes.h
579-
index62cd6a6666..bb47a51ba7 100644
579+
index22841211f48..7a247fa8de8 100644
580580
--- a/src/include/nodes/plannodes.h
581581
+++ b/src/include/nodes/plannodes.h
582-
@@ -170,6 +170,9 @@ typedef struct Plan
582+
@@ -218,6 +218,9 @@ typedef struct Plan
583583
*/
584584
Bitmapset *extParam;
585585
Bitmapset *allParam;
@@ -590,7 +590,7 @@ index 62cd6a6666..bb47a51ba7 100644
590590

591591
/* ----------------
592592
diff --git a/src/include/optimizer/cost.h b/src/include/optimizer/cost.h
593-
index854a782944..9e8cde176f 100644
593+
index3aa3c16e442..cf39af9a974 100644
594594
--- a/src/include/optimizer/cost.h
595595
+++ b/src/include/optimizer/cost.h
596596
@@ -41,6 +41,37 @@ typedef enum
@@ -674,7 +674,7 @@ index 854a782944..9e8cde176f 100644
674674

675675
#endif/* COST_H */
676676
diff --git a/src/include/optimizer/pathnode.h b/src/include/optimizer/pathnode.h
677-
index1035e6560c..27e42b2679 100644
677+
index719be3897f6..dddc76fcefd 100644
678678
--- a/src/include/optimizer/pathnode.h
679679
+++ b/src/include/optimizer/pathnode.h
680680
@@ -18,6 +18,10 @@
@@ -689,10 +689,10 @@ index 1035e6560c..27e42b2679 100644
689689
* prototypes for pathnode.c
690690
*/
691691
diff --git a/src/include/optimizer/planmain.h b/src/include/optimizer/planmain.h
692-
index93137261e4..0621c27595 100644
692+
index5a930199611..69d4668b801 100644
693693
--- a/src/include/optimizer/planmain.h
694694
+++ b/src/include/optimizer/planmain.h
695-
@@ -24,6 +24,12 @@ extern PGDLLIMPORTdouble cursor_tuple_fraction;
695+
@@ -25,6 +25,12 @@ extern PGDLLIMPORTbool enable_self_join_elimination;
696696
/* query_planner callback to compute query_pathkeys */
697697
typedef void (*query_pathkeys_callback) (PlannerInfo *root, void *extra);
698698

@@ -706,10 +706,10 @@ index 93137261e4..0621c27595 100644
706706
* prototypes for plan/planmain.c
707707
*/
708708
diff --git a/src/include/utils/selfuncs.h b/src/include/utils/selfuncs.h
709-
indexf2563ad1cb..0beac5f313 100644
709+
index82ac8c6d9da..bc168ff691d 100644
710710
--- a/src/include/utils/selfuncs.h
711711
+++ b/src/include/utils/selfuncs.h
712-
@@ -147,6 +147,13 @@ typedef bool (*get_index_stats_hook_type) (PlannerInfo *root,
712+
@@ -148,6 +148,13 @@ typedef bool (*get_index_stats_hook_type) (PlannerInfo *root,
713713
AttrNumber indexattnum,
714714
VariableStatData *vardata);
715715
extern PGDLLIMPORT get_index_stats_hook_type get_index_stats_hook;
@@ -723,7 +723,7 @@ index f2563ad1cb..0beac5f313 100644
723723

724724
/* Functions in selfuncs.c */
725725

726-
@@ -213,6 +220,9 @@ extern void mergejoinscansel(PlannerInfo *root, Node *clause,
726+
@@ -214,6 +221,9 @@ extern void mergejoinscansel(PlannerInfo *root, Node *clause,
727727
Selectivity *leftstart, Selectivity *leftend,
728728
Selectivity *rightstart, Selectivity *rightend);
729729

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp