Skip to content

Commit 9dcc7b3

Browse files
committed
Code (extension and the core) changes needed to be used with the explain extension
1 parent 4a7fcd7 commit 9dcc7b3

File tree

2 files changed

+15
-16
lines changed

2 files changed

+15
-16
lines changed

aqo.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,6 @@
144144
#include "utils/snapmgr.h"
145145

146146
#include "machine_learning.h"
147-
//#include "storage.h"
148147

149148
/* Check PostgreSQL version (9.6.0 contains important changes in planner) */
150149
#if PG_VERSION_NUM < 90600
@@ -271,11 +270,11 @@ extern bool update_fss_ext(uint64 fs, int fss, OkNNrdata *data, List *reloids);
271270

272271
/* Query preprocessing hooks */
273272
extern void print_into_explain(PlannedStmt *plannedstmt, IntoClause *into,
274-
ExplainState *es, const char *queryString,
273+
struct ExplainState *es, const char *queryString,
275274
ParamListInfo params,
276275
const instr_time *planduration,
277276
QueryEnvironment *queryEnv);
278-
extern void print_node_explain(ExplainState *es, PlanState *ps, Plan *plan);
277+
extern void print_node_explain(struct ExplainState *es, PlanState *ps, Plan *plan);
279278

280279
/* Cardinality estimation */
281280
extern double predict_for_relation(List *restrict_clauses, List *selectivities,

aqo_master.patch

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c
2-
index 19ffcc2cacb..93934d42e30 100644
2+
index 22616cf7add..8a28b783f72 100644
33
--- a/src/backend/commands/explain.c
44
+++ b/src/backend/commands/explain.c
5-
@@ -27,6 +27,7 @@
5+
@@ -29,6 +29,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-
@@ -50,6 +51,12 @@ ExplainOneQuery_hook_type ExplainOneQuery_hook = NULL;
14-
/* Hook for plugins to get control in explain_get_index_name() */
15-
explain_get_index_name_hook_type explain_get_index_name_hook = NULL;
13+
@@ -45,6 +46,12 @@
14+
#include "utils/typcache.h"
15+
#include "utils/xml.h"
1616

1717
+/* Hook for plugins to get control in ExplainOnePlan() */
1818
+ExplainOnePlan_hook_type ExplainOnePlan_hook = NULL;
@@ -21,9 +21,9 @@ index 19ffcc2cacb..93934d42e30 100644
2121
+ExplainOneNode_hook_type ExplainOneNode_hook = NULL;
2222
+
2323

24-
/*
25-
* Various places within need to convert bytes to kilobytes. Round these up
26-
@@ -815,6 +822,10 @@ ExplainOnePlan(PlannedStmt *plannedstmt, CachedPlan *cplan,
24+
/* Hook for plugins to get control in ExplainOneQuery() */
25+
ExplainOneQuery_hook_type ExplainOneQuery_hook = NULL;
26+
@@ -690,6 +697,10 @@ ExplainOnePlan(PlannedStmt *plannedstmt, CachedPlan *cplan,
2727
ExplainPropertyFloat("Execution Time", "ms", 1000.0 * totaltime, 3,
2828
es);
2929

@@ -34,7 +34,7 @@ index 19ffcc2cacb..93934d42e30 100644
3434
ExplainCloseGroup("Query", NULL, true, es);
3535
}
3636

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

@@ -521,22 +521,22 @@ index 5b35debc8ff..06a7bebe4f8 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-
index 64547bd9b9c..74792f1a8cf 100644
524+
index e8e92f966a1..323b3391b35 100644
525525
--- a/src/include/commands/explain.h
526526
+++ b/src/include/commands/explain.h
527-
@@ -87,6 +87,18 @@ extern PGDLLIMPORT ExplainOneQuery_hook_type ExplainOneQuery_hook;
527+
@@ -49,6 +49,18 @@ extern PGDLLIMPORT explain_per_node_hook_type explain_per_node_hook;
528528
typedef const char *(*explain_get_index_name_hook_type) (Oid indexId);
529529
extern PGDLLIMPORT explain_get_index_name_hook_type explain_get_index_name_hook;
530530

531531
+/* Hook for plugins to get control in ExplainOnePlan() */
532532
+typedef void (*ExplainOnePlan_hook_type) (PlannedStmt *plannedstmt, IntoClause *into,
533-
+ ExplainState *es, const char *queryString,
533+
+ struct ExplainState *es, const char *queryString,
534534
+ ParamListInfo params, const instr_time *planduration,
535535
+ QueryEnvironment *queryEnv);
536536
+extern PGDLLIMPORT ExplainOnePlan_hook_type ExplainOnePlan_hook;
537537
+
538538
+/* Explain a node info */
539-
+typedef void (*ExplainOneNode_hook_type) (ExplainState *es,
539+
+typedef void (*ExplainOneNode_hook_type) (struct ExplainState *es,
540540
+ PlanState *ps,
541541
+ Plan *plan);
542542
+extern PGDLLIMPORT ExplainOneNode_hook_type ExplainOneNode_hook;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy