diff options
author | Tomas Vondra | 2017-03-19 00:07:05 +0000 |
---|---|---|
committer | Tomas Vondra | 2017-03-19 00:07:05 +0000 |
commit | 58ad0411dffe11b9a13d25f3ee5b0aa94100e25d (patch) | |
tree | 9496ed2f25b6aae066663f2858e6ff9293026d61 | |
parent | 8348b99ab92424a29c131fde094f0dc880838cae (diff) |
Resolve failures in the xc_FQS regression suite
Most of the changes were simply due to plan changes introduced in
PostgreSQL 9.6, typically a SELECT DISTINCT switching from hash or
group Aggregate to Unique. The plans were verified by running the
same query on PostgreSQL 9.6, which should produce about the same
plan (except for the Remote Subquery nodes, of course).
Also fixes the result ordering for three queries by adding an
explicit ORDER BY clause.
-rw-r--r-- | src/test/regress/expected/xc_FQS.out | 186 | ||||
-rw-r--r-- | src/test/regress/sql/xc_FQS.sql | 8 |
2 files changed, 100 insertions, 94 deletions
diff --git a/src/test/regress/expected/xc_FQS.out b/src/test/regress/expected/xc_FQS.out index b635a9c689..c46d741ccb 100644 --- a/src/test/regress/expected/xc_FQS.out +++ b/src/test/regress/expected/xc_FQS.out @@ -198,16 +198,16 @@ select distinct val, val2 from tab1_rr where val2 = 8; (1 row) explain (verbose on, nodes off, costs off) select distinct val, val2 from tab1_rr where val2 = 8; - QUERY PLAN ----------------------------------------------------- - HashAggregate + QUERY PLAN +------------------------------------------------ + Unique Output: val, val2 - Group Key: tab1_rr.val, tab1_rr.val2 -> Remote Subquery Scan on all Output: val, val2 - -> HashAggregate + Sort Key: tab1_rr.val + -> Sort Output: val, val2 - Group Key: tab1_rr.val, tab1_rr.val2 + Sort Key: tab1_rr.val -> Seq Scan on public.tab1_rr Output: val, val2 Filter: (tab1_rr.val2 = 8) @@ -221,20 +221,21 @@ select val, val2 from tab1_rr where val2 = 8 group by val, val2; (1 row) explain (verbose on, nodes off, costs off) select val, val2 from tab1_rr where val2 = 8 group by val, val2; - QUERY PLAN ----------------------------------------------------- - HashAggregate + QUERY PLAN +------------------------------------------------ + Group Output: val, val2 Group Key: tab1_rr.val, tab1_rr.val2 -> Remote Subquery Scan on all Output: val, val2 - -> HashAggregate + Sort Key: tab1_rr.val + -> Sort Output: val, val2 - Group Key: tab1_rr.val, tab1_rr.val2 + Sort Key: tab1_rr.val -> Seq Scan on public.tab1_rr Output: val, val2 Filter: (tab1_rr.val2 = 8) -(11 rows) +(12 rows) -- should not get FQSed because of HAVING clause select sum(val) from tab1_rr where val2 = 2 group by val2 having sum(val) > 1; @@ -244,21 +245,18 @@ select sum(val) from tab1_rr where val2 = 2 group by val2 having sum(val) > 1; (1 row) explain (verbose on, nodes off, costs off) select sum(val) from tab1_rr where val2 = 2 group by val2 having sum(val) > 1; - QUERY PLAN ----------------------------------------------------- + QUERY PLAN +------------------------------------------ GroupAggregate - Output: pg_catalog.sum((sum(val))), val2 + Output: sum(val), val2 Group Key: tab1_rr.val2 - Filter: (pg_catalog.sum((sum(tab1_rr.val))) > 1) + Filter: (sum(tab1_rr.val) > 1) -> Remote Subquery Scan on all - Output: sum(val), val2 - -> GroupAggregate - Output: sum(val), val2 - Group Key: tab1_rr.val2 - -> Seq Scan on public.tab1_rr - Output: val, val2 - Filter: (tab1_rr.val2 = 2) -(12 rows) + Output: val2, val + -> Seq Scan on public.tab1_rr + Output: val2, val + Filter: (tab1_rr.val2 = 2) +(9 rows) -- tests for node reduction by application of quals, for roundrobin node -- reduction is not applicable. Having query not FQSed because of existence of ORDER BY, @@ -392,24 +390,24 @@ explain (verbose on, nodes off, costs off) select val, val2 from tab1_rr where v Filter: (tab1_rr.val = 7) (9 rows) -select distinct val2 from tab1_rr where val = 7; +select distinct val2 from tab1_rr where val = 7 order by val2; val2 ------ - 8 2 + 8 (2 rows) -explain (verbose on, nodes off, costs off) select distinct val2 from tab1_rr where val = 7; +explain (verbose on, nodes off, costs off) select distinct val2 from tab1_rr where val = 7 order by val2; QUERY PLAN ----------------------------------------------- - HashAggregate + Unique Output: val2 - Group Key: tab1_rr.val2 -> Remote Subquery Scan on all Output: val2 - -> HashAggregate + Sort Key: tab1_rr.val2 + -> Sort Output: val2 - Group Key: tab1_rr.val2 + Sort Key: tab1_rr.val2 -> Seq Scan on public.tab1_rr Output: val2 Filter: (tab1_rr.val = 7) @@ -620,13 +618,15 @@ explain (verbose on, nodes off, costs off) select distinct val, val2 from tab1_h Remote Fast Query Execution Output: tab1_hash.val, tab1_hash.val2 Remote query: SELECT DISTINCT val, val2 FROM tab1_hash WHERE (val2 = 8) - -> HashAggregate + -> Unique Output: val, val2 - Group Key: tab1_hash.val, tab1_hash.val2 - -> Seq Scan on public.tab1_hash + -> Sort Output: val, val2 - Filter: (tab1_hash.val2 = 8) -(9 rows) + Sort Key: tab1_hash.val + -> Seq Scan on public.tab1_hash + Output: val, val2 + Filter: (tab1_hash.val2 = 8) +(11 rows) -- should get FQSed because GROUP BY clause uses distkey select val, val2 from tab1_hash where val2 = 8 group by val, val2; @@ -641,13 +641,16 @@ explain (verbose on, nodes off, costs off) select val, val2 from tab1_hash where Remote Fast Query Execution Output: tab1_hash.val, tab1_hash.val2 Remote query: SELECT val, val2 FROM tab1_hash WHERE (val2 = 8) GROUP BY val, val2 - -> HashAggregate + -> Group Output: val, val2 Group Key: tab1_hash.val, tab1_hash.val2 - -> Seq Scan on public.tab1_hash + -> Sort Output: val, val2 - Filter: (tab1_hash.val2 = 8) -(9 rows) + Sort Key: tab1_hash.val + -> Seq Scan on public.tab1_hash + Output: val, val2 + Filter: (tab1_hash.val2 = 8) +(12 rows) -- should not get FQSed because of HAVING clause select sum(val) from tab1_hash where val2 = 2 group by val2 having sum(val) > 1; @@ -657,21 +660,18 @@ select sum(val) from tab1_hash where val2 = 2 group by val2 having sum(val) > 1; (1 row) explain (verbose on, nodes off, costs off) select sum(val) from tab1_hash where val2 = 2 group by val2 having sum(val) > 1; - QUERY PLAN ------------------------------------------------------- + QUERY PLAN +-------------------------------------------- GroupAggregate - Output: pg_catalog.sum((sum(val))), val2 + Output: sum(val), val2 Group Key: tab1_hash.val2 - Filter: (pg_catalog.sum((sum(tab1_hash.val))) > 1) + Filter: (sum(tab1_hash.val) > 1) -> Remote Subquery Scan on all - Output: sum(val), val2 - -> GroupAggregate - Output: sum(val), val2 - Group Key: tab1_hash.val2 - -> Seq Scan on public.tab1_hash - Output: val, val2 - Filter: (tab1_hash.val2 = 2) -(12 rows) + Output: val2, val + -> Seq Scan on public.tab1_hash + Output: val2, val + Filter: (tab1_hash.val2 = 2) +(9 rows) -- tests for node reduction by application of quals. Having query FQSed because of -- existence of ORDER BY, implies that nodes got reduced. @@ -806,26 +806,28 @@ explain (verbose on, nodes off, costs off, num_nodes on) select val, val2 from t Filter: (tab1_hash.val = 7) (9 rows) -select distinct val2 from tab1_hash where val = 7; +select distinct val2 from tab1_hash where val = 7 order by val2; val2 ------ - 8 2 + 8 (2 rows) -explain (verbose on, nodes off, costs off, num_nodes on) select distinct val2 from tab1_hash where val = 7; - QUERY PLAN ---------------------------------------------------------------------- +explain (verbose on, nodes off, costs off, num_nodes on) select distinct val2 from tab1_hash where val = 7 order by val2; + QUERY PLAN +----------------------------------------------------------------------------------- Remote Fast Query Execution (primary node count=0, node count=1) Output: tab1_hash.val2 - Remote query: SELECT DISTINCT val2 FROM tab1_hash WHERE (val = 7) - -> HashAggregate + Remote query: SELECT DISTINCT val2 FROM tab1_hash WHERE (val = 7) ORDER BY val2 + -> Unique Output: val2 - Group Key: tab1_hash.val2 - -> Seq Scan on public.tab1_hash + -> Sort Output: val2 - Filter: (tab1_hash.val = 7) -(9 rows) + Sort Key: tab1_hash.val2 + -> Seq Scan on public.tab1_hash + Output: val2 + Filter: (tab1_hash.val = 7) +(11 rows) -- DMLs update tab1_hash set val2 = 1000 where val = 7; @@ -1032,13 +1034,15 @@ explain (verbose on, nodes off, costs off) select distinct val, val2 from tab1_m Remote Fast Query Execution Output: tab1_modulo.val, tab1_modulo.val2 Remote query: SELECT DISTINCT val, val2 FROM tab1_modulo WHERE (val2 = 8) - -> HashAggregate + -> Unique Output: val, val2 - Group Key: tab1_modulo.val, tab1_modulo.val2 - -> Seq Scan on public.tab1_modulo + -> Sort Output: val, val2 - Filter: (tab1_modulo.val2 = 8) -(9 rows) + Sort Key: tab1_modulo.val + -> Seq Scan on public.tab1_modulo + Output: val, val2 + Filter: (tab1_modulo.val2 = 8) +(11 rows) -- should get FQSed because GROUP BY clause uses distkey select val, val2 from tab1_modulo where val2 = 8 group by val, val2; @@ -1053,13 +1057,16 @@ explain (verbose on, nodes off, costs off) select val, val2 from tab1_modulo whe Remote Fast Query Execution Output: tab1_modulo.val, tab1_modulo.val2 Remote query: SELECT val, val2 FROM tab1_modulo WHERE (val2 = 8) GROUP BY val, val2 - -> HashAggregate + -> Group Output: val, val2 Group Key: tab1_modulo.val, tab1_modulo.val2 - -> Seq Scan on public.tab1_modulo + -> Sort Output: val, val2 - Filter: (tab1_modulo.val2 = 8) -(9 rows) + Sort Key: tab1_modulo.val + -> Seq Scan on public.tab1_modulo + Output: val, val2 + Filter: (tab1_modulo.val2 = 8) +(12 rows) -- should not get FQSed because of HAVING clause select sum(val) from tab1_modulo where val2 = 2 group by val2 having sum(val) > 1; @@ -1069,21 +1076,18 @@ select sum(val) from tab1_modulo where val2 = 2 group by val2 having sum(val) > (1 row) explain (verbose on, nodes off, costs off) select sum(val) from tab1_modulo where val2 = 2 group by val2 having sum(val) > 1; - QUERY PLAN --------------------------------------------------------- + QUERY PLAN +---------------------------------------------- GroupAggregate - Output: pg_catalog.sum((sum(val))), val2 + Output: sum(val), val2 Group Key: tab1_modulo.val2 - Filter: (pg_catalog.sum((sum(tab1_modulo.val))) > 1) + Filter: (sum(tab1_modulo.val) > 1) -> Remote Subquery Scan on all - Output: sum(val), val2 - -> GroupAggregate - Output: sum(val), val2 - Group Key: tab1_modulo.val2 - -> Seq Scan on public.tab1_modulo - Output: val, val2 - Filter: (tab1_modulo.val2 = 2) -(12 rows) + Output: val2, val + -> Seq Scan on public.tab1_modulo + Output: val2, val + Filter: (tab1_modulo.val2 = 2) +(9 rows) -- tests for node reduction by application of quals. Having query FQSed because of -- existence of ORDER BY, implies that nodes got reduced. @@ -1221,8 +1225,8 @@ explain (verbose on, nodes off, costs off, num_nodes on) select val, val2 from t select distinct val2 from tab1_modulo where val = 7; val2 ------ - 8 2 + 8 (2 rows) explain (verbose on, nodes off, costs off, num_nodes on) select distinct val2 from tab1_modulo where val = 7; @@ -1231,13 +1235,15 @@ explain (verbose on, nodes off, costs off, num_nodes on) select distinct val2 fr Remote Fast Query Execution (primary node count=0, node count=1) Output: tab1_modulo.val2 Remote query: SELECT DISTINCT val2 FROM tab1_modulo WHERE (val = 7) - -> HashAggregate + -> Unique Output: val2 - Group Key: tab1_modulo.val2 - -> Seq Scan on public.tab1_modulo + -> Sort Output: val2 - Filter: (tab1_modulo.val = 7) -(9 rows) + Sort Key: tab1_modulo.val2 + -> Seq Scan on public.tab1_modulo + Output: val2 + Filter: (tab1_modulo.val = 7) +(11 rows) -- DMLs update tab1_modulo set val2 = 1000 where val = 7; diff --git a/src/test/regress/sql/xc_FQS.sql b/src/test/regress/sql/xc_FQS.sql index cc488b8ea7..d0e945730f 100644 --- a/src/test/regress/sql/xc_FQS.sql +++ b/src/test/regress/sql/xc_FQS.sql @@ -96,8 +96,8 @@ select avg(val) from tab1_rr where val = 7; explain (verbose on, nodes off, costs off) select avg(val) from tab1_rr where val = 7; select val, val2 from tab1_rr where val = 7 order by val2; explain (verbose on, nodes off, costs off) select val, val2 from tab1_rr where val = 7 order by val2; -select distinct val2 from tab1_rr where val = 7; -explain (verbose on, nodes off, costs off) select distinct val2 from tab1_rr where val = 7; +select distinct val2 from tab1_rr where val = 7 order by val2; +explain (verbose on, nodes off, costs off) select distinct val2 from tab1_rr where val = 7 order by val2; -- DMLs update tab1_rr set val2 = 1000 where val = 7; explain (verbose on, nodes off, costs off) update tab1_rr set val2 = 1000 where val = 7; @@ -161,8 +161,8 @@ select avg(val) from tab1_hash where val = 7; explain (verbose on, nodes off, costs off, num_nodes on) select avg(val) from tab1_hash where val = 7; select val, val2 from tab1_hash where val = 7 order by val2; explain (verbose on, nodes off, costs off, num_nodes on) select val, val2 from tab1_hash where val = 7 order by val2; -select distinct val2 from tab1_hash where val = 7; -explain (verbose on, nodes off, costs off, num_nodes on) select distinct val2 from tab1_hash where val = 7; +select distinct val2 from tab1_hash where val = 7 order by val2; +explain (verbose on, nodes off, costs off, num_nodes on) select distinct val2 from tab1_hash where val = 7 order by val2; -- DMLs update tab1_hash set val2 = 1000 where val = 7; explain (verbose on, nodes off, costs off) update tab1_hash set val2 = 1000 where val = 7; |