Skip to content

Commit 49065c2

Browse files
committed
Merge branch 'PGPROEE9_6_aqo' into PGPROEE9_6
2 parents f53fa74 + 8a41e28 commit 49065c2

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

contrib/aqo/auto_tuning.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ converged_cq(double *elems, int nelems)
8585
bool
8686
is_in_infinite_loop_cq(double *elems, int nelems)
8787
{
88-
if (nelems - auto_tuning_infinite_loop > auto_tuning_window_size + 2)
88+
if (nelems - auto_tuning_infinite_loop < auto_tuning_window_size + 2)
8989
return false;
9090

9191
return !converged_cq(elems, nelems) &&

contrib/aqo/preprocessing.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@
4646
*
4747
*****************************************************************************/
4848

49+
#define CREATE_EXTENSION_STARTSTRING_0 \
50+
"-- complain if script is sourced in psql, rather than via CREATE EXTENSION"
51+
#define CREATE_EXTENSION_STARTSTRING_1 \
52+
"SELECT 1 FROM ONLY \"public\".\"aqo_queries\" x WHERE \"query_hash\"\
53+
OPERATOR(pg_catalog.=) $1 FOR KEY SHARE OF x"
54+
4955
static const char *query_text;
5056

5157
/*
@@ -94,8 +100,12 @@ aqo_planner(Query *parse,
94100

95101
selectivity_cache_clear();
96102

97-
if (parse->commandType != CMD_SELECT && parse->commandType != CMD_INSERT &&
98-
parse->commandType != CMD_UPDATE && parse->commandType != CMD_DELETE)
103+
if ((parse->commandType != CMD_SELECT && parse->commandType != CMD_INSERT &&
104+
parse->commandType != CMD_UPDATE && parse->commandType != CMD_DELETE) ||
105+
strncmp(query_text, CREATE_EXTENSION_STARTSTRING_0,
106+
strlen(CREATE_EXTENSION_STARTSTRING_0)) == 0 ||
107+
strncmp(query_text, CREATE_EXTENSION_STARTSTRING_1,
108+
strlen(CREATE_EXTENSION_STARTSTRING_1)) == 0)
99109
{
100110
disable_aqo_for_query();
101111
return call_default_planner(parse, cursorOptions, boundParams);

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