diff --git a/src/test/regress/expected/multi_mx_create_table.out b/src/test/regress/expected/multi_mx_create_table.out index a815b3ef4..14fd1613b 100644 --- a/src/test/regress/expected/multi_mx_create_table.out +++ b/src/test/regress/expected/multi_mx_create_table.out @@ -295,10 +295,9 @@ CREATE TABLE customer_mx ( c_acctbal decimal(15,2) not null, c_mktsegment char(10) not null, c_comment varchar(117) not null); -SET citus.shard_count TO 1; -SELECT create_distributed_table('customer_mx', 'c_custkey'); - create_distributed_table --------------------------- +SELECT create_reference_table('customer_mx'); + create_reference_table +------------------------ (1 row) @@ -307,9 +306,9 @@ CREATE TABLE nation_mx ( n_name char(25) not null, n_regionkey integer not null, n_comment varchar(152)); -SELECT create_distributed_table('nation_mx', 'n_nationkey'); - create_distributed_table --------------------------- +SELECT create_reference_table('nation_mx'); + create_reference_table +------------------------ (1 row) @@ -323,9 +322,9 @@ CREATE TABLE part_mx ( p_container char(10) not null, p_retailprice decimal(15,2) not null, p_comment varchar(23) not null); -SELECT create_distributed_table('part_mx', 'p_partkey'); - create_distributed_table --------------------------- +SELECT create_reference_table('part_mx'); + create_reference_table +------------------------ (1 row) @@ -339,9 +338,9 @@ CREATE TABLE supplier_mx s_acctbal decimal(15,2) not null, s_comment varchar(101) not null ); -SELECT create_distributed_table('supplier_mx', 's_suppkey'); - create_distributed_table --------------------------- +SELECT create_reference_table('supplier_mx'); + create_reference_table +------------------------ (1 row) @@ -478,10 +477,10 @@ ORDER BY colocationid, logicalrelid; company_employees_mx | 3 | 4 | h | s lineitem_mx | 4 | 16 | h | s orders_mx | 4 | 16 | h | s - customer_mx | 5 | 1 | h | s - nation_mx | 5 | 1 | h | s - part_mx | 5 | 1 | h | s - supplier_mx | 5 | 1 | h | s + customer_mx | 5 | 1 | n | t + nation_mx | 5 | 1 | n | t + part_mx | 5 | 1 | n | t + supplier_mx | 5 | 1 | n | t limit_orders_mx | 6 | 2 | h | s articles_hash_mx | 6 | 2 | h | s multiple_hash_mx | 7 | 2 | h | s diff --git a/src/test/regress/expected/multi_mx_explain.out b/src/test/regress/expected/multi_mx_explain.out index a3b2de9ec..00739dd2a 100644 --- a/src/test/regress/expected/multi_mx_explain.out +++ b/src/test/regress/expected/multi_mx_explain.out @@ -354,6 +354,9 @@ Custom Scan (Citus Router) Filter: (l_partkey = 0) -- make the outputs more consistent VACUUM ANALYZE lineitem_mx; +VACUUM ANALYZE orders_mx; +VACUUM ANALYZE customer_mx; +VACUUM ANALYZE supplier_mx; -- Test single-shard SELECT EXPLAIN (COSTS FALSE) SELECT l_quantity FROM lineitem_mx WHERE l_orderkey = 5; @@ -498,20 +501,24 @@ EXPLAIN (COSTS FALSE) AND l_suppkey = s_suppkey; Aggregate -> Custom Scan (Citus Task-Tracker) - Task Count: 4 - Tasks Shown: None, not supported for re-partition queries - -> MapMergeJob - Map Task Count: 4 - Merge Task Count: 4 - -> MapMergeJob - Map Task Count: 16 - Merge Task Count: 4 - -> MapMergeJob - Map Task Count: 1 - Merge Task Count: 4 - -> MapMergeJob - Map Task Count: 1 - Merge Task Count: 4 + Task Count: 16 + Tasks Shown: One of 16 + -> Task + Node: host=localhost port=57637 dbname=regression + -> Aggregate + -> Hash Join + Hash Cond: (lineitem_mx.l_orderkey = orders_mx.o_orderkey) + -> Hash Join + Hash Cond: (supplier_mx.s_suppkey = lineitem_mx.l_suppkey) + -> Seq Scan on supplier_mx_1220087 supplier_mx + -> Hash + -> Seq Scan on lineitem_mx_1220052 lineitem_mx + -> Hash + -> Hash Join + Hash Cond: (customer_mx.c_custkey = orders_mx.o_custkey) + -> Seq Scan on customer_mx_1220084 customer_mx + -> Hash + -> Seq Scan on orders_mx_1220068 orders_mx EXPLAIN (COSTS FALSE, FORMAT JSON) SELECT count(*) FROM lineitem_mx, orders_mx, customer_mx, supplier_mx @@ -533,26 +540,105 @@ EXPLAIN (COSTS FALSE, FORMAT JSON) "Parallel Aware": false, "Distributed Query": { "Job": { - "Task Count": 4, - "Tasks Shown": "None, not supported for re-partition queries", - "Depended Jobs": [ + "Task Count": 16, + "Tasks Shown": "One of 16", + "Tasks": [ { - "Map Task Count": 4, - "Merge Task Count": 4, - "Depended Jobs": [ - { - "Map Task Count": 16, - "Merge Task Count": 4 - }, - { - "Map Task Count": 1, - "Merge Task Count": 4 - } + "Node": "host=localhost port=57637 dbname=regression", + "Remote Plan": [ + [ + { + "Plan": { + "Node Type": "Aggregate", + "Strategy": "Plain", + "Partial Mode": "Simple", + "Parallel Aware": false, + "Plans": [ + { + "Node Type": "Hash Join", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Join Type": "Inner", + "Inner Unique": false, + "Hash Cond": "(lineitem_mx.l_orderkey = orders_mx.o_orderkey)", + "Plans": [ + { + "Node Type": "Hash Join", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Join Type": "Inner", + "Inner Unique": false, + "Hash Cond": "(supplier_mx.s_suppkey = lineitem_mx.l_suppkey)", + "Plans": [ + { + "Node Type": "Seq Scan", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Relation Name": "supplier_mx_1220087", + "Alias": "supplier_mx" + }, + { + "Node Type": "Hash", + "Parent Relationship": "Inner", + "Parallel Aware": false, + "Plans": [ + { + "Node Type": "Seq Scan", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Relation Name": "lineitem_mx_1220052", + "Alias": "lineitem_mx" + } + ] + } + ] + }, + { + "Node Type": "Hash", + "Parent Relationship": "Inner", + "Parallel Aware": false, + "Plans": [ + { + "Node Type": "Hash Join", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Join Type": "Inner", + "Inner Unique": false, + "Hash Cond": "(customer_mx.c_custkey = orders_mx.o_custkey)", + "Plans": [ + { + "Node Type": "Seq Scan", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Relation Name": "customer_mx_1220084", + "Alias": "customer_mx" + }, + { + "Node Type": "Hash", + "Parent Relationship": "Inner", + "Parallel Aware": false, + "Plans": [ + { + "Node Type": "Seq Scan", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Relation Name": "orders_mx_1220068", + "Alias": "orders_mx" + } + ] + } + ] + } + ] + } + ] + } + ] + } + } + ] + ] - }, - { - "Map Task Count": 1, - "Merge Task Count": 4 } ] } @@ -590,28 +676,106 @@ EXPLAIN (COSTS FALSE, FORMAT XML) false - 4 - None, not supported for re-partition queries - - - 4 - 4 - - - 16 - 4 - - - 1 - 4 - - - - - 1 - 4 - - + 16 + One of 16 + + + host=localhost port=57637 dbname=regression + + + + + Aggregate + Plain + Simple + false + + + Hash Join + Outer + false + Inner + false + (lineitem_mx.l_orderkey = orders_mx.o_orderkey) + + + Hash Join + Outer + false + Inner + false + (supplier_mx.s_suppkey = lineitem_mx.l_suppkey) + + + Seq Scan + Outer + false + supplier_mx_1220087 + supplier_mx + + + Hash + Inner + false + + + Seq Scan + Outer + false + lineitem_mx_1220052 + lineitem_mx + + + + + + + Hash + Inner + false + + + Hash Join + Outer + false + Inner + false + (customer_mx.c_custkey = orders_mx.o_custkey) + + + Seq Scan + Outer + false + customer_mx_1220084 + customer_mx + + + Hash + Inner + false + + + Seq Scan + Outer + false + orders_mx_1220068 + orders_mx + + + + + + + + + + + + + + + + @@ -644,15 +808,68 @@ EXPLAIN (COSTS FALSE, FORMAT YAML) Parallel Aware: false Distributed Query: Job: - Task Count: 4 - Tasks Shown: "None, not supported for re-partition queries" - Depended Jobs: - - Map Task Count: 4 - Merge Task Count: 4 - Depended Jobs: - - Map Task Count: 16 - Merge Task Count: 4 - - Map Task Count: 1 - Merge Task Count: 4 - - Map Task Count: 1 - Merge Task Count: 4 + Task Count: 16 + Tasks Shown: "One of 16" + Tasks: + - Node: "host=localhost port=57637 dbname=regression" + Remote Plan: + - Plan: + Node Type: "Aggregate" + Strategy: "Plain" + Partial Mode: "Simple" + Parallel Aware: false + Plans: + - Node Type: "Hash Join" + Parent Relationship: "Outer" + Parallel Aware: false + Join Type: "Inner" + Inner Unique: false + Hash Cond: "(lineitem_mx.l_orderkey = orders_mx.o_orderkey)" + Plans: + - Node Type: "Hash Join" + Parent Relationship: "Outer" + Parallel Aware: false + Join Type: "Inner" + Inner Unique: false + Hash Cond: "(supplier_mx.s_suppkey = lineitem_mx.l_suppkey)" + Plans: + - Node Type: "Seq Scan" + Parent Relationship: "Outer" + Parallel Aware: false + Relation Name: "supplier_mx_1220087" + Alias: "supplier_mx" + - Node Type: "Hash" + Parent Relationship: "Inner" + Parallel Aware: false + Plans: + - Node Type: "Seq Scan" + Parent Relationship: "Outer" + Parallel Aware: false + Relation Name: "lineitem_mx_1220052" + Alias: "lineitem_mx" + - Node Type: "Hash" + Parent Relationship: "Inner" + Parallel Aware: false + Plans: + - Node Type: "Hash Join" + Parent Relationship: "Outer" + Parallel Aware: false + Join Type: "Inner" + Inner Unique: false + Hash Cond: "(customer_mx.c_custkey = orders_mx.o_custkey)" + Plans: + - Node Type: "Seq Scan" + Parent Relationship: "Outer" + Parallel Aware: false + Relation Name: "customer_mx_1220084" + Alias: "customer_mx" + - Node Type: "Hash" + Parent Relationship: "Inner" + Parallel Aware: false + Plans: + - Node Type: "Seq Scan" + Parent Relationship: "Outer" + Parallel Aware: false + Relation Name: "orders_mx_1220068" + Alias: "orders_mx" + diff --git a/src/test/regress/expected/multi_mx_explain_0.out b/src/test/regress/expected/multi_mx_explain_0.out index c580d3e34..a26186c87 100644 --- a/src/test/regress/expected/multi_mx_explain_0.out +++ b/src/test/regress/expected/multi_mx_explain_0.out @@ -59,7 +59,7 @@ EXPLAIN (COSTS FALSE, FORMAT TEXT) SELECT l_quantity, count(*) count_quantity FROM lineitem_mx GROUP BY l_quantity ORDER BY count_quantity, l_quantity; Sort - Sort Key: COALESCE((sum((COALESCE((sum(remote_scan.count_quantity))::bigint, '0'::bigint))))::bigint, '0'::bigint), remote_scan.l_quantity + Sort Key: COALESCE((pg_catalog.sum((COALESCE((pg_catalog.sum(remote_scan.count_quantity))::bigint, '0'::bigint))))::bigint, '0'::bigint), remote_scan.l_quantity -> HashAggregate Group Key: remote_scan.l_quantity -> Custom Scan (Citus Real-Time) @@ -78,18 +78,22 @@ EXPLAIN (COSTS FALSE, FORMAT JSON) { "Plan": { "Node Type": "Sort", - "Sort Key": ["COALESCE((sum((COALESCE((sum(remote_scan.count_quantity))::bigint, '0'::bigint))))::bigint, '0'::bigint)", "remote_scan.l_quantity"], + "Parallel Aware": false, + "Sort Key": ["COALESCE((pg_catalog.sum((COALESCE((pg_catalog.sum(remote_scan.count_quantity))::bigint, '0'::bigint))))::bigint, '0'::bigint)", "remote_scan.l_quantity"], "Plans": [ { "Node Type": "Aggregate", "Strategy": "Hashed", + "Partial Mode": "Simple", "Parent Relationship": "Outer", + "Parallel Aware": false, "Group Key": ["remote_scan.l_quantity"], "Plans": [ { "Node Type": "Custom Scan", "Parent Relationship": "Outer", "Custom Plan Provider": "Citus Real-Time", + "Parallel Aware": false, "Distributed Query": { "Job": { "Task Count": 16, @@ -103,11 +107,14 @@ EXPLAIN (COSTS FALSE, FORMAT JSON) "Plan": { "Node Type": "Aggregate", "Strategy": "Hashed", + "Partial Mode": "Simple", + "Parallel Aware": false, "Group Key": ["l_quantity"], "Plans": [ { "Node Type": "Seq Scan", "Parent Relationship": "Outer", + "Parallel Aware": false, "Relation Name": "lineitem_mx_1220052", "Alias": "lineitem_mx" } @@ -142,15 +149,18 @@ EXPLAIN (COSTS FALSE, FORMAT XML) Sort + false - COALESCE((sum((COALESCE((sum(remote_scan.count_quantity))::bigint, '0'::bigint))))::bigint, '0'::bigint) + COALESCE((pg_catalog.sum((COALESCE((pg_catalog.sum(remote_scan.count_quantity))::bigint, '0'::bigint))))::bigint, '0'::bigint) remote_scan.l_quantity Aggregate Hashed + Simple Outer + false remote_scan.l_quantity @@ -159,6 +169,7 @@ EXPLAIN (COSTS FALSE, FORMAT XML) Custom Scan Outer Citus Real-Time + false 16 @@ -172,6 +183,8 @@ EXPLAIN (COSTS FALSE, FORMAT XML) Aggregate Hashed + Simple + false l_quantity @@ -179,6 +192,7 @@ EXPLAIN (COSTS FALSE, FORMAT XML) Seq Scan Outer + false lineitem_mx_1220052 lineitem_mx @@ -209,19 +223,23 @@ EXPLAIN (COSTS FALSE, FORMAT YAML) GROUP BY l_quantity ORDER BY count_quantity, l_quantity; - Plan: Node Type: "Sort" + Parallel Aware: false Sort Key: - - "COALESCE((sum((COALESCE((sum(remote_scan.count_quantity))::bigint, '0'::bigint))))::bigint, '0'::bigint)" + - "COALESCE((pg_catalog.sum((COALESCE((pg_catalog.sum(remote_scan.count_quantity))::bigint, '0'::bigint))))::bigint, '0'::bigint)" - "remote_scan.l_quantity" Plans: - Node Type: "Aggregate" Strategy: "Hashed" + Partial Mode: "Simple" Parent Relationship: "Outer" + Parallel Aware: false Group Key: - "remote_scan.l_quantity" Plans: - Node Type: "Custom Scan" Parent Relationship: "Outer" Custom Plan Provider: "Citus Real-Time" + Parallel Aware: false Distributed Query: Job: Task Count: 16 @@ -232,11 +250,14 @@ EXPLAIN (COSTS FALSE, FORMAT YAML) - Plan: Node Type: "Aggregate" Strategy: "Hashed" + Partial Mode: "Simple" + Parallel Aware: false Group Key: - "l_quantity" Plans: - Node Type: "Seq Scan" Parent Relationship: "Outer" + Parallel Aware: false Relation Name: "lineitem_mx_1220052" Alias: "lineitem_mx" @@ -245,7 +266,7 @@ EXPLAIN (COSTS FALSE, FORMAT TEXT) SELECT l_quantity, count(*) count_quantity FROM lineitem_mx GROUP BY l_quantity ORDER BY count_quantity, l_quantity; Sort - Sort Key: COALESCE((sum((COALESCE((sum(remote_scan.count_quantity))::bigint, '0'::bigint))))::bigint, '0'::bigint), remote_scan.l_quantity + Sort Key: COALESCE((pg_catalog.sum((COALESCE((pg_catalog.sum(remote_scan.count_quantity))::bigint, '0'::bigint))))::bigint, '0'::bigint), remote_scan.l_quantity -> HashAggregate Group Key: remote_scan.l_quantity -> Custom Scan (Citus Real-Time) @@ -261,7 +282,7 @@ Sort EXPLAIN (COSTS FALSE, VERBOSE TRUE) SELECT sum(l_quantity) / avg(l_quantity) FROM lineitem_mx; Aggregate - Output: (sum(remote_scan."?column?") / (sum(remote_scan."?column?_1") / sum(remote_scan."?column?_2"))) + Output: (sum(remote_scan."?column?") / (sum(remote_scan."?column?_1") / pg_catalog.sum(remote_scan."?column?_2"))) -> Custom Scan (Citus Real-Time) Output: remote_scan."?column?", remote_scan."?column?_1", remote_scan."?column?_2" Task Count: 16 @@ -314,8 +335,8 @@ Custom Scan (Citus Router) Tasks Shown: All -> Task Node: host=localhost port=57637 dbname=regression - -> Update on lineitem_mx_1220052 - -> Index Scan using lineitem_mx_pkey_1220052 on lineitem_mx_1220052 + -> Update on lineitem_mx_1220052 lineitem_mx + -> Index Scan using lineitem_mx_pkey_1220052 on lineitem_mx_1220052 lineitem_mx Index Cond: (l_orderkey = 1) Filter: (l_partkey = 0) -- Test delete @@ -327,10 +348,15 @@ Custom Scan (Citus Router) Tasks Shown: All -> Task Node: host=localhost port=57637 dbname=regression - -> Delete on lineitem_mx_1220052 - -> Index Scan using lineitem_mx_pkey_1220052 on lineitem_mx_1220052 + -> Delete on lineitem_mx_1220052 lineitem_mx + -> Index Scan using lineitem_mx_pkey_1220052 on lineitem_mx_1220052 lineitem_mx Index Cond: (l_orderkey = 1) Filter: (l_partkey = 0) +-- make the outputs more consistent +VACUUM ANALYZE lineitem_mx; +VACUUM ANALYZE orders_mx; +VACUUM ANALYZE customer_mx; +VACUUM ANALYZE supplier_mx; -- Test single-shard SELECT EXPLAIN (COSTS FALSE) SELECT l_quantity FROM lineitem_mx WHERE l_orderkey = 5; @@ -339,10 +365,8 @@ Custom Scan (Citus Router) Tasks Shown: All -> Task Node: host=localhost port=57638 dbname=regression - -> Bitmap Heap Scan on lineitem_mx_1220055 lineitem_mx - Recheck Cond: (l_orderkey = 5) - -> Bitmap Index Scan on lineitem_mx_pkey_1220055 - Index Cond: (l_orderkey = 5) + -> Index Scan using lineitem_mx_pkey_1220055 on lineitem_mx_1220055 lineitem_mx + Index Cond: (l_orderkey = 5) SELECT true AS valid FROM explain_xml($$ SELECT l_quantity FROM lineitem_mx WHERE l_orderkey = 5$$); t @@ -370,68 +394,68 @@ Aggregate -> Task Node: host=localhost port=57637 dbname=regression -> Aggregate - -> Seq Scan on lineitem_mx_1220052 lineitem_mx - Filter: (l_orderkey > 9030) + -> Index Only Scan using lineitem_mx_pkey_1220052 on lineitem_mx_1220052 lineitem_mx + Index Cond: (l_orderkey > 9030) -> Task Node: host=localhost port=57638 dbname=regression -> Aggregate - -> Seq Scan on lineitem_mx_1220053 lineitem_mx - Filter: (l_orderkey > 9030) + -> Index Only Scan using lineitem_mx_pkey_1220053 on lineitem_mx_1220053 lineitem_mx + Index Cond: (l_orderkey > 9030) -> Task Node: host=localhost port=57637 dbname=regression -> Aggregate - -> Seq Scan on lineitem_mx_1220054 lineitem_mx - Filter: (l_orderkey > 9030) + -> Index Only Scan using lineitem_mx_pkey_1220054 on lineitem_mx_1220054 lineitem_mx + Index Cond: (l_orderkey > 9030) -> Task Node: host=localhost port=57638 dbname=regression -> Aggregate - -> Seq Scan on lineitem_mx_1220055 lineitem_mx - Filter: (l_orderkey > 9030) + -> Index Only Scan using lineitem_mx_pkey_1220055 on lineitem_mx_1220055 lineitem_mx + Index Cond: (l_orderkey > 9030) -> Task Node: host=localhost port=57637 dbname=regression -> Aggregate - -> Seq Scan on lineitem_mx_1220056 lineitem_mx - Filter: (l_orderkey > 9030) + -> Index Only Scan using lineitem_mx_pkey_1220056 on lineitem_mx_1220056 lineitem_mx + Index Cond: (l_orderkey > 9030) -> Task Node: host=localhost port=57638 dbname=regression -> Aggregate - -> Seq Scan on lineitem_mx_1220057 lineitem_mx - Filter: (l_orderkey > 9030) + -> Index Only Scan using lineitem_mx_pkey_1220057 on lineitem_mx_1220057 lineitem_mx + Index Cond: (l_orderkey > 9030) -> Task Node: host=localhost port=57637 dbname=regression -> Aggregate - -> Seq Scan on lineitem_mx_1220058 lineitem_mx - Filter: (l_orderkey > 9030) + -> Index Only Scan using lineitem_mx_pkey_1220058 on lineitem_mx_1220058 lineitem_mx + Index Cond: (l_orderkey > 9030) -> Task Node: host=localhost port=57638 dbname=regression -> Aggregate - -> Seq Scan on lineitem_mx_1220059 lineitem_mx - Filter: (l_orderkey > 9030) + -> Index Only Scan using lineitem_mx_pkey_1220059 on lineitem_mx_1220059 lineitem_mx + Index Cond: (l_orderkey > 9030) -> Task Node: host=localhost port=57637 dbname=regression -> Aggregate - -> Seq Scan on lineitem_mx_1220060 lineitem_mx - Filter: (l_orderkey > 9030) + -> Index Only Scan using lineitem_mx_pkey_1220060 on lineitem_mx_1220060 lineitem_mx + Index Cond: (l_orderkey > 9030) -> Task Node: host=localhost port=57638 dbname=regression -> Aggregate - -> Seq Scan on lineitem_mx_1220061 lineitem_mx - Filter: (l_orderkey > 9030) + -> Index Only Scan using lineitem_mx_pkey_1220061 on lineitem_mx_1220061 lineitem_mx + Index Cond: (l_orderkey > 9030) -> Task Node: host=localhost port=57637 dbname=regression -> Aggregate - -> Seq Scan on lineitem_mx_1220062 lineitem_mx - Filter: (l_orderkey > 9030) + -> Index Only Scan using lineitem_mx_pkey_1220062 on lineitem_mx_1220062 lineitem_mx + Index Cond: (l_orderkey > 9030) -> Task Node: host=localhost port=57638 dbname=regression -> Aggregate - -> Seq Scan on lineitem_mx_1220063 lineitem_mx - Filter: (l_orderkey > 9030) + -> Index Only Scan using lineitem_mx_pkey_1220063 on lineitem_mx_1220063 lineitem_mx + Index Cond: (l_orderkey > 9030) -> Task Node: host=localhost port=57637 dbname=regression -> Aggregate - -> Seq Scan on lineitem_mx_1220064 lineitem_mx - Filter: (l_orderkey > 9030) + -> Index Only Scan using lineitem_mx_pkey_1220064 on lineitem_mx_1220064 lineitem_mx + Index Cond: (l_orderkey > 9030) -> Task Node: host=localhost port=57638 dbname=regression -> Aggregate @@ -440,13 +464,13 @@ Aggregate -> Task Node: host=localhost port=57637 dbname=regression -> Aggregate - -> Seq Scan on lineitem_mx_1220066 lineitem_mx - Filter: (l_orderkey > 9030) + -> Index Only Scan using lineitem_mx_pkey_1220066 on lineitem_mx_1220066 lineitem_mx + Index Cond: (l_orderkey > 9030) -> Task Node: host=localhost port=57638 dbname=regression -> Aggregate - -> Seq Scan on lineitem_mx_1220067 lineitem_mx - Filter: (l_orderkey > 9030) + -> Index Only Scan using lineitem_mx_pkey_1220067 on lineitem_mx_1220067 lineitem_mx + Index Cond: (l_orderkey > 9030) SELECT true AS valid FROM explain_xml($$ SELECT avg(l_linenumber) FROM lineitem_mx WHERE l_orderkey > 9030$$); t @@ -465,8 +489,8 @@ Aggregate -> Task Node: host=localhost port=57637 dbname=regression -> Aggregate - -> Seq Scan on lineitem_mx_1220052 lineitem_mx - Filter: (l_orderkey > 9030) + -> Index Only Scan using lineitem_mx_pkey_1220052 on lineitem_mx_1220052 lineitem_mx + Index Cond: (l_orderkey > 9030) -- Test re-partition join SET citus.large_table_shard_count TO 1; EXPLAIN (COSTS FALSE) @@ -477,20 +501,24 @@ EXPLAIN (COSTS FALSE) AND l_suppkey = s_suppkey; Aggregate -> Custom Scan (Citus Task-Tracker) - Task Count: 4 - Tasks Shown: None, not supported for re-partition queries - -> MapMergeJob - Map Task Count: 4 - Merge Task Count: 4 - -> MapMergeJob - Map Task Count: 16 - Merge Task Count: 4 - -> MapMergeJob - Map Task Count: 1 - Merge Task Count: 4 - -> MapMergeJob - Map Task Count: 1 - Merge Task Count: 4 + Task Count: 16 + Tasks Shown: One of 16 + -> Task + Node: host=localhost port=57637 dbname=regression + -> Aggregate + -> Hash Join + Hash Cond: (lineitem_mx.l_orderkey = orders_mx.o_orderkey) + -> Hash Join + Hash Cond: (supplier_mx.s_suppkey = lineitem_mx.l_suppkey) + -> Seq Scan on supplier_mx_1220087 supplier_mx + -> Hash + -> Seq Scan on lineitem_mx_1220052 lineitem_mx + -> Hash + -> Hash Join + Hash Cond: (customer_mx.c_custkey = orders_mx.o_custkey) + -> Seq Scan on customer_mx_1220084 customer_mx + -> Hash + -> Seq Scan on orders_mx_1220068 orders_mx EXPLAIN (COSTS FALSE, FORMAT JSON) SELECT count(*) FROM lineitem_mx, orders_mx, customer_mx, supplier_mx @@ -502,33 +530,112 @@ EXPLAIN (COSTS FALSE, FORMAT JSON) "Plan": { "Node Type": "Aggregate", "Strategy": "Plain", + "Partial Mode": "Simple", + "Parallel Aware": false, "Plans": [ { "Node Type": "Custom Scan", "Parent Relationship": "Outer", "Custom Plan Provider": "Citus Task-Tracker", + "Parallel Aware": false, "Distributed Query": { "Job": { - "Task Count": 4, - "Tasks Shown": "None, not supported for re-partition queries", - "Depended Jobs": [ + "Task Count": 16, + "Tasks Shown": "One of 16", + "Tasks": [ { - "Map Task Count": 4, - "Merge Task Count": 4, - "Depended Jobs": [ - { - "Map Task Count": 16, - "Merge Task Count": 4 - }, - { - "Map Task Count": 1, - "Merge Task Count": 4 - } + "Node": "host=localhost port=57637 dbname=regression", + "Remote Plan": [ + [ + { + "Plan": { + "Node Type": "Aggregate", + "Strategy": "Plain", + "Partial Mode": "Simple", + "Parallel Aware": false, + "Plans": [ + { + "Node Type": "Hash Join", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Join Type": "Inner", + "Hash Cond": "(lineitem_mx.l_orderkey = orders_mx.o_orderkey)", + "Plans": [ + { + "Node Type": "Hash Join", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Join Type": "Inner", + "Hash Cond": "(supplier_mx.s_suppkey = lineitem_mx.l_suppkey)", + "Plans": [ + { + "Node Type": "Seq Scan", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Relation Name": "supplier_mx_1220087", + "Alias": "supplier_mx" + }, + { + "Node Type": "Hash", + "Parent Relationship": "Inner", + "Parallel Aware": false, + "Plans": [ + { + "Node Type": "Seq Scan", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Relation Name": "lineitem_mx_1220052", + "Alias": "lineitem_mx" + } + ] + } + ] + }, + { + "Node Type": "Hash", + "Parent Relationship": "Inner", + "Parallel Aware": false, + "Plans": [ + { + "Node Type": "Hash Join", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Join Type": "Inner", + "Hash Cond": "(customer_mx.c_custkey = orders_mx.o_custkey)", + "Plans": [ + { + "Node Type": "Seq Scan", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Relation Name": "customer_mx_1220084", + "Alias": "customer_mx" + }, + { + "Node Type": "Hash", + "Parent Relationship": "Inner", + "Parallel Aware": false, + "Plans": [ + { + "Node Type": "Seq Scan", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Relation Name": "orders_mx_1220068", + "Alias": "orders_mx" + } + ] + } + ] + } + ] + } + ] + } + ] + } + } + ] + ] - }, - { - "Map Task Count": 1, - "Merge Task Count": 4 } ] } @@ -556,35 +663,113 @@ EXPLAIN (COSTS FALSE, FORMAT XML) Aggregate Plain + Simple + false Custom Scan Outer Citus Task-Tracker + false - 4 - None, not supported for re-partition queries - - - 4 - 4 - - - 16 - 4 - - - 1 - 4 - - - - - 1 - 4 - - + 16 + One of 16 + + + host=localhost port=57637 dbname=regression + + + + + Aggregate + Plain + Simple + false + + + Hash Join + Outer + false + Inner + (lineitem_mx.l_orderkey = orders_mx.o_orderkey) + + + Hash Join + Outer + false + Inner + (supplier_mx.s_suppkey = lineitem_mx.l_suppkey) + + + Seq Scan + Outer + false + supplier_mx_1220087 + supplier_mx + + + Hash + Inner + false + + + Seq Scan + Outer + false + lineitem_mx_1220052 + lineitem_mx + + + + + + + Hash + Inner + false + + + Hash Join + Outer + false + Inner + (customer_mx.c_custkey = orders_mx.o_custkey) + + + Seq Scan + Outer + false + customer_mx_1220084 + customer_mx + + + Hash + Inner + false + + + Seq Scan + Outer + false + orders_mx_1220068 + orders_mx + + + + + + + + + + + + + + + + @@ -608,21 +793,74 @@ EXPLAIN (COSTS FALSE, FORMAT YAML) - Plan: Node Type: "Aggregate" Strategy: "Plain" + Partial Mode: "Simple" + Parallel Aware: false Plans: - Node Type: "Custom Scan" Parent Relationship: "Outer" Custom Plan Provider: "Citus Task-Tracker" + Parallel Aware: false Distributed Query: Job: - Task Count: 4 - Tasks Shown: "None, not supported for re-partition queries" - Depended Jobs: - - Map Task Count: 4 - Merge Task Count: 4 - Depended Jobs: - - Map Task Count: 16 - Merge Task Count: 4 - - Map Task Count: 1 - Merge Task Count: 4 - - Map Task Count: 1 - Merge Task Count: 4 + Task Count: 16 + Tasks Shown: "One of 16" + Tasks: + - Node: "host=localhost port=57637 dbname=regression" + Remote Plan: + - Plan: + Node Type: "Aggregate" + Strategy: "Plain" + Partial Mode: "Simple" + Parallel Aware: false + Plans: + - Node Type: "Hash Join" + Parent Relationship: "Outer" + Parallel Aware: false + Join Type: "Inner" + Hash Cond: "(lineitem_mx.l_orderkey = orders_mx.o_orderkey)" + Plans: + - Node Type: "Hash Join" + Parent Relationship: "Outer" + Parallel Aware: false + Join Type: "Inner" + Hash Cond: "(supplier_mx.s_suppkey = lineitem_mx.l_suppkey)" + Plans: + - Node Type: "Seq Scan" + Parent Relationship: "Outer" + Parallel Aware: false + Relation Name: "supplier_mx_1220087" + Alias: "supplier_mx" + - Node Type: "Hash" + Parent Relationship: "Inner" + Parallel Aware: false + Plans: + - Node Type: "Seq Scan" + Parent Relationship: "Outer" + Parallel Aware: false + Relation Name: "lineitem_mx_1220052" + Alias: "lineitem_mx" + - Node Type: "Hash" + Parent Relationship: "Inner" + Parallel Aware: false + Plans: + - Node Type: "Hash Join" + Parent Relationship: "Outer" + Parallel Aware: false + Join Type: "Inner" + Hash Cond: "(customer_mx.c_custkey = orders_mx.o_custkey)" + Plans: + - Node Type: "Seq Scan" + Parent Relationship: "Outer" + Parallel Aware: false + Relation Name: "customer_mx_1220084" + Alias: "customer_mx" + - Node Type: "Hash" + Parent Relationship: "Inner" + Parallel Aware: false + Plans: + - Node Type: "Seq Scan" + Parent Relationship: "Outer" + Parallel Aware: false + Relation Name: "orders_mx_1220068" + Alias: "orders_mx" + diff --git a/src/test/regress/input/multi_mx_copy_data.source b/src/test/regress/input/multi_mx_copy_data.source index 525216771..7b6a991b0 100644 --- a/src/test/regress/input/multi_mx_copy_data.source +++ b/src/test/regress/input/multi_mx_copy_data.source @@ -20,8 +20,8 @@ SET search_path TO public; \COPY orders_mx FROM '@abs_srcdir@/data/orders.1.data' with delimiter '|' \COPY orders_mx FROM '@abs_srcdir@/data/orders.2.data' with delimiter '|' --- and use second worker as well -\c - - - :worker_2_port +-- and use coordinator for reference tables +\c - - - :master_port SET search_path TO public; \COPY customer_mx FROM '@abs_srcdir@/data/customer.1.data' with delimiter '|' diff --git a/src/test/regress/output/multi_mx_copy_data.source b/src/test/regress/output/multi_mx_copy_data.source index 06ba5790a..658f285a8 100644 --- a/src/test/regress/output/multi_mx_copy_data.source +++ b/src/test/regress/output/multi_mx_copy_data.source @@ -14,8 +14,8 @@ SET search_path TO public; \COPY lineitem_mx FROM '@abs_srcdir@/data/lineitem.2.data' with delimiter '|' \COPY orders_mx FROM '@abs_srcdir@/data/orders.1.data' with delimiter '|' \COPY orders_mx FROM '@abs_srcdir@/data/orders.2.data' with delimiter '|' --- and use second worker as well -\c - - - :worker_2_port +-- and use coordinator for reference tables +\c - - - :master_port SET search_path TO public; \COPY customer_mx FROM '@abs_srcdir@/data/customer.1.data' with delimiter '|' \COPY nation_mx FROM '@abs_srcdir@/data/nation.data' with delimiter '|' diff --git a/src/test/regress/sql/multi_mx_create_table.sql b/src/test/regress/sql/multi_mx_create_table.sql index 851fe9361..1a71bc1eb 100644 --- a/src/test/regress/sql/multi_mx_create_table.sql +++ b/src/test/regress/sql/multi_mx_create_table.sql @@ -306,8 +306,7 @@ CREATE TABLE customer_mx ( c_mktsegment char(10) not null, c_comment varchar(117) not null); -SET citus.shard_count TO 1; -SELECT create_distributed_table('customer_mx', 'c_custkey'); +SELECT create_reference_table('customer_mx'); CREATE TABLE nation_mx ( n_nationkey integer not null, @@ -315,7 +314,7 @@ CREATE TABLE nation_mx ( n_regionkey integer not null, n_comment varchar(152)); -SELECT create_distributed_table('nation_mx', 'n_nationkey'); +SELECT create_reference_table('nation_mx'); CREATE TABLE part_mx ( p_partkey integer not null, @@ -328,7 +327,7 @@ CREATE TABLE part_mx ( p_retailprice decimal(15,2) not null, p_comment varchar(23) not null); -SELECT create_distributed_table('part_mx', 'p_partkey'); +SELECT create_reference_table('part_mx'); CREATE TABLE supplier_mx ( @@ -341,7 +340,7 @@ CREATE TABLE supplier_mx s_comment varchar(101) not null ); -SELECT create_distributed_table('supplier_mx', 's_suppkey'); +SELECT create_reference_table('supplier_mx'); -- Create test table for ddl CREATE TABLE mx_ddl_table ( diff --git a/src/test/regress/sql/multi_mx_explain.sql b/src/test/regress/sql/multi_mx_explain.sql index a7bab99c2..be396d91f 100644 --- a/src/test/regress/sql/multi_mx_explain.sql +++ b/src/test/regress/sql/multi_mx_explain.sql @@ -129,6 +129,9 @@ EXPLAIN (COSTS FALSE) -- make the outputs more consistent VACUUM ANALYZE lineitem_mx; +VACUUM ANALYZE orders_mx; +VACUUM ANALYZE customer_mx; +VACUUM ANALYZE supplier_mx; -- Test single-shard SELECT EXPLAIN (COSTS FALSE)