From 8dc913ef0455e4f2da3942381a60ff660ae3a044 Mon Sep 17 00:00:00 2001 From: Marco Slot Date: Thu, 14 Jun 2018 23:39:03 +0200 Subject: [PATCH] Remove costs from explain plans in window_functions tests --- .../regress/expected/window_functions.out | 132 +++++++++--------- src/test/regress/sql/window_functions.sql | 14 +- 2 files changed, 73 insertions(+), 73 deletions(-) diff --git a/src/test/regress/expected/window_functions.out b/src/test/regress/expected/window_functions.out index 1a0a2bc55..4d4cf5878 100644 --- a/src/test/regress/expected/window_functions.out +++ b/src/test/regress/expected/window_functions.out @@ -500,7 +500,7 @@ ORDER BY 1 | 3.2857142857142857 | 1.00000000000000000000 (6 rows) -EXPLAIN +EXPLAIN (COSTS FALSE) SELECT user_id, AVG(avg(value_1)) OVER (PARTITION BY user_id, max(user_id), MIN(value_2)), @@ -511,26 +511,26 @@ GROUP BY 1 ORDER BY 3 DESC, 2 DESC, 1 DESC; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------- - Sort (cost=0.00..0.00 rows=0 width=0) + QUERY PLAN +----------------------------------------------------------------------------------------------------------------------------------- + Sort Sort Key: remote_scan.avg_1 DESC, remote_scan.avg DESC, remote_scan.user_id DESC - -> HashAggregate (cost=0.00..0.00 rows=0 width=0) + -> HashAggregate Group Key: remote_scan.user_id - -> Custom Scan (Citus Real-Time) (cost=0.00..0.00 rows=0 width=0) + -> Custom Scan (Citus Real-Time) Task Count: 4 Tasks Shown: One of 4 -> Task Node: host=localhost port=57637 dbname=regression - -> WindowAgg (cost=5.06..5.80 rows=33 width=128) - -> Sort (cost=5.06..5.14 rows=33 width=128) + -> WindowAgg + -> Sort Sort Key: users_table.user_id, (min(users_table.user_id)), (avg(users_table.value_1)) - -> WindowAgg (cost=3.48..4.22 rows=33 width=128) - -> Sort (cost=3.48..3.56 rows=33 width=96) + -> WindowAgg + -> Sort Sort Key: users_table.user_id, (max(users_table.user_id)), (min(users_table.value_2)) - -> HashAggregate (cost=2.07..2.65 rows=33 width=96) + -> HashAggregate Group Key: users_table.user_id - -> Seq Scan on users_table_1400256 users_table (cost=0.00..1.33 rows=33 width=12) + -> Seq Scan on users_table_1400256 users_table (18 rows) SELECT @@ -579,7 +579,7 @@ ORDER BY 6 | 5 | 3.0000000000000000 (32 rows) -EXPLAIN +EXPLAIN (COSTS FALSE) SELECT user_id, 1 + sum(value_1), @@ -590,23 +590,23 @@ GROUP BY user_id, value_2 ORDER BY user_id, value_2; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------- - Sort (cost=0.00..0.00 rows=0 width=0) + QUERY PLAN +------------------------------------------------------------------------------------------ + Sort Sort Key: remote_scan.user_id, remote_scan.worker_column_4 - -> HashAggregate (cost=0.00..0.00 rows=0 width=0) + -> HashAggregate Group Key: remote_scan.user_id, remote_scan.worker_column_4 - -> Custom Scan (Citus Real-Time) (cost=0.00..0.00 rows=0 width=0) + -> Custom Scan (Citus Real-Time) Task Count: 4 Tasks Shown: One of 4 -> Task Node: host=localhost port=57637 dbname=regression - -> WindowAgg (cost=2.16..3.40 rows=33 width=48) - -> GroupAggregate (cost=2.16..2.82 rows=33 width=16) + -> WindowAgg + -> GroupAggregate Group Key: users_table.user_id, users_table.value_2 - -> Sort (cost=2.16..2.24 rows=33 width=12) + -> Sort Sort Key: users_table.user_id, users_table.value_2 - -> Seq Scan on users_table_1400256 users_table (cost=0.00..1.33 rows=33 width=12) + -> Seq Scan on users_table_1400256 users_table (15 rows) SELECT @@ -719,7 +719,7 @@ ORDER BY user_id, avg(value_1) DESC; 6 | 1.00000000000000000000 | 5 (32 rows) -EXPLAIN +EXPLAIN (COSTS FALSE) SELECT user_id, avg(value_1), @@ -730,21 +730,21 @@ GROUP BY user_id, value_2 ORDER BY user_id, avg(value_1) DESC; QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Sort (cost=0.00..0.00 rows=0 width=0) + Sort Sort Key: remote_scan.user_id, (pg_catalog.sum(((pg_catalog.sum(remote_scan.avg) / pg_catalog.sum(remote_scan.avg_1)))) / pg_catalog.sum(remote_scan.rank)) DESC - -> HashAggregate (cost=0.00..0.00 rows=0 width=0) + -> HashAggregate Group Key: remote_scan.user_id, remote_scan.worker_column_5 - -> Custom Scan (Citus Real-Time) (cost=0.00..0.00 rows=0 width=0) + -> Custom Scan (Citus Real-Time) Task Count: 4 Tasks Shown: One of 4 -> Task Node: host=localhost port=57637 dbname=regression - -> WindowAgg (cost=3.32..4.14 rows=33 width=80) - -> Sort (cost=3.32..3.40 rows=33 width=56) + -> WindowAgg + -> Sort Sort Key: users_table.user_id, (('1'::numeric / ('1'::numeric + avg(users_table.value_1)))) - -> HashAggregate (cost=1.91..2.49 rows=33 width=56) + -> HashAggregate Group Key: users_table.user_id, users_table.value_2 - -> Seq Scan on users_table_1400256 users_table (cost=0.00..1.33 rows=33 width=12) + -> Seq Scan on users_table_1400256 users_table (15 rows) -- order by in the window function is same as avg(value_1) DESC @@ -793,7 +793,7 @@ ORDER BY user_id, avg(value_1) DESC; (32 rows) -- limit is not pushed down to worker !! -EXPLAIN +EXPLAIN (COSTS FALSE) SELECT user_id, avg(value_1), @@ -805,25 +805,25 @@ ORDER BY user_id, avg(value_1) DESC LIMIT 5; QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Limit (cost=0.00..0.00 rows=0 width=0) - -> Sort (cost=0.00..0.00 rows=0 width=0) + Limit + -> Sort Sort Key: remote_scan.user_id, (pg_catalog.sum(((pg_catalog.sum(remote_scan.avg) / pg_catalog.sum(remote_scan.avg_1)))) / pg_catalog.sum(remote_scan.rank)) DESC - -> HashAggregate (cost=0.00..0.00 rows=0 width=0) + -> HashAggregate Group Key: remote_scan.user_id, remote_scan.worker_column_5 - -> Custom Scan (Citus Real-Time) (cost=0.00..0.00 rows=0 width=0) + -> Custom Scan (Citus Real-Time) Task Count: 4 Tasks Shown: One of 4 -> Task Node: host=localhost port=57637 dbname=regression - -> WindowAgg (cost=3.32..4.14 rows=33 width=80) - -> Sort (cost=3.32..3.40 rows=33 width=56) + -> WindowAgg + -> Sort Sort Key: users_table.user_id, (('1'::numeric / ('1'::numeric + avg(users_table.value_1)))) - -> HashAggregate (cost=1.91..2.49 rows=33 width=56) + -> HashAggregate Group Key: users_table.user_id, users_table.value_2 - -> Seq Scan on users_table_1400256 users_table (cost=0.00..1.33 rows=33 width=12) + -> Seq Scan on users_table_1400256 users_table (16 rows) -EXPLAIN +EXPLAIN (COSTS FALSE) SELECT user_id, avg(value_1), @@ -835,25 +835,25 @@ ORDER BY user_id, avg(value_1) DESC LIMIT 5; QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Limit (cost=0.00..0.00 rows=0 width=0) - -> Sort (cost=0.00..0.00 rows=0 width=0) + Limit + -> Sort Sort Key: remote_scan.user_id, (pg_catalog.sum(((pg_catalog.sum(remote_scan.avg) / pg_catalog.sum(remote_scan.avg_1)))) / pg_catalog.sum(remote_scan.rank)) DESC - -> HashAggregate (cost=0.00..0.00 rows=0 width=0) + -> HashAggregate Group Key: remote_scan.user_id, remote_scan.worker_column_5 - -> Custom Scan (Citus Real-Time) (cost=0.00..0.00 rows=0 width=0) + -> Custom Scan (Citus Real-Time) Task Count: 4 Tasks Shown: One of 4 -> Task Node: host=localhost port=57637 dbname=regression - -> WindowAgg (cost=3.32..4.14 rows=33 width=80) - -> Sort (cost=3.32..3.40 rows=33 width=56) + -> WindowAgg + -> Sort Sort Key: users_table.user_id, (('1'::numeric / ('1'::numeric + avg(users_table.value_1)))) - -> HashAggregate (cost=1.91..2.49 rows=33 width=56) + -> HashAggregate Group Key: users_table.user_id, users_table.value_2 - -> Seq Scan on users_table_1400256 users_table (cost=0.00..1.33 rows=33 width=12) + -> Seq Scan on users_table_1400256 users_table (16 rows) -EXPLAIN +EXPLAIN (COSTS FALSE) SELECT user_id, avg(value_1), @@ -865,25 +865,25 @@ ORDER BY user_id, avg(value_1) DESC LIMIT 5; QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Limit (cost=0.00..0.00 rows=0 width=0) - -> Sort (cost=0.00..0.00 rows=0 width=0) + Limit + -> Sort Sort Key: remote_scan.user_id, (pg_catalog.sum(((pg_catalog.sum(remote_scan.avg) / pg_catalog.sum(remote_scan.avg_1)))) / pg_catalog.sum(remote_scan.rank)) DESC - -> HashAggregate (cost=0.00..0.00 rows=0 width=0) + -> HashAggregate Group Key: remote_scan.user_id, remote_scan.worker_column_5 - -> Custom Scan (Citus Real-Time) (cost=0.00..0.00 rows=0 width=0) + -> Custom Scan (Citus Real-Time) Task Count: 4 Tasks Shown: One of 4 -> Task Node: host=localhost port=57637 dbname=regression - -> WindowAgg (cost=3.15..3.98 rows=33 width=48) - -> Sort (cost=3.15..3.23 rows=33 width=40) + -> WindowAgg + -> Sort Sort Key: users_table.user_id, ((1 / (1 + sum(users_table.value_2)))) - -> HashAggregate (cost=1.83..2.32 rows=33 width=40) + -> HashAggregate Group Key: users_table.user_id, users_table.value_2 - -> Seq Scan on users_table_1400256 users_table (cost=0.00..1.33 rows=33 width=12) + -> Seq Scan on users_table_1400256 users_table (16 rows) -EXPLAIN +EXPLAIN (COSTS FALSE) SELECT user_id, avg(value_1), @@ -895,21 +895,21 @@ ORDER BY user_id, avg(value_1) DESC LIMIT 5; QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Limit (cost=0.00..0.00 rows=0 width=0) - -> Sort (cost=0.00..0.00 rows=0 width=0) + Limit + -> Sort Sort Key: remote_scan.user_id, (pg_catalog.sum(((pg_catalog.sum(remote_scan.avg) / pg_catalog.sum(remote_scan.avg_1)))) / pg_catalog.sum(remote_scan.rank)) DESC - -> HashAggregate (cost=0.00..0.00 rows=0 width=0) + -> HashAggregate Group Key: remote_scan.user_id, remote_scan.worker_column_5 - -> Custom Scan (Citus Real-Time) (cost=0.00..0.00 rows=0 width=0) + -> Custom Scan (Citus Real-Time) Task Count: 4 Tasks Shown: One of 4 -> Task Node: host=localhost port=57637 dbname=regression - -> WindowAgg (cost=2.90..3.56 rows=33 width=40) - -> Sort (cost=2.90..2.99 rows=33 width=32) + -> WindowAgg + -> Sort Sort Key: users_table.user_id, (sum(users_table.value_2)) - -> HashAggregate (cost=1.74..2.07 rows=33 width=32) + -> HashAggregate Group Key: users_table.user_id, users_table.value_2 - -> Seq Scan on users_table_1400256 users_table (cost=0.00..1.33 rows=33 width=12) + -> Seq Scan on users_table_1400256 users_table (16 rows) diff --git a/src/test/regress/sql/window_functions.sql b/src/test/regress/sql/window_functions.sql index 9fe3ee7ba..fb1f22318 100644 --- a/src/test/regress/sql/window_functions.sql +++ b/src/test/regress/sql/window_functions.sql @@ -288,7 +288,7 @@ GROUP BY ORDER BY 3 DESC, 2 DESC, 1 DESC; -EXPLAIN +EXPLAIN (COSTS FALSE) SELECT user_id, AVG(avg(value_1)) OVER (PARTITION BY user_id, max(user_id), MIN(value_2)), @@ -311,7 +311,7 @@ GROUP BY ORDER BY user_id, value_2; -EXPLAIN +EXPLAIN (COSTS FALSE) SELECT user_id, 1 + sum(value_1), @@ -355,7 +355,7 @@ FROM GROUP BY user_id, value_2 ORDER BY user_id, avg(value_1) DESC; -EXPLAIN +EXPLAIN (COSTS FALSE) SELECT user_id, avg(value_1), @@ -376,7 +376,7 @@ GROUP BY user_id, value_2 ORDER BY user_id, avg(value_1) DESC; -- limit is not pushed down to worker !! -EXPLAIN +EXPLAIN (COSTS FALSE) SELECT user_id, avg(value_1), @@ -387,7 +387,7 @@ GROUP BY user_id, value_2 ORDER BY user_id, avg(value_1) DESC LIMIT 5; -EXPLAIN +EXPLAIN (COSTS FALSE) SELECT user_id, avg(value_1), @@ -398,7 +398,7 @@ GROUP BY user_id, value_2 ORDER BY user_id, avg(value_1) DESC LIMIT 5; -EXPLAIN +EXPLAIN (COSTS FALSE) SELECT user_id, avg(value_1), @@ -409,7 +409,7 @@ GROUP BY user_id, value_2 ORDER BY user_id, avg(value_1) DESC LIMIT 5; -EXPLAIN +EXPLAIN (COSTS FALSE) SELECT user_id, avg(value_1),