Add alternative output for window_functions

pull/5209/head
Sait Talha Nisanci 2021-08-19 13:11:02 +03:00
parent df9b7149c3
commit 256e7d1540
3 changed files with 46 additions and 27 deletions

View File

@ -1209,7 +1209,6 @@ ON CONFLICT(c1, c2, c3, c4, c5, c6)
DO UPDATE SET DO UPDATE SET
cardinality = enriched.cardinality + excluded.cardinality, cardinality = enriched.cardinality + excluded.cardinality,
sum = enriched.sum + excluded.sum; sum = enriched.sum + excluded.sum;
DEBUG: rehashing catalog cache id 14 for pg_opclass; 17 tups, 8 buckets at character 224
DEBUG: INSERT target table and the source relation of the SELECT partition column value must be colocated in distributed INSERT ... SELECT DEBUG: INSERT target table and the source relation of the SELECT partition column value must be colocated in distributed INSERT ... SELECT
DEBUG: Router planner cannot handle multi-shard select queries DEBUG: Router planner cannot handle multi-shard select queries
DEBUG: performing repartitioned INSERT ... SELECT DEBUG: performing repartitioned INSERT ... SELECT

View File

@ -1386,12 +1386,16 @@ LIMIT 5;
Sort Key: users_table.user_id, (avg(users_table.value_1)) DESC Sort Key: users_table.user_id, (avg(users_table.value_1)) DESC
Presorted Key: users_table.user_id Presorted Key: users_table.user_id
-> WindowAgg -> WindowAgg
-> Sort -> Incremental Sort
Sort Key: users_table.user_id, (('1'::numeric / ('1'::numeric + avg(users_table.value_1)))) Sort Key: users_table.user_id, (('1'::numeric / ('1'::numeric + avg(users_table.value_1))))
-> HashAggregate Presorted Key: users_table.user_id
-> GroupAggregate
Group Key: users_table.user_id, users_table.value_2 Group Key: users_table.user_id, users_table.value_2
-> Seq Scan on users_table_1400256 users_table -> Incremental Sort
(18 rows) Sort Key: users_table.user_id, users_table.value_2
Presorted Key: users_table.user_id
-> Index Scan using is_index1_1400256 on users_table_1400256 users_table
(22 rows)
EXPLAIN (COSTS FALSE) EXPLAIN (COSTS FALSE)
SELECT SELECT
@ -1418,12 +1422,16 @@ LIMIT 5;
Sort Key: users_table.user_id, (avg(users_table.value_1)) DESC Sort Key: users_table.user_id, (avg(users_table.value_1)) DESC
Presorted Key: users_table.user_id Presorted Key: users_table.user_id
-> WindowAgg -> WindowAgg
-> Sort -> Incremental Sort
Sort Key: users_table.user_id, (('1'::numeric / ('1'::numeric + avg(users_table.value_1)))) Sort Key: users_table.user_id, (('1'::numeric / ('1'::numeric + avg(users_table.value_1))))
-> HashAggregate Presorted Key: users_table.user_id
-> GroupAggregate
Group Key: users_table.user_id, users_table.value_2 Group Key: users_table.user_id, users_table.value_2
-> Seq Scan on users_table_1400256 users_table -> Incremental Sort
(18 rows) Sort Key: users_table.user_id, users_table.value_2
Presorted Key: users_table.user_id
-> Index Scan using is_index1_1400256 on users_table_1400256 users_table
(22 rows)
EXPLAIN (COSTS FALSE) EXPLAIN (COSTS FALSE)
SELECT SELECT
@ -1435,7 +1443,7 @@ FROM
GROUP BY user_id, value_2 GROUP BY user_id, value_2
ORDER BY user_id, avg(value_1) DESC ORDER BY user_id, avg(value_1) DESC
LIMIT 5; LIMIT 5;
QUERY PLAN QUERY PLAN
--------------------------------------------------------------------- ---------------------------------------------------------------------
Limit Limit
-> Sort -> Sort
@ -1450,12 +1458,16 @@ LIMIT 5;
Sort Key: users_table.user_id, (avg(users_table.value_1)) DESC Sort Key: users_table.user_id, (avg(users_table.value_1)) DESC
Presorted Key: users_table.user_id Presorted Key: users_table.user_id
-> WindowAgg -> WindowAgg
-> Sort -> Incremental Sort
Sort Key: users_table.user_id, ((1 / (1 + sum(users_table.value_2)))) Sort Key: users_table.user_id, ((1 / (1 + sum(users_table.value_2))))
-> HashAggregate Presorted Key: users_table.user_id
-> GroupAggregate
Group Key: users_table.user_id, users_table.value_2 Group Key: users_table.user_id, users_table.value_2
-> Seq Scan on users_table_1400256 users_table -> Incremental Sort
(18 rows) Sort Key: users_table.user_id, users_table.value_2
Presorted Key: users_table.user_id
-> Index Scan using is_index1_1400256 on users_table_1400256 users_table
(22 rows)
EXPLAIN (COSTS FALSE) EXPLAIN (COSTS FALSE)
SELECT SELECT
@ -1467,7 +1479,7 @@ FROM
GROUP BY user_id, value_2 GROUP BY user_id, value_2
ORDER BY user_id, avg(value_1) DESC ORDER BY user_id, avg(value_1) DESC
LIMIT 5; LIMIT 5;
QUERY PLAN QUERY PLAN
--------------------------------------------------------------------- ---------------------------------------------------------------------
Limit Limit
-> Sort -> Sort
@ -1482,12 +1494,16 @@ LIMIT 5;
Sort Key: users_table.user_id, (avg(users_table.value_1)) DESC Sort Key: users_table.user_id, (avg(users_table.value_1)) DESC
Presorted Key: users_table.user_id Presorted Key: users_table.user_id
-> WindowAgg -> WindowAgg
-> Sort -> Incremental Sort
Sort Key: users_table.user_id, (sum(users_table.value_2)) Sort Key: users_table.user_id, (sum(users_table.value_2))
-> HashAggregate Presorted Key: users_table.user_id
-> GroupAggregate
Group Key: users_table.user_id, users_table.value_2 Group Key: users_table.user_id, users_table.value_2
-> Seq Scan on users_table_1400256 users_table -> Incremental Sort
(18 rows) Sort Key: users_table.user_id, users_table.value_2
Presorted Key: users_table.user_id
-> Index Scan using is_index1_1400256 on users_table_1400256 users_table
(22 rows)
-- Grouping can be pushed down with aggregates even when window function can't -- Grouping can be pushed down with aggregates even when window function can't
EXPLAIN (COSTS FALSE) EXPLAIN (COSTS FALSE)

View File

@ -1382,15 +1382,16 @@ LIMIT 5;
-> Task -> Task
Node: host=localhost port=xxxxx dbname=regression Node: host=localhost port=xxxxx dbname=regression
-> Limit -> Limit
-> Sort -> Incremental Sort
Sort Key: users_table.user_id, (avg(users_table.value_1)) DESC Sort Key: users_table.user_id, (avg(users_table.value_1)) DESC
Presorted Key: users_table.user_id
-> WindowAgg -> WindowAgg
-> Sort -> Sort
Sort Key: users_table.user_id, (('1'::numeric / ('1'::numeric + avg(users_table.value_1)))) Sort Key: users_table.user_id, (('1'::numeric / ('1'::numeric + avg(users_table.value_1))))
-> HashAggregate -> HashAggregate
Group Key: users_table.user_id, users_table.value_2 Group Key: users_table.user_id, users_table.value_2
-> Seq Scan on users_table_1400256 users_table -> Seq Scan on users_table_1400256 users_table
(17 rows) (18 rows)
EXPLAIN (COSTS FALSE) EXPLAIN (COSTS FALSE)
SELECT SELECT
@ -1413,15 +1414,16 @@ LIMIT 5;
-> Task -> Task
Node: host=localhost port=xxxxx dbname=regression Node: host=localhost port=xxxxx dbname=regression
-> Limit -> Limit
-> Sort -> Incremental Sort
Sort Key: users_table.user_id, (avg(users_table.value_1)) DESC Sort Key: users_table.user_id, (avg(users_table.value_1)) DESC
Presorted Key: users_table.user_id
-> WindowAgg -> WindowAgg
-> Sort -> Sort
Sort Key: users_table.user_id, (('1'::numeric / ('1'::numeric + avg(users_table.value_1)))) Sort Key: users_table.user_id, (('1'::numeric / ('1'::numeric + avg(users_table.value_1))))
-> HashAggregate -> HashAggregate
Group Key: users_table.user_id, users_table.value_2 Group Key: users_table.user_id, users_table.value_2
-> Seq Scan on users_table_1400256 users_table -> Seq Scan on users_table_1400256 users_table
(17 rows) (18 rows)
EXPLAIN (COSTS FALSE) EXPLAIN (COSTS FALSE)
SELECT SELECT
@ -1444,15 +1446,16 @@ LIMIT 5;
-> Task -> Task
Node: host=localhost port=xxxxx dbname=regression Node: host=localhost port=xxxxx dbname=regression
-> Limit -> Limit
-> Sort -> Incremental Sort
Sort Key: users_table.user_id, (avg(users_table.value_1)) DESC Sort Key: users_table.user_id, (avg(users_table.value_1)) DESC
Presorted Key: users_table.user_id
-> WindowAgg -> WindowAgg
-> Sort -> Sort
Sort Key: users_table.user_id, ((1 / (1 + sum(users_table.value_2)))) Sort Key: users_table.user_id, ((1 / (1 + sum(users_table.value_2))))
-> HashAggregate -> HashAggregate
Group Key: users_table.user_id, users_table.value_2 Group Key: users_table.user_id, users_table.value_2
-> Seq Scan on users_table_1400256 users_table -> Seq Scan on users_table_1400256 users_table
(17 rows) (18 rows)
EXPLAIN (COSTS FALSE) EXPLAIN (COSTS FALSE)
SELECT SELECT
@ -1475,15 +1478,16 @@ LIMIT 5;
-> Task -> Task
Node: host=localhost port=xxxxx dbname=regression Node: host=localhost port=xxxxx dbname=regression
-> Limit -> Limit
-> Sort -> Incremental Sort
Sort Key: users_table.user_id, (avg(users_table.value_1)) DESC Sort Key: users_table.user_id, (avg(users_table.value_1)) DESC
Presorted Key: users_table.user_id
-> WindowAgg -> WindowAgg
-> Sort -> Sort
Sort Key: users_table.user_id, (sum(users_table.value_2)) Sort Key: users_table.user_id, (sum(users_table.value_2))
-> HashAggregate -> HashAggregate
Group Key: users_table.user_id, users_table.value_2 Group Key: users_table.user_id, users_table.value_2
-> Seq Scan on users_table_1400256 users_table -> Seq Scan on users_table_1400256 users_table
(17 rows) (18 rows)
-- Grouping can be pushed down with aggregates even when window function can't -- Grouping can be pushed down with aggregates even when window function can't
EXPLAIN (COSTS FALSE) EXPLAIN (COSTS FALSE)