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

Commite4900ab

Browse files
author
Alena Rybakina
committed
Fix to avoid bad situation, we will not have capable to calculate query_id
with JambleQuery, if compute_query_id is off.We set value of the compute_query_id parameter is 'on', while duringcalculate query_id operation and after its completion, we will returnits initial value.This solution seemed to be simple, but reliable.
1 parentfd02c7e commite4900ab

File tree

5 files changed

+25
-13
lines changed

5 files changed

+25
-13
lines changed

‎expected/aqo_fdw.out‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ SELECT x FROM frgn;
6262
SELECT str FROM expln('
6363
EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF, VERBOSE)
6464
SELECT x FROM frgn WHERE x < 10;
65-
') AS str;
65+
') AS str WHERE str NOT LIKE 'Query Identifier%';
6666
str
6767
-----------------------------------------------------------
6868
Foreign Scan on public.frgn (actual rows=1 loops=1)
@@ -77,7 +77,7 @@ SELECT str FROM expln('
7777
SELECT str FROM expln('
7878
EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF, VERBOSE)
7979
SELECT x FROM frgn WHERE x < 10;
80-
') AS str;
80+
') AS str WHERE str NOT LIKE 'Query Identifier%';
8181
str
8282
-----------------------------------------------------------
8383
Foreign Scan on public.frgn (actual rows=1 loops=1)
@@ -89,9 +89,11 @@ SELECT str FROM expln('
8989
JOINS: 0
9090
(7 rows)
9191

92+
SELECT str FROM expln('
9293
EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF)
9394
SELECT x FROM frgn WHERE x < -10; -- AQO ignores constants
94-
QUERY PLAN
95+
') AS str WHERE str NOT LIKE 'Query Identifier%';
96+
str
9597
----------------------------------------------
9698
Foreign Scan on frgn (actual rows=0 loops=1)
9799
AQO: rows=1, error=100%
@@ -127,7 +129,7 @@ SELECT str FROM expln('
127129
SELECT str FROM expln('
128130
EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF, VERBOSE)
129131
SELECT * FROM frgn AS a, frgn AS b WHERE a.x=b.x;
130-
') AS str;
132+
') AS str WHERE str NOT LIKE 'Query Identifier%';
131133
str
132134
--------------------------------------------------------------------------------------------------------
133135
Foreign Scan (actual rows=1 loops=1)
@@ -276,7 +278,7 @@ SELECT * FROM frgn AS a, frgn AS b WHERE a.x<b.x;
276278
SELECT str FROM expln('
277279
EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF, VERBOSE)
278280
SELECT * FROM frgn AS a, frgn AS b WHERE a.x<b.x;
279-
') AS str;
281+
') AS str WHERE str NOT LIKE 'Query Identifier%';
280282
str
281283
--------------------------------------------------------------------------------------------------------
282284
Foreign Scan (actual rows=0 loops=1)

‎expected/unsupported.out‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,7 @@ SELECT count(*) FROM t WHERE x < 3 AND mod(x,3) = 1;
535535
SELECT str FROM expln('
536536
EXPLAIN (ANALYZE, VERBOSE, COSTS OFF, SUMMARY OFF, TIMING OFF)
537537
SELECT count(*) FROM t WHERE x < 3 AND mod(x,3) = 1') AS str
538-
WHERE str NOT LIKE '%Heap Blocks%';
538+
WHERE str NOT LIKE '%Heap Blocks%' and str NOT LIKE 'Query Identifier%';
539539
str
540540
-----------------------------------------------------------------
541541
Aggregate (actual rows=1 loops=1)
@@ -555,9 +555,11 @@ WHERE str NOT LIKE '%Heap Blocks%';
555555

556556
-- Best choice is ...
557557
ANALYZE t;
558+
SELECT str FROM expln('
558559
EXPLAIN (COSTS OFF)
559560
SELECT count(*) FROM t WHERE x < 3 AND mod(x,3) = 1;
560-
QUERY PLAN
561+
') AS str WHERE str NOT LIKE 'Query Identifier%';
562+
str
561563
---------------------------------------
562564
Aggregate
563565
AQO not used

‎preprocessing.c‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ aqo_planner(Query *parse,
127127
{
128128
boolquery_is_stored= false;
129129
MemoryContextoldctx;
130+
intquery_id_enabled_temp=compute_query_id;
130131

131132
/*
132133
* We do not work inside an parallel worker now by reason of insert into
@@ -156,7 +157,11 @@ aqo_planner(Query *parse,
156157

157158
/* Check unlucky case (get a hash of zero) */
158159
if (parse->queryId==UINT64CONST(0))
160+
{
161+
compute_query_id=COMPUTE_QUERY_ID_ON;
159162
JumbleQuery(parse,query_string);
163+
compute_query_id=query_id_enabled_temp;
164+
}
160165

161166
Assert(parse->utilityStmt==NULL);
162167
Assert(parse->queryId!=UINT64CONST(0));

‎sql/aqo_fdw.sql‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,15 @@ SELECT x FROM frgn;
4747
SELECT strFROM expln('
4848
EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF, VERBOSE)
4949
SELECT x FROM frgn WHERE x < 10;
50-
')AS str;
50+
')AS strWHERE str NOTLIKE'Query Identifier%';
5151
SELECT strFROM expln('
5252
EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF, VERBOSE)
5353
SELECT x FROM frgn WHERE x < 10;
54-
')AS str;
54+
')AS strWHERE str NOTLIKE'Query Identifier%';
55+
SELECT strFROM expln('
5556
EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF)
5657
SELECT x FROM frgn WHERE x < -10; -- AQO ignores constants
57-
58+
')AS strWHERE str NOTLIKE'Query Identifier%';
5859
-- Trivial JOIN push-down.
5960
SELECT strFROM expln('
6061
EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF)
@@ -65,7 +66,7 @@ SELECT str FROM expln('
6566
SELECT strFROM expln('
6667
EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF, VERBOSE)
6768
SELECT * FROM frgn AS a, frgn AS b WHERE a.x=b.x;
68-
')AS str;
69+
')AS strWHERE str NOTLIKE'Query Identifier%';
6970

7071
CREATETABLElocal_a(aidintprimary key, avaltext);
7172
CREATETABLElocal_b(bidintprimary key, aidintreferences local_a(aid), bvaltext);
@@ -139,7 +140,7 @@ SELECT * FROM frgn AS a, frgn AS b WHERE a.x<b.x;
139140
SELECT strFROM expln('
140141
EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF, VERBOSE)
141142
SELECT * FROM frgn AS a, frgn AS b WHERE a.x<b.x;
142-
')AS str;
143+
')AS strWHERE str NOTLIKE'Query Identifier%';
143144

144145
DROP EXTENSION aqo CASCADE;
145146
DROP EXTENSION postgres_fdw CASCADE;

‎sql/unsupported.sql‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,12 +165,14 @@ SELECT count(*) FROM t WHERE x < 3 AND mod(x,3) = 1;
165165
SELECT strFROM expln('
166166
EXPLAIN (ANALYZE, VERBOSE, COSTS OFF, SUMMARY OFF, TIMING OFF)
167167
SELECT count(*) FROM t WHERE x < 3 AND mod(x,3) = 1')AS str
168-
WHERE str NOTLIKE'%Heap Blocks%';
168+
WHERE str NOTLIKE'%Heap Blocks%'and str NOTLIKE'Query Identifier%';
169169

170170
-- Best choice is ...
171171
ANALYZE t;
172+
SELECT strFROM expln('
172173
EXPLAIN (COSTS OFF)
173174
SELECT count(*) FROM t WHERE x < 3 AND mod(x,3) = 1;
175+
')AS strWHERE str NOTLIKE'Query Identifier%';
174176

175177
-- XXX: Do we stuck into an unstable behavior of an error value?
176178
-- Live with this variant of the test for some time.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp