mirror of https://github.com/citusdata/citus.git
Merge pull request #2793 from citusdata/coordinator_plan
Show just coordinator plan in some test outputs.pull/2797/head
commit
c7745486b9
|
@ -1204,58 +1204,38 @@ SELECT DISTINCT ON (o_custkey) o_custkey, l_orderkey
|
||||||
14 | 11011
|
14 | 11011
|
||||||
(10 rows)
|
(10 rows)
|
||||||
|
|
||||||
|
SELECT coordinator_plan($Q$
|
||||||
EXPLAIN (COSTS FALSE)
|
EXPLAIN (COSTS FALSE)
|
||||||
SELECT DISTINCT ON (o_custkey) o_custkey, l_orderkey
|
SELECT DISTINCT ON (o_custkey) o_custkey, l_orderkey
|
||||||
FROM lineitem_hash_part JOIN orders_hash_part ON (l_orderkey = o_orderkey)
|
FROM lineitem_hash_part JOIN orders_hash_part ON (l_orderkey = o_orderkey)
|
||||||
WHERE o_custkey < 15
|
WHERE o_custkey < 15
|
||||||
ORDER BY 1,2;
|
ORDER BY 1,2;
|
||||||
QUERY PLAN
|
$Q$);
|
||||||
----------------------------------------------------------------------------------------------------------------
|
coordinator_plan
|
||||||
|
-----------------------------------------------------------------
|
||||||
Unique
|
Unique
|
||||||
-> Sort
|
-> Sort
|
||||||
Sort Key: remote_scan.o_custkey, remote_scan.l_orderkey
|
Sort Key: remote_scan.o_custkey, remote_scan.l_orderkey
|
||||||
-> Custom Scan (Citus Real-Time)
|
-> Custom Scan (Citus Real-Time)
|
||||||
Task Count: 4
|
Task Count: 4
|
||||||
Tasks Shown: One of 4
|
(5 rows)
|
||||||
-> Task
|
|
||||||
Node: host=localhost port=57637 dbname=regression
|
|
||||||
-> Unique
|
|
||||||
-> Sort
|
|
||||||
Sort Key: orders_hash_part.o_custkey, lineitem_hash_part.l_orderkey
|
|
||||||
-> Hash Join
|
|
||||||
Hash Cond: (lineitem_hash_part.l_orderkey = orders_hash_part.o_orderkey)
|
|
||||||
-> Seq Scan on lineitem_hash_part_360041 lineitem_hash_part
|
|
||||||
-> Hash
|
|
||||||
-> Seq Scan on orders_hash_part_360045 orders_hash_part
|
|
||||||
Filter: (o_custkey < 15)
|
|
||||||
(17 rows)
|
|
||||||
|
|
||||||
-- explain without order by
|
-- explain without order by
|
||||||
-- notice master plan has order by on distinct on column
|
-- notice master plan has order by on distinct on column
|
||||||
|
SELECT coordinator_plan($Q$
|
||||||
EXPLAIN (COSTS FALSE)
|
EXPLAIN (COSTS FALSE)
|
||||||
SELECT DISTINCT ON (o_custkey) o_custkey, l_orderkey
|
SELECT DISTINCT ON (o_custkey) o_custkey, l_orderkey
|
||||||
FROM lineitem_hash_part JOIN orders_hash_part ON (l_orderkey = o_orderkey)
|
FROM lineitem_hash_part JOIN orders_hash_part ON (l_orderkey = o_orderkey)
|
||||||
WHERE o_custkey < 15;
|
WHERE o_custkey < 15;
|
||||||
QUERY PLAN
|
$Q$);
|
||||||
----------------------------------------------------------------------------------------------------------------
|
coordinator_plan
|
||||||
|
-------------------------------------------
|
||||||
Unique
|
Unique
|
||||||
-> Sort
|
-> Sort
|
||||||
Sort Key: remote_scan.o_custkey
|
Sort Key: remote_scan.o_custkey
|
||||||
-> Custom Scan (Citus Real-Time)
|
-> Custom Scan (Citus Real-Time)
|
||||||
Task Count: 4
|
Task Count: 4
|
||||||
Tasks Shown: One of 4
|
(5 rows)
|
||||||
-> Task
|
|
||||||
Node: host=localhost port=57637 dbname=regression
|
|
||||||
-> Unique
|
|
||||||
-> Sort
|
|
||||||
Sort Key: orders_hash_part.o_custkey
|
|
||||||
-> Hash Join
|
|
||||||
Hash Cond: (lineitem_hash_part.l_orderkey = orders_hash_part.o_orderkey)
|
|
||||||
-> Seq Scan on lineitem_hash_part_360041 lineitem_hash_part
|
|
||||||
-> Hash
|
|
||||||
-> Seq Scan on orders_hash_part_360045 orders_hash_part
|
|
||||||
Filter: (o_custkey < 15)
|
|
||||||
(17 rows)
|
|
||||||
|
|
||||||
-- each customer's each order's first l_partkey
|
-- each customer's each order's first l_partkey
|
||||||
SELECT DISTINCT ON (o_custkey, l_orderkey) o_custkey, l_orderkey, l_linenumber, l_partkey
|
SELECT DISTINCT ON (o_custkey, l_orderkey) o_custkey, l_orderkey, l_linenumber, l_partkey
|
||||||
|
@ -1303,30 +1283,20 @@ SELECT DISTINCT ON (o_custkey, l_orderkey) o_custkey, l_orderkey, l_linenumber,
|
||||||
(36 rows)
|
(36 rows)
|
||||||
|
|
||||||
-- explain without order by
|
-- explain without order by
|
||||||
|
SELECT coordinator_plan($Q$
|
||||||
EXPLAIN (COSTS FALSE)
|
EXPLAIN (COSTS FALSE)
|
||||||
SELECT DISTINCT ON (o_custkey, l_orderkey) o_custkey, l_orderkey, l_linenumber, l_partkey
|
SELECT DISTINCT ON (o_custkey, l_orderkey) o_custkey, l_orderkey, l_linenumber, l_partkey
|
||||||
FROM lineitem_hash_part JOIN orders_hash_part ON (l_orderkey = o_orderkey)
|
FROM lineitem_hash_part JOIN orders_hash_part ON (l_orderkey = o_orderkey)
|
||||||
WHERE o_custkey < 20;
|
WHERE o_custkey < 20;
|
||||||
QUERY PLAN
|
$Q$);
|
||||||
----------------------------------------------------------------------------------------------------------------
|
coordinator_plan
|
||||||
|
-----------------------------------------------------------------
|
||||||
Unique
|
Unique
|
||||||
-> Sort
|
-> Sort
|
||||||
Sort Key: remote_scan.o_custkey, remote_scan.l_orderkey
|
Sort Key: remote_scan.o_custkey, remote_scan.l_orderkey
|
||||||
-> Custom Scan (Citus Real-Time)
|
-> Custom Scan (Citus Real-Time)
|
||||||
Task Count: 4
|
Task Count: 4
|
||||||
Tasks Shown: One of 4
|
(5 rows)
|
||||||
-> Task
|
|
||||||
Node: host=localhost port=57637 dbname=regression
|
|
||||||
-> Unique
|
|
||||||
-> Sort
|
|
||||||
Sort Key: orders_hash_part.o_custkey, lineitem_hash_part.l_orderkey
|
|
||||||
-> Hash Join
|
|
||||||
Hash Cond: (lineitem_hash_part.l_orderkey = orders_hash_part.o_orderkey)
|
|
||||||
-> Seq Scan on lineitem_hash_part_360041 lineitem_hash_part
|
|
||||||
-> Hash
|
|
||||||
-> Seq Scan on orders_hash_part_360045 orders_hash_part
|
|
||||||
Filter: (o_custkey < 20)
|
|
||||||
(17 rows)
|
|
||||||
|
|
||||||
-- each customer's each order's last l_partkey
|
-- each customer's each order's last l_partkey
|
||||||
SELECT DISTINCT ON (o_custkey, l_orderkey) o_custkey, l_orderkey, l_linenumber, l_partkey
|
SELECT DISTINCT ON (o_custkey, l_orderkey) o_custkey, l_orderkey, l_linenumber, l_partkey
|
||||||
|
|
|
@ -120,3 +120,16 @@ BEGIN
|
||||||
END IF;
|
END IF;
|
||||||
END;
|
END;
|
||||||
$$LANGUAGE plpgsql;
|
$$LANGUAGE plpgsql;
|
||||||
|
-- Create a function to ignore worker plans in explain output
|
||||||
|
CREATE OR REPLACE FUNCTION coordinator_plan(explain_commmand text, out query_plan text)
|
||||||
|
RETURNS SETOF TEXT AS $$
|
||||||
|
BEGIN
|
||||||
|
FOR query_plan IN execute explain_commmand LOOP
|
||||||
|
RETURN next;
|
||||||
|
IF query_plan LIKE '%Task Count:%'
|
||||||
|
THEN
|
||||||
|
RETURN;
|
||||||
|
END IF;
|
||||||
|
END LOOP;
|
||||||
|
RETURN;
|
||||||
|
END; $$ language plpgsql;
|
||||||
|
|
|
@ -411,18 +411,22 @@ SELECT DISTINCT ON (o_custkey) o_custkey, l_orderkey
|
||||||
WHERE o_custkey < 15
|
WHERE o_custkey < 15
|
||||||
ORDER BY 1,2;
|
ORDER BY 1,2;
|
||||||
|
|
||||||
|
SELECT coordinator_plan($Q$
|
||||||
EXPLAIN (COSTS FALSE)
|
EXPLAIN (COSTS FALSE)
|
||||||
SELECT DISTINCT ON (o_custkey) o_custkey, l_orderkey
|
SELECT DISTINCT ON (o_custkey) o_custkey, l_orderkey
|
||||||
FROM lineitem_hash_part JOIN orders_hash_part ON (l_orderkey = o_orderkey)
|
FROM lineitem_hash_part JOIN orders_hash_part ON (l_orderkey = o_orderkey)
|
||||||
WHERE o_custkey < 15
|
WHERE o_custkey < 15
|
||||||
ORDER BY 1,2;
|
ORDER BY 1,2;
|
||||||
|
$Q$);
|
||||||
|
|
||||||
-- explain without order by
|
-- explain without order by
|
||||||
-- notice master plan has order by on distinct on column
|
-- notice master plan has order by on distinct on column
|
||||||
|
SELECT coordinator_plan($Q$
|
||||||
EXPLAIN (COSTS FALSE)
|
EXPLAIN (COSTS FALSE)
|
||||||
SELECT DISTINCT ON (o_custkey) o_custkey, l_orderkey
|
SELECT DISTINCT ON (o_custkey) o_custkey, l_orderkey
|
||||||
FROM lineitem_hash_part JOIN orders_hash_part ON (l_orderkey = o_orderkey)
|
FROM lineitem_hash_part JOIN orders_hash_part ON (l_orderkey = o_orderkey)
|
||||||
WHERE o_custkey < 15;
|
WHERE o_custkey < 15;
|
||||||
|
$Q$);
|
||||||
|
|
||||||
-- each customer's each order's first l_partkey
|
-- each customer's each order's first l_partkey
|
||||||
SELECT DISTINCT ON (o_custkey, l_orderkey) o_custkey, l_orderkey, l_linenumber, l_partkey
|
SELECT DISTINCT ON (o_custkey, l_orderkey) o_custkey, l_orderkey, l_linenumber, l_partkey
|
||||||
|
@ -431,10 +435,12 @@ SELECT DISTINCT ON (o_custkey, l_orderkey) o_custkey, l_orderkey, l_linenumber,
|
||||||
ORDER BY 1,2,3;
|
ORDER BY 1,2,3;
|
||||||
|
|
||||||
-- explain without order by
|
-- explain without order by
|
||||||
|
SELECT coordinator_plan($Q$
|
||||||
EXPLAIN (COSTS FALSE)
|
EXPLAIN (COSTS FALSE)
|
||||||
SELECT DISTINCT ON (o_custkey, l_orderkey) o_custkey, l_orderkey, l_linenumber, l_partkey
|
SELECT DISTINCT ON (o_custkey, l_orderkey) o_custkey, l_orderkey, l_linenumber, l_partkey
|
||||||
FROM lineitem_hash_part JOIN orders_hash_part ON (l_orderkey = o_orderkey)
|
FROM lineitem_hash_part JOIN orders_hash_part ON (l_orderkey = o_orderkey)
|
||||||
WHERE o_custkey < 20;
|
WHERE o_custkey < 20;
|
||||||
|
$Q$);
|
||||||
|
|
||||||
-- each customer's each order's last l_partkey
|
-- each customer's each order's last l_partkey
|
||||||
SELECT DISTINCT ON (o_custkey, l_orderkey) o_custkey, l_orderkey, l_linenumber, l_partkey
|
SELECT DISTINCT ON (o_custkey, l_orderkey) o_custkey, l_orderkey, l_linenumber, l_partkey
|
||||||
|
|
|
@ -118,3 +118,17 @@ BEGIN
|
||||||
END IF;
|
END IF;
|
||||||
END;
|
END;
|
||||||
$$LANGUAGE plpgsql;
|
$$LANGUAGE plpgsql;
|
||||||
|
|
||||||
|
-- Create a function to ignore worker plans in explain output
|
||||||
|
CREATE OR REPLACE FUNCTION coordinator_plan(explain_commmand text, out query_plan text)
|
||||||
|
RETURNS SETOF TEXT AS $$
|
||||||
|
BEGIN
|
||||||
|
FOR query_plan IN execute explain_commmand LOOP
|
||||||
|
RETURN next;
|
||||||
|
IF query_plan LIKE '%Task Count:%'
|
||||||
|
THEN
|
||||||
|
RETURN;
|
||||||
|
END IF;
|
||||||
|
END LOOP;
|
||||||
|
RETURN;
|
||||||
|
END; $$ language plpgsql;
|
||||||
|
|
Loading…
Reference in New Issue