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

Commit 9a5c4f5

Browse files
committed
Try to stabilize EXPLAIN output in partition_check test.
Commit 7d8ac98 adjusted these tests in the hope of preserving the plan shape, but I failed to notice that the three partitions were, on my local machine, choosing two different plan shapes. This is probably related to the fact that all three tables have exactly the same row count. Try to improve the situation by making pht1_e about half as large as the other two. Per Tom Lane and the buildfarm. Discussion: http://postgr.es/m/25380.1519277713@sss.pgh.pa.us
1 parent 7d8ac98 commit 9a5c4f5

File tree

2 files changed

+27
-33
lines changed

2 files changed

+27
-33
lines changed

src/test/regress/expected/partition_join.out

+26-32
Original file line numberDiff line numberDiff line change
@@ -1285,13 +1285,13 @@ CREATE TABLE pht1_e (a int, b int, c text) PARTITION BY HASH(ltrim(c, 'A'));
12851285
CREATE TABLE pht1_e_p1 PARTITION OF pht1_e FOR VALUES WITH (MODULUS 3, REMAINDER 0);
12861286
CREATE TABLE pht1_e_p2 PARTITION OF pht1_e FOR VALUES WITH (MODULUS 3, REMAINDER 1);
12871287
CREATE TABLE pht1_e_p3 PARTITION OF pht1_e FOR VALUES WITH (MODULUS 3, REMAINDER 2);
1288-
INSERT INTO pht1_e SELECT i, i, 'A' || to_char(i/50, 'FM0000') FROM generate_series(0, 599, 2) i;
1288+
INSERT INTO pht1_e SELECT i, i, 'A' || to_char(i/50, 'FM0000') FROM generate_series(0, 299, 2) i;
12891289
ANALYZE pht1_e;
12901290
-- test partition matching with N-way join
12911291
EXPLAIN (COSTS OFF)
12921292
SELECT avg(t1.a), avg(t2.b), avg(t3.a + t3.b), t1.c, t2.c, t3.c FROM pht1 t1, pht2 t2, pht1_e t3 WHERE t1.b = t2.b AND t1.c = t2.c AND ltrim(t3.c, 'A') = t1.c GROUP BY t1.c, t2.c, t3.c ORDER BY t1.c, t2.c, t3.c;
1293-
QUERY PLAN
1294-
--------------------------------------------------------------------------------------------
1293+
QUERY PLAN
1294+
--------------------------------------------------------------------------------------
12951295
GroupAggregate
12961296
Group Key: t1.c, t2.c, t3.c
12971297
-> Sort
@@ -1308,41 +1308,35 @@ SELECT avg(t1.a), avg(t2.b), avg(t3.a + t3.b), t1.c, t2.c, t3.c FROM pht1 t1, ph
13081308
-> Hash
13091309
-> Seq Scan on pht1_e_p1 t3
13101310
-> Hash Join
1311-
Hash Cond: (ltrim(t3_1.c, 'A'::text) = t1_1.c)
1312-
-> Seq Scan on pht1_e_p2 t3_1
1311+
Hash Cond: (t1_1.c = ltrim(t3_1.c, 'A'::text))
1312+
-> Hash Join
1313+
Hash Cond: ((t1_1.b = t2_1.b) AND (t1_1.c = t2_1.c))
1314+
-> Seq Scan on pht1_p2 t1_1
1315+
-> Hash
1316+
-> Seq Scan on pht2_p2 t2_1
13131317
-> Hash
1314-
-> Hash Join
1315-
Hash Cond: ((t1_1.b = t2_1.b) AND (t1_1.c = t2_1.c))
1316-
-> Seq Scan on pht1_p2 t1_1
1317-
-> Hash
1318-
-> Seq Scan on pht2_p2 t2_1
1318+
-> Seq Scan on pht1_e_p2 t3_1
13191319
-> Hash Join
1320-
Hash Cond: (ltrim(t3_2.c, 'A'::text) = t1_2.c)
1321-
-> Seq Scan on pht1_e_p3 t3_2
1320+
Hash Cond: (t1_2.c = ltrim(t3_2.c, 'A'::text))
1321+
-> Hash Join
1322+
Hash Cond: ((t1_2.b = t2_2.b) AND (t1_2.c = t2_2.c))
1323+
-> Seq Scan on pht1_p3 t1_2
1324+
-> Hash
1325+
-> Seq Scan on pht2_p3 t2_2
13221326
-> Hash
1323-
-> Hash Join
1324-
Hash Cond: ((t1_2.b = t2_2.b) AND (t1_2.c = t2_2.c))
1325-
-> Seq Scan on pht1_p3 t1_2
1326-
-> Hash
1327-
-> Seq Scan on pht2_p3 t2_2
1327+
-> Seq Scan on pht1_e_p3 t3_2
13281328
(33 rows)
13291329

13301330
SELECT avg(t1.a), avg(t2.b), avg(t3.a + t3.b), t1.c, t2.c, t3.c FROM pht1 t1, pht2 t2, pht1_e t3 WHERE t1.b = t2.b AND t1.c = t2.c AND ltrim(t3.c, 'A') = t1.c GROUP BY t1.c, t2.c, t3.c ORDER BY t1.c, t2.c, t3.c;
1331-
avg | avg | avg | c | c | c
1332-
----------------------+----------------------+-----------------------+------+------+-------
1333-
24.0000000000000000 | 24.0000000000000000 | 48.0000000000000000 | 0000 | 0000 | A0000
1334-
75.0000000000000000 | 75.0000000000000000 | 148.0000000000000000 | 0001 | 0001 | A0001
1335-
123.0000000000000000 | 123.0000000000000000 | 248.0000000000000000 | 0002 | 0002 | A0002
1336-
174.0000000000000000 | 174.0000000000000000 | 348.0000000000000000 | 0003 | 0003 | A0003
1337-
225.0000000000000000 | 225.0000000000000000 | 448.0000000000000000 | 0004 | 0004 | A0004
1338-
273.0000000000000000 | 273.0000000000000000 | 548.0000000000000000 | 0005 | 0005 | A0005
1339-
324.0000000000000000 | 324.0000000000000000 | 648.0000000000000000 | 0006 | 0006 | A0006
1340-
375.0000000000000000 | 375.0000000000000000 | 748.0000000000000000 | 0007 | 0007 | A0007
1341-
423.0000000000000000 | 423.0000000000000000 | 848.0000000000000000 | 0008 | 0008 | A0008
1342-
474.0000000000000000 | 474.0000000000000000 | 948.0000000000000000 | 0009 | 0009 | A0009
1343-
525.0000000000000000 | 525.0000000000000000 | 1048.0000000000000000 | 0010 | 0010 | A0010
1344-
573.0000000000000000 | 573.0000000000000000 | 1148.0000000000000000 | 0011 | 0011 | A0011
1345-
(12 rows)
1331+
avg | avg | avg | c | c | c
1332+
----------------------+----------------------+----------------------+------+------+-------
1333+
24.0000000000000000 | 24.0000000000000000 | 48.0000000000000000 | 0000 | 0000 | A0000
1334+
75.0000000000000000 | 75.0000000000000000 | 148.0000000000000000 | 0001 | 0001 | A0001
1335+
123.0000000000000000 | 123.0000000000000000 | 248.0000000000000000 | 0002 | 0002 | A0002
1336+
174.0000000000000000 | 174.0000000000000000 | 348.0000000000000000 | 0003 | 0003 | A0003
1337+
225.0000000000000000 | 225.0000000000000000 | 448.0000000000000000 | 0004 | 0004 | A0004
1338+
273.0000000000000000 | 273.0000000000000000 | 548.0000000000000000 | 0005 | 0005 | A0005
1339+
(6 rows)
13461340

13471341
--
13481342
-- multiple levels of partitioning

src/test/regress/sql/partition_join.sql

+1-1
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ CREATE TABLE pht1_e (a int, b int, c text) PARTITION BY HASH(ltrim(c, 'A'));
253253
CREATE TABLE pht1_e_p1 PARTITION OF pht1_e FOR VALUES WITH (MODULUS 3, REMAINDER 0);
254254
CREATE TABLE pht1_e_p2 PARTITION OF pht1_e FOR VALUES WITH (MODULUS 3, REMAINDER 1);
255255
CREATE TABLE pht1_e_p3 PARTITION OF pht1_e FOR VALUES WITH (MODULUS 3, REMAINDER 2);
256-
INSERT INTO pht1_e SELECT i, i, 'A' || to_char(i/50, 'FM0000') FROM generate_series(0, 599, 2) i;
256+
INSERT INTO pht1_e SELECT i, i, 'A' || to_char(i/50, 'FM0000') FROM generate_series(0, 299, 2) i;
257257
ANALYZE pht1_e;
258258

259259
-- test partition matching with N-way join

0 commit comments

Comments
 (0)