Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 33a64e0

Browse files
Alexandra PervushinaDaniil Anisimov
Alexandra Pervushina
authored and
Daniil Anisimov
committed
Print aqo details regardless of IsQueryDisabled
1 parent e4999b7 commit 33a64e0

File tree

3 files changed

+13
-10
lines changed

3 files changed

+13
-10
lines changed

aqo.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ MemoryContext AQOLearnMemCtx = NULL;
9696
MemoryContext AQOStorageMemCtx = NULL;
9797

9898
/* Additional plan info */
99-
int njoins;
99+
int njoins = -1;
100100

101101

102102
/*****************************************************************************

postprocessing.c

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ static void StoreToQueryEnv(QueryDesc *queryDesc);
8585
static void StorePlanInternals(QueryDesc *queryDesc);
8686
static bool ExtractFromQueryEnv(QueryDesc *queryDesc);
8787

88-
8988
/*
9089
* This is the critical section: only one runner is allowed to be inside this
9190
* function for one feature subspace.
@@ -766,6 +765,7 @@ aqo_ExecutorEnd(QueryDesc *queryDesc)
766765

767766
cardinality_sum_errors = 0.;
768767
cardinality_num_objects = 0;
768+
njoins = -1;
769769

770770
if (IsQueryDisabled() || !ExtractFromQueryEnv(queryDesc))
771771
/* AQO keep all query-related preferences at the query context.
@@ -996,7 +996,8 @@ print_into_explain(PlannedStmt *plannedstmt, IntoClause *into,
996996
(*aqo_ExplainOnePlan_next)(plannedstmt, into, es, queryString,
997997
params, planduration, queryEnv);
998998

999-
if (IsQueryDisabled() || !aqo_show_details)
999+
if (!(aqo_mode != AQO_MODE_DISABLED || force_collect_stat) ||
1000+
!aqo_show_details)
10001001
return;
10011002

10021003
/* Report to user about aqo state only in verbose mode */
@@ -1031,13 +1032,10 @@ print_into_explain(PlannedStmt *plannedstmt, IntoClause *into,
10311032
* Query class provides an user the conveniently use of the AQO
10321033
* auxiliary functions.
10331034
*/
1034-
if (aqo_mode != AQO_MODE_DISABLED || force_collect_stat)
1035-
{
1036-
if (aqo_show_hash)
1037-
ExplainPropertyInteger("Query hash", NULL,
1038-
query_context.query_hash, es);
1039-
ExplainPropertyInteger("JOINS", NULL, njoins, es);
1040-
}
1035+
if (aqo_show_hash)
1036+
ExplainPropertyInteger("Query hash", NULL,
1037+
(int64) query_context.query_hash, es);
1038+
ExplainPropertyInteger("JOINS", NULL, njoins, es);
10411039
}
10421040

10431041
static void

preprocessing.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ aqo_planner(Query *parse, const char *query_string, int cursorOptions,
130130
*/
131131
MemoryContextSwitchTo(oldctx);
132132
disable_aqo_for_query();
133+
query_context.query_hash = 0;
133134

134135
return (*aqo_planner_next)(parse, query_string, cursorOptions, boundParams);
135136
}
@@ -233,7 +234,11 @@ aqo_planner(Query *parse, const char *query_string, int cursorOptions,
233234
*/
234235
if (!query_context.learn_aqo && !query_context.use_aqo &&
235236
!query_context.auto_tuning && !force_collect_stat)
237+
{
236238
add_deactivated_query(query_context.query_hash);
239+
disable_aqo_for_query();
240+
goto ignore_query_settings;
241+
}
237242

238243
/*
239244
* That we can do if query exists in database.

0 commit comments

Comments
 (0)