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

Commitd2cddcd

Browse files
Andrey Kazarinovdanolivo
Andrey Kazarinov
authored andcommitted
[PGPRO-7183] arrange stable branches 13, 14, 15
Minor changes
1 parent763b45b commitd2cddcd

File tree

13 files changed

+70
-64
lines changed

13 files changed

+70
-64
lines changed

‎.github/workflows/c-cpp.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
branches:[ stable14 ]
88

99
env:
10-
BRANCH_NAME:${{ github.head_ref || github.ref_name }}
10+
BRANCH_NAME:${{ github.head_ref || github.ref_name }}
1111

1212
jobs:
1313
build:
@@ -28,10 +28,10 @@ jobs:
2828
cd pg
2929
3030
git checkout REL_14_STABLE
31-
./configure $CONFIGURE_OPTS CFLAGS="-O3"
3231
git clone https://github.com/postgrespro/aqo.git contrib/aqo
3332
git -C contrib/aqo checkout $BRANCH_NAME
3433
patch -p1 --no-backup-if-mismatch < contrib/aqo/aqo_pg14.patch
34+
./configure $CONFIGURE_OPTS CFLAGS="-O2"
3535
make -j4 > /dev/null && make -j4 -C contrib > /dev/null
3636
env CLIENTS=50 THREADS=50 make -C contrib/aqo check
3737

‎README.md‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ To avoid compatibility issues, the following branches in the git-repository are
1313
*`stable9_6`.
1414
*`stable11` - for PG v10 and v11.
1515
*`stable12` - for PG v12.
16-
* the`master` branch of the AQO repository correctly works with PGv13 and the PostgreSQL`master` branch.
16+
*`stable13` - for PG v13.
17+
*`stable14` - for PG v14.
18+
*`stable15` - for PG v15.
19+
* the`master` branch of the AQO repository correctly works with PGv15 and the PostgreSQL`master` branch.
1720

1821
The module contains a patch and an extension. Patch has to be applied to the
1922
sources of PostgresSQL. Patch affects header files, that is why PostgreSQL

‎aqo.conf‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ autovacuum = off
22
shared_preload_libraries = 'postgres_fdw, aqo'
33
max_parallel_maintenance_workers = 1 # switch off parallel workers because of unsteadiness
44
aqo.wide_search = 'on'
5-
compute_query_id = 'regress'
5+
compute_query_id = 'regress'

‎aqo_pg14.patch‎

Lines changed: 34 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
diff --git a/contrib/Makefile b/contrib/Makefile
2-
indexf27e458482e..0c621919045 100644
2+
indexf27e458482..0c62191904 100644
33
--- a/contrib/Makefile
44
+++ b/contrib/Makefile
55
@@ -7,6 +7,7 @@ include $(top_builddir)/src/Makefile.global
@@ -11,17 +11,17 @@ index f27e458482e..0c621919045 100644
1111
auto_explain\
1212
bloom\
1313
diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c
14-
index70551522dac..d9cca82fe84 100644
14+
index70551522da..958529fbab 100644
1515
--- a/src/backend/commands/explain.c
1616
+++ b/src/backend/commands/explain.c
17-
@@ -25,6 +25,7 @@
17+
@@ -24,6 +24,7 @@
18+
#include "nodes/extensible.h"
1819
#include "nodes/makefuncs.h"
1920
#include "nodes/nodeFuncs.h"
20-
#include "parser/analyze.h"
2121
+#include "optimizer/cost.h"
22+
#include "parser/analyze.h"
2223
#include "parser/parsetree.h"
2324
#include "rewrite/rewriteHandler.h"
24-
#include "storage/bufmgr.h"
2525
@@ -47,6 +48,12 @@ ExplainOneQuery_hook_type ExplainOneQuery_hook = NULL;
2626
/* Hook for plugins to get control in explain_get_index_name() */
2727
explain_get_index_name_hook_type explain_get_index_name_hook = NULL;
@@ -57,7 +57,7 @@ index 70551522dac..d9cca82fe84 100644
5757
if (es->format == EXPLAIN_FORMAT_TEXT)
5858
appendStringInfoChar(es->str, '\n');
5959
diff --git a/src/backend/nodes/copyfuncs.c b/src/backend/nodes/copyfuncs.c
60-
index4d9746d54a0..6fa85d1c71f 100644
60+
index4d9746d54a..6fa85d1c71 100644
6161
--- a/src/backend/nodes/copyfuncs.c
6262
+++ b/src/backend/nodes/copyfuncs.c
6363
@@ -132,6 +132,7 @@ CopyPlanFields(const Plan *from, Plan *newnode)
@@ -69,7 +69,7 @@ index 4d9746d54a0..6fa85d1c71f 100644
6969

7070
/*
7171
diff --git a/src/backend/nodes/outfuncs.c b/src/backend/nodes/outfuncs.c
72-
index58c2590698c..1e06738a137 100644
72+
index58c2590698..1e06738a13 100644
7373
--- a/src/backend/nodes/outfuncs.c
7474
+++ b/src/backend/nodes/outfuncs.c
7575
@@ -342,6 +342,7 @@ _outPlanInfo(StringInfo str, const Plan *node)
@@ -81,7 +81,7 @@ index 58c2590698c..1e06738a137 100644
8181

8282
/*
8383
diff --git a/src/backend/nodes/readfuncs.c b/src/backend/nodes/readfuncs.c
84-
indexeaa51c5c062..6ad8b78c7d5 100644
84+
indexeaa51c5c06..6ad8b78c7d 100644
8585
--- a/src/backend/nodes/readfuncs.c
8686
+++ b/src/backend/nodes/readfuncs.c
8787
@@ -1628,6 +1628,11 @@ ReadCommonPlan(Plan *local_node)
@@ -97,7 +97,7 @@ index eaa51c5c062..6ad8b78c7d5 100644
9797

9898
/*
9999
diff --git a/src/backend/optimizer/path/costsize.c b/src/backend/optimizer/path/costsize.c
100-
index006f91f0a87..ef9c8ec5817 100644
100+
index006f91f0a8..ef9c8ec581 100644
101101
--- a/src/backend/optimizer/path/costsize.c
102102
+++ b/src/backend/optimizer/path/costsize.c
103103
@@ -98,6 +98,11 @@
@@ -362,7 +362,7 @@ index 006f91f0a87..ef9c8ec5817 100644
362362
{
363363
doubleparallel_divisor = path->parallel_workers;
364364
diff --git a/src/backend/optimizer/plan/createplan.c b/src/backend/optimizer/plan/createplan.c
365-
index0ed858f305a..9d4a6c59030 100644
365+
index0ed858f305..9d4a6c5903 100644
366366
--- a/src/backend/optimizer/plan/createplan.c
367367
+++ b/src/backend/optimizer/plan/createplan.c
368368
@@ -71,6 +71,7 @@
@@ -393,7 +393,7 @@ index 0ed858f305a..9d4a6c59030 100644
393393

394394
/*
395395
diff --git a/src/backend/optimizer/plan/planner.c b/src/backend/optimizer/plan/planner.c
396-
index70899e5430e..dac6132af54 100644
396+
index70899e5430..34075cc87b 100644
397397
--- a/src/backend/optimizer/plan/planner.c
398398
+++ b/src/backend/optimizer/plan/planner.c
399399
@@ -143,7 +143,8 @@ static List *extract_rollup_sets(List *groupingSets);
@@ -441,7 +441,7 @@ index 70899e5430e..dac6132af54 100644
441441
-dNumGroups = estimate_num_groups(root, groupExprs, path_rows,
442442
- NULL, NULL);
443443
+dNumGroups = estimate_num_groups_ext(root, groupExprs, subpath,
444-
+ grouped_rel, NULL);
444+
+ grouped_rel, NULL, NULL);
445445
}
446446
}
447447
else if (parse->groupingSets)
@@ -474,7 +474,7 @@ index 70899e5430e..dac6132af54 100644
474474
extra->targetList);
475475

476476
diff --git a/src/backend/optimizer/util/relnode.c b/src/backend/optimizer/util/relnode.c
477-
indexe105a4d5f1d..c5bcc9d1d15 100644
477+
indexe105a4d5f1..c5bcc9d1d1 100644
478478
--- a/src/backend/optimizer/util/relnode.c
479479
+++ b/src/backend/optimizer/util/relnode.c
480480
@@ -258,6 +258,7 @@ build_simple_rel(PlannerInfo *root, int relid, RelOptInfo *parent)
@@ -540,15 +540,9 @@ index e105a4d5f1d..c5bcc9d1d15 100644
540540

541541
return ppi;
542542
diff --git a/src/backend/utils/adt/selfuncs.c b/src/backend/utils/adt/selfuncs.c
543-
index962dec6d504..899ee2bf4c5 100644
543+
index87879c9ddc..1aad8c43d9 100644
544544
--- a/src/backend/utils/adt/selfuncs.c
545545
+++ b/src/backend/utils/adt/selfuncs.c
546-
@@ -1,4 +1,4 @@
547-
-/*-------------------------------------------------------------------------
548-
+ /*-------------------------------------------------------------------------
549-
*
550-
* selfuncs.c
551-
* Selectivity functions and index cost estimation functions for
552546
@@ -143,6 +143,7 @@
553547
/* Hooks for plugins to get control when we ask for stats */
554548
get_relation_stats_hook_type get_relation_stats_hook = NULL;
@@ -557,28 +551,29 @@ index 962dec6d504..899ee2bf4c5 100644
557551

558552
static double eqsel_internal(PG_FUNCTION_ARGS, bool negate);
559553
static double eqjoinsel_inner(Oid opfuncoid, Oid collation,
560-
@@ -3293,6 +3294,19 @@ add_unique_group_var(PlannerInfo *root, List *varinfos,
554+
@@ -3293,6 +3294,20 @@ add_unique_group_var(PlannerInfo *root, List *varinfos,
561555
return varinfos;
562556
}
563557

564558
+double
565559
+estimate_num_groups_ext(PlannerInfo *root, List *groupExprs, Path *subpath,
566-
+RelOptInfo *grouped_rel, List **pgset)
560+
+RelOptInfo *grouped_rel, List **pgset,
561+
+EstimationInfo *estinfo)
567562
+{
568563
+double input_rows = subpath->rows;
569564
+
570565
+if (estimate_num_groups_hook != NULL)
571-
+return (*estimate_num_groups_hook)(root, groupExprs, subpath,
572-
+grouped_rel, pgset);
566+
+return (*estimate_num_groups_hook)(root, groupExprs, subpath, grouped_rel,
567+
+pgset, estinfo);
573568
+
574-
+return estimate_num_groups(root, groupExprs, input_rows, pgset,NULL);
569+
+return estimate_num_groups(root, groupExprs, input_rows, pgset,estinfo);
575570
+}
576571
+
577572
/*
578573
* estimate_num_groups- Estimate number of groups in a grouped query
579574
*
580575
diff --git a/src/include/commands/explain.h b/src/include/commands/explain.h
581-
indexe94d9e49cf6..49236ced77c 100644
576+
indexe94d9e49cf..49236ced77 100644
582577
--- a/src/include/commands/explain.h
583578
+++ b/src/include/commands/explain.h
584579
@@ -75,6 +75,18 @@ extern PGDLLIMPORT ExplainOneQuery_hook_type ExplainOneQuery_hook;
@@ -601,7 +596,7 @@ index e94d9e49cf6..49236ced77c 100644
601596
extern void ExplainQuery(ParseState *pstate, ExplainStmt *stmt,
602597
ParamListInfo params, DestReceiver *dest);
603598
diff --git a/src/include/nodes/pathnodes.h b/src/include/nodes/pathnodes.h
604-
indexf16466a0df1..8f0ed706817 100644
599+
indexe370a01141..9f2f1628f5 100644
605600
--- a/src/include/nodes/pathnodes.h
606601
+++ b/src/include/nodes/pathnodes.h
607602
@@ -756,6 +756,10 @@ typedef struct RelOptInfo
@@ -640,24 +635,21 @@ index f16466a0df1..8f0ed706817 100644
640635

641636

642637
diff --git a/src/include/nodes/plannodes.h b/src/include/nodes/plannodes.h
643-
index2308c80ddee..dc74cf85bd2 100644
638+
index2308c80dde..a933afa483 100644
644639
--- a/src/include/nodes/plannodes.h
645640
+++ b/src/include/nodes/plannodes.h
646-
@@ -158,6 +158,12 @@ typedef struct Plan
641+
@@ -158,6 +158,9 @@ typedef struct Plan
647642
*/
648643
Bitmapset *extParam;
649644
Bitmapset *allParam;
650645
+
651-
+/*
652-
+ * Additional fields for an extension purposes.
653-
+ * TODO: allow to serialize/deserialize this list.
654-
+ */
646+
+/* Additional field for an extension purposes. */
655647
+List*ext_nodes;
656648
} Plan;
657649

658650
/* ----------------
659651
diff --git a/src/include/optimizer/cost.h b/src/include/optimizer/cost.h
660-
index2113bc82de0..bcc2520cec5 100644
652+
index2113bc82de..bcc2520cec 100644
661653
--- a/src/include/optimizer/cost.h
662654
+++ b/src/include/optimizer/cost.h
663655
@@ -39,6 +39,37 @@ typedef enum
@@ -741,7 +733,7 @@ index 2113bc82de0..bcc2520cec5 100644
741733

742734
#endif/* COST_H */
743735
diff --git a/src/include/optimizer/pathnode.h b/src/include/optimizer/pathnode.h
744-
index2922c0cdc14..c59dce6989e 100644
736+
index2922c0cdc1..c59dce6989 100644
745737
--- a/src/include/optimizer/pathnode.h
746738
+++ b/src/include/optimizer/pathnode.h
747739
@@ -18,6 +18,10 @@
@@ -756,7 +748,7 @@ index 2922c0cdc14..c59dce6989e 100644
756748
* prototypes for pathnode.c
757749
*/
758750
diff --git a/src/include/optimizer/planmain.h b/src/include/optimizer/planmain.h
759-
indexbf1adfc52ac..9c78e0f4e02 100644
751+
indexbf1adfc52a..9c78e0f4e0 100644
760752
--- a/src/include/optimizer/planmain.h
761753
+++ b/src/include/optimizer/planmain.h
762754
@@ -24,6 +24,12 @@ extern double cursor_tuple_fraction;
@@ -773,29 +765,30 @@ index bf1adfc52ac..9c78e0f4e02 100644
773765
* prototypes for plan/planmain.c
774766
*/
775767
diff --git a/src/include/utils/selfuncs.h b/src/include/utils/selfuncs.h
776-
index9dd444e1ff5..37133340d84 100644
768+
index9dd444e1ff..cfaae98aa2 100644
777769
--- a/src/include/utils/selfuncs.h
778770
+++ b/src/include/utils/selfuncs.h
779-
@@ -144,6 +144,12 @@ typedef bool (*get_index_stats_hook_type) (PlannerInfo *root,
771+
@@ -144,6 +144,13 @@ typedef bool (*get_index_stats_hook_type) (PlannerInfo *root,
780772
AttrNumber indexattnum,
781773
VariableStatData *vardata);
782774
extern PGDLLIMPORT get_index_stats_hook_type get_index_stats_hook;
783775
+typedef double (*estimate_num_groups_hook_type) (PlannerInfo *root,
784776
+ List *groupExprs,
785777
+ Path *subpath,
786778
+ RelOptInfo *grouped_rel,
787-
+ List **pgset);
779+
+ List **pgset,
780+
+ EstimationInfo *estinfo);
788781
+extern PGDLLIMPORT estimate_num_groups_hook_type estimate_num_groups_hook;
789782

790783
/* Functions in selfuncs.c */
791784

792-
@@ -213,6 +219,9 @@ extern void mergejoinscansel(PlannerInfo *root, Node *clause,
785+
@@ -213,6 +220,9 @@ extern void mergejoinscansel(PlannerInfo *root, Node *clause,
793786
extern double estimate_num_groups(PlannerInfo *root, List *groupExprs,
794787
double input_rows, List **pgset,
795788
EstimationInfo *estinfo);
796789
+extern double estimate_num_groups_ext(PlannerInfo *root, List *groupExprs,
797790
+ Path *subpath, RelOptInfo *grouped_rel,
798-
+ List **pgset);
791+
+ List **pgset, EstimationInfo *estinfo);
799792

800793
extern void estimate_hash_bucket_stats(PlannerInfo *root,
801794
Node *hashkey, double nbuckets,

‎cardinality_hooks.c‎

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,17 +117,17 @@ default_set_joinrel_size_estimates(PlannerInfo *root, RelOptInfo *rel,
117117
staticdouble
118118
default_estimate_num_groups(PlannerInfo*root,List*groupExprs,
119119
Path*subpath,RelOptInfo*grouped_rel,
120-
List**pgset)
120+
List**pgset,EstimationInfo*estinfo)
121121
{
122122
doubleinput_rows=subpath->rows;
123123

124124
if (prev_estimate_num_groups_hook!=NULL)
125125
return (*prev_estimate_num_groups_hook)(root,groupExprs,
126126
subpath,
127127
grouped_rel,
128-
pgset);
128+
pgset,estinfo);
129129
else
130-
returnestimate_num_groups(root,groupExprs,input_rows,pgset,NULL);
130+
returnestimate_num_groups(root,groupExprs,input_rows,pgset,estinfo);
131131
}
132132

133133
/*
@@ -463,7 +463,7 @@ predict_num_groups(PlannerInfo *root, Path *subpath, List *group_exprs,
463463
double
464464
aqo_estimate_num_groups_hook(PlannerInfo*root,List*groupExprs,
465465
Path*subpath,RelOptInfo*grouped_rel,
466-
List**pgset)
466+
List**pgset,EstimationInfo*estinfo)
467467
{
468468
intfss;
469469
doublepredicted;
@@ -479,6 +479,10 @@ aqo_estimate_num_groups_hook(PlannerInfo *root, List *groupExprs,
479479
if (prev_estimate_num_groups_hook!=NULL)
480480
elog(WARNING,"AQO replaced another estimator of a groups number");
481481

482+
/* Zero the estinfo output parameter, if non-NULL */
483+
if (estinfo!=NULL)
484+
memset(estinfo,0,sizeof(EstimationInfo));
485+
482486
if (groupExprs==NIL)
483487
return1.0;
484488

@@ -504,5 +508,5 @@ aqo_estimate_num_groups_hook(PlannerInfo *root, List *groupExprs,
504508

505509
default_estimator:
506510
returndefault_estimate_num_groups(root,groupExprs,subpath,grouped_rel,
507-
pgset);
511+
pgset,estinfo);
508512
}

‎cardinality_hooks.h‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ extern double aqo_get_parameterized_joinrel_size(PlannerInfo *root,
2626
externdoubleaqo_estimate_num_groups_hook(PlannerInfo*root,List*groupExprs,
2727
Path*subpath,
2828
RelOptInfo*grouped_rel,
29-
List**pgset);
29+
List**pgset,
30+
EstimationInfo*estinfo);
3031

3132
#endif/* CARDINALITY_HOOKS_H */

‎expected/statement_timeout.out‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,12 +111,12 @@ SELECT check_estimated_rows('SELECT *, pg_sleep(1) FROM t;');
111111
5
112112
(1 row)
113113

114-
DROP TABLE t;
115114
SELECT 1 FROM aqo_reset();
116115
?column?
117116
----------
118117
1
119118
(1 row)
120119

120+
DROP TABLE t;
121121
DROP EXTENSION aqo;
122122
DROP FUNCTION check_estimated_rows;

‎expected/unsupported.out‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ CREATE TABLE t1 AS SELECT mod(gs,10) AS x, mod(gs+1,10) AS y
1717
FROM generate_series(1,1000) AS gs;
1818
ANALYZE t, t1;
1919
--
20-
-- Do not support HAVINGclause for now.
20+
-- Do not support HAVINGclauses for now.
2121
--
2222
SELECT count(*) FROM (SELECT * FROM t GROUP BY (x) HAVING x > 3) AS q1;
2323
count
@@ -43,8 +43,8 @@ EXPLAIN (COSTS OFF)
4343
(11 rows)
4444

4545
SELECT str FROM expln('
46-
EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF)
47-
SELECT * FROM t GROUP BY (x) HAVING x > 3;
46+
EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF)
47+
SELECT * FROM t GROUP BY (x) HAVING x > 3;
4848
') AS str WHERE str NOT LIKE '%Memory Usage%';
4949
str
5050
-----------------------------------------------
@@ -586,10 +586,6 @@ ORDER BY (md5(query_text),error) DESC;
586586
| SELECT count(*) FROM t WHERE +
587587
| x = (SELECT avg(x) FROM t t0 WHERE t0.x = t.x + 21) OR +
588588
| x IN (SELECT avg(x) FROM t t0 WHERE t0.x = t.x + 21);
589-
0.106 | +
590-
| EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF) +
591-
| SELECT * FROM t GROUP BY (x) HAVING x > 3; +
592-
|
593589
0.454 | SELECT count(*) FROM (SELECT x, y FROM t1 GROUP BY GROUPING SETS ((x,y), (x), (y), ())) AS q1;
594590
0.000 | SELECT count(*) FROM ( +
595591
| SELECT count(*) AS x FROM ( +
@@ -602,6 +598,10 @@ ORDER BY (md5(query_text),error) DESC;
602598
0.000 | EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF) +
603599
| SELECT count(*) FROM t WHERE (SELECT avg(x) FROM t t0 WHERE t0.x = t.x) = +
604600
| (SELECT avg(x) FROM t t0 WHERE t0.x = t.x);
601+
0.106 | +
602+
| EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF) +
603+
| SELECT * FROM t GROUP BY (x) HAVING x > 3; +
604+
|
605605
0.000 | SELECT count(*) FROM +
606606
| (SELECT * FROM t WHERE x % 3 < (SELECT avg(x) FROM t t0 WHERE t0.x = t.x)) AS q1 +
607607
| JOIN +

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp