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

Commit 04fdd70

Browse files
Alexandra PervushinaDaniil Anisimov
Alexandra Pervushina
authored and
Daniil Anisimov
committed
Print aqo details regardless of IsQueryDisabled
1 parent 1978fee commit 04fdd70

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

postprocessing.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -766,6 +766,7 @@ aqo_ExecutorEnd(QueryDesc *queryDesc)
766766

767767
cardinality_sum_errors = 0.;
768768
cardinality_num_objects = 0;
769+
njoins = -1;
769770

770771
if (IsQueryDisabled() || !ExtractFromQueryEnv(queryDesc))
771772
/* AQO keep all query-related preferences at the query context.
@@ -996,7 +997,7 @@ print_into_explain(PlannedStmt *plannedstmt, IntoClause *into,
996997
(*aqo_ExplainOnePlan_next)(plannedstmt, into, es, queryString,
997998
params, planduration, queryEnv);
998999

999-
if (IsQueryDisabled() || !aqo_show_details)
1000+
if (!(aqo_mode != AQO_MODE_DISABLED || force_collect_stat) || !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
@@ -127,6 +127,7 @@ aqo_planner(Query *parse, const char *query_string, int cursorOptions,
127127
* all execution stages.
128128
*/
129129
disable_aqo_for_query();
130+
query_context.query_hash = 0;
130131

131132
return (*aqo_planner_next)(parse, query_string, cursorOptions, boundParams);
132133
}
@@ -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)