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

Commit52d586e

Browse files
Daniil Anisimova.pervushina
Daniil Anisimov
authored and
a.pervushina
committed
Bugfix of look_a_like test.
Add ANALYZE after creating tables to stabilize results of the test.
1 parentfc7e5ff commit52d586e

File tree

2 files changed

+45
-40
lines changed

2 files changed

+45
-40
lines changed

‎expected/look_a_like.out

Lines changed: 42 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ CREATE TABLE a (x1 int, x2 int, x3 int);
2222
INSERT INTO a (x1, x2, x3) SELECT mod(ival,10), mod(ival,10), mod(ival,10) FROM generate_series(1,100) As ival;
2323
CREATE TABLE b (y1 int, y2 int, y3 int);
2424
INSERT INTO b (y1, y2, y3) SELECT mod(ival + 1,10), mod(ival + 1,10), mod(ival + 1,10) FROM generate_series(1,1000) As ival;
25+
ANALYZE a, b;
2526
--
2627
-- Returns string-by-string explain of a query. Made for removing some strings
2728
-- from the explain output.
@@ -90,22 +91,22 @@ SELECT str AS result
9091
FROM expln('
9192
SELECT x1,y1 FROM A,B WHERE x1 < 5 AND x2 < 5 AND A.x1 = B.y1;') AS str
9293
WHERE str NOT LIKE 'Query Identifier%' and str NOT LIKE '%Memory%' and str NOT LIKE '%Sort Method%';
93-
result
94-
-----------------------------------------------------------
94+
result
95+
-------------------------------------------------------------
9596
Hash Join (actual rows=5000 loops=1)
9697
AQO not used
9798
Output: a.x1, b.y1
98-
Hash Cond: (b.y1 =a.x1)
99-
-> Seq Scan on public.b (actual rows=1000 loops=1)
99+
Hash Cond: (a.x1 =b.y1)
100+
-> Seq Scan on public.a (actual rows=50 loops=1)
100101
AQO not used
101-
Output: b.y1, b.y2, b.y3
102-
-> Hash (actual rows=50 loops=1)
103-
Output: a.x1
104-
-> Seq Scan on public.a (actual rows=50 loops=1)
102+
Output: a.x1, a.x2, a.x3
103+
Filter: ((a.x1 < 5) AND (a.x2 < 5))
104+
Rows Removed by Filter: 50
105+
-> Hash (actual rows=1000 loops=1)
106+
Output: b.y1
107+
-> Seq Scan on public.b (actual rows=1000 loops=1)
105108
AQO not used
106-
Output: a.x1
107-
Filter: ((a.x1 < 5) AND (a.x2 < 5))
108-
Rows Removed by Filter: 50
109+
Output: b.y1
109110
Using aqo: true
110111
AQO mode: LEARN
111112
JOINS: 1
@@ -191,22 +192,22 @@ SELECT str AS result
191192
FROM expln('
192193
SELECT x1,y1 FROM A,B WHERE x1 < 5 AND x2 < 5 AND x3 < 10 AND A.x1 = B.y1;') AS str
193194
WHERE str NOT LIKE 'Query Identifier%' and str NOT LIKE '%Memory%' and str NOT LIKE '%Sort Method%';
194-
result
195-
-------------------------------------------------------------------
195+
result
196+
-------------------------------------------------------------
196197
Hash Join (actual rows=5000 loops=1)
197198
AQO not used
198199
Output: a.x1, b.y1
199-
Hash Cond: (b.y1 =a.x1)
200-
-> Seq Scan on public.b (actual rows=1000 loops=1)
201-
AQO: rows=1000, error=0%
202-
Output:b.y1, b.y2, b.y3
203-
-> Hash (actual rows=50 loops=1)
204-
Output: a.x1
205-
->Seq Scan on public.a(actual rows=50 loops=1)
206-
AQO not used
207-
Output: a.x1
208-
Filter: ((a.x1 < 5) AND (a.x2 < 5) AND (a.x3 < 10))
209-
Rows Removed by Filter: 50
200+
Hash Cond: (a.x1 =b.y1)
201+
-> Seq Scan on public.a (actual rows=50 loops=1)
202+
AQO not used
203+
Output:a.x1, a.x2, a.x3
204+
Filter: ((a.x1 < 5) AND (a.x2 < 5) AND (a.x3 < 10))
205+
Rows Removed by Filter: 50
206+
->Hash(actual rows=1000 loops=1)
207+
Output: b.y1
208+
-> Seq Scan on public.b (actual rows=1000 loops=1)
209+
AQO: rows=1000, error=0%
210+
Output: b.y1
210211
Using aqo: true
211212
AQO mode: LEARN
212213
JOINS: 1
@@ -486,34 +487,35 @@ WHERE str NOT LIKE 'Query Identifier%' and str NOT LIKE '%Memory%' and str NOT L
486487

487488
CREATE TABLE c (z1 int, z2 int, z3 int);
488489
INSERT INTO c (z1, z2, z3) SELECT mod(ival + 1,10), mod(ival + 1,10), mod(ival + 1,10) FROM generate_series(1,1000) As ival;
490+
ANALYZE c;
489491
SELECT str AS result
490492
FROM expln('
491493
SELECT * FROM (a LEFT JOIN b ON a.x1 = b.y1) sc WHERE
492494
not exists (SELECT z1 FROM c WHERE sc.x1=c.z1 );') AS str
493495
WHERE str NOT LIKE 'Query Identifier%' and str NOT LIKE '%Memory%' and str NOT LIKE '%Sort Method%';
494-
result
495-
-------------------------------------------------------------------
496-
HashLeft Join (actual rows=0 loops=1)
496+
result
497+
-------------------------------------------------------------------------
498+
HashRight Join (actual rows=0 loops=1)
497499
AQO not used
498500
Output: a.x1, a.x2, a.x3, b.y1, b.y2, b.y3
499-
Hash Cond: (a.x1 = b.y1)
500-
-> Hash Anti Join (actual rows=0 loops=1)
501-
AQO not used
501+
Hash Cond: (b.y1 = a.x1)
502+
-> Seq Scan on public.b (never executed)
503+
AQO: rows=1000
504+
Output: b.y1, b.y2, b.y3
505+
-> Hash (actual rows=0 loops=1)
502506
Output: a.x1, a.x2, a.x3
503-
Hash Cond: (a.x1 = c.z1)
504-
-> Seq Scan on public.a (actual rows=100 loops=1)
507+
-> Hash Anti Join (actual rows=0 loops=1)
505508
AQO not used
506509
Output: a.x1, a.x2, a.x3
507-
-> Hash (actual rows=1000 loops=1)
508-
Output: c.z1
509-
-> Seq Scan on public.c (actual rows=1000 loops=1)
510+
Hash Cond: (a.x1 = c.z1)
511+
-> Seq Scan on public.a (actual rows=100 loops=1)
510512
AQO not used
513+
Output: a.x1, a.x2, a.x3
514+
-> Hash (actual rows=1000 loops=1)
511515
Output: c.z1
512-
-> Hash (never executed)
513-
Output: b.y1, b.y2, b.y3
514-
-> Seq Scan on public.b (never executed)
515-
AQO: rows=1000
516-
Output: b.y1, b.y2, b.y3
516+
-> Seq Scan on public.c (actual rows=1000 loops=1)
517+
AQO not used
518+
Output: c.z1
517519
Using aqo: true
518520
AQO mode: LEARN
519521
JOINS: 2

‎sql/look_a_like.sql

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ INSERT INTO a (x1, x2, x3) SELECT mod(ival,10), mod(ival,10), mod(ival,10) FROM
2121
CREATETABLEb (y1int, y2int, y3int);
2222
INSERT INTO b (y1, y2, y3)SELECT mod(ival+1,10), mod(ival+1,10), mod(ival+1,10)FROM generate_series(1,1000)As ival;
2323

24+
ANALYZE a, b;
2425

2526
--
2627
-- Returns string-by-string explain of a query. Made for removing some strings
@@ -128,6 +129,8 @@ WHERE str NOT LIKE 'Query Identifier%' and str NOT LIKE '%Memory%' and str NOT L
128129
CREATETABLEc (z1int, z2int, z3int);
129130
INSERT INTO c (z1, z2, z3)SELECT mod(ival+1,10), mod(ival+1,10), mod(ival+1,10)FROM generate_series(1,1000)As ival;
130131

132+
ANALYZE c;
133+
131134
SELECT strAS result
132135
FROM expln('
133136
SELECT * FROM (a LEFT JOIN b ON a.x1 = b.y1) sc WHERE

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp