diff options
author | Tomas Vondra | 2017-07-29 22:29:24 +0000 |
---|---|---|
committer | Tomas Vondra | 2017-07-31 01:20:26 +0000 |
commit | d0fdaba0d704f76ec3a4f098abec6b4551539342 (patch) | |
tree | 8532aa8c2a1903a2b8b4f57723109521c88e66e1 | |
parent | a1b98e2c82f45fa53c949ce93a9477da2277308e (diff) |
Tweak the query plan check in join regression test
The test expects the plan to use Index Scan, but with 1000 rows the
differences are very small. With two data nodes, we however compute
the estimates as if the tables had 500 rows, making the cost difference
even smaller.
Fixed by increasing the total number of rows to 2000, which means each
datanode has about 1000 and uses the same cost estimates as upstream.
-rw-r--r-- | src/test/regress/expected/join.out | 27 | ||||
-rw-r--r-- | src/test/regress/sql/join.sql | 4 |
2 files changed, 17 insertions, 14 deletions
diff --git a/src/test/regress/expected/join.out b/src/test/regress/expected/join.out index cfb758ae19..786791a4aa 100644 --- a/src/test/regress/expected/join.out +++ b/src/test/regress/expected/join.out @@ -5659,8 +5659,8 @@ SELECT count(*) FROM testr WHERE NOT EXISTS (SELECT * FROM testh WHERE testr.b = begin; create table fkest (a int, b int, c int unique, primary key(a,b)); create table fkest1 (a int, b int, primary key(a,b)); -insert into fkest select x/10, x%10, x from generate_series(1,1000) x; -insert into fkest1 select x/10, x%10 from generate_series(1,1000) x; +insert into fkest select x/10, x%10, x from generate_series(1,2000) x; +insert into fkest1 select x/10, x%10 from generate_series(1,2000) x; alter table fkest1 add constraint fkest1_a_b_fkey foreign key (a,b) references fkest; analyze fkest; @@ -5672,20 +5672,23 @@ from fkest f left join fkest1 f2 on f.a = f2.a and f.b = f2.b left join fkest1 f3 on f.a = f3.a and f.b = f3.b where f.c = 1; - QUERY PLAN ------------------------------------------------------------------- - Nested Loop Left Join + QUERY PLAN +------------------------------------------------------------------------ + Remote Subquery Scan on all (datanode_1,datanode_2) -> Nested Loop Left Join -> Nested Loop Left Join - -> Index Scan using fkest_c_key on fkest f - Index Cond: (c = 1) - -> Index Only Scan using fkest1_pkey on fkest1 f1 + -> Nested Loop Left Join + -> Remote Subquery Scan on all (datanode_1) + Distribute results by H: a + -> Index Scan using fkest_c_key on fkest f + Index Cond: (c = 1) + -> Index Only Scan using fkest1_pkey on fkest1 f1 + Index Cond: ((a = f.a) AND (b = f.b)) + -> Index Only Scan using fkest1_pkey on fkest1 f2 Index Cond: ((a = f.a) AND (b = f.b)) - -> Index Only Scan using fkest1_pkey on fkest1 f2 + -> Index Only Scan using fkest1_pkey on fkest1 f3 Index Cond: ((a = f.a) AND (b = f.b)) - -> Index Only Scan using fkest1_pkey on fkest1 f3 - Index Cond: ((a = f.a) AND (b = f.b)) -(11 rows) +(14 rows) rollback; -- diff --git a/src/test/regress/sql/join.sql b/src/test/regress/sql/join.sql index 2f70763034..3eeddf34de 100644 --- a/src/test/regress/sql/join.sql +++ b/src/test/regress/sql/join.sql @@ -1797,8 +1797,8 @@ begin; create table fkest (a int, b int, c int unique, primary key(a,b)); create table fkest1 (a int, b int, primary key(a,b)); -insert into fkest select x/10, x%10, x from generate_series(1,1000) x; -insert into fkest1 select x/10, x%10 from generate_series(1,1000) x; +insert into fkest select x/10, x%10, x from generate_series(1,2000) x; +insert into fkest1 select x/10, x%10 from generate_series(1,2000) x; alter table fkest1 add constraint fkest1_a_b_fkey foreign key (a,b) references fkest; |