mirror of https://github.com/citusdata/citus.git
Improve shard pruning logic to understand OR-conditions.
Previously a limitation in the shard pruning logic caused multi distribution value queries to always go into all the shards/workers whenever query also used OR conditions in WHERE clause. Related to https://github.com/citusdata/citus/issues/2593 and https://github.com/citusdata/citus/issues/1537 There was no good workaround for this limitation. The limitation caused quite a bit of overhead with simple queries being sent to all workers/shards (especially with setups having lot of workers/shards). An example of a previous plan which was inadequately pruned: ``` EXPLAIN SELECT count(*) FROM orders_hash_partitioned WHERE (o_orderkey IN (1,2)) AND (o_custkey = 11 OR o_custkey = 22); QUERY PLAN --------------------------------------------------------------------- Aggregate (cost=0.00..0.00 rows=0 width=0) -> Custom Scan (Citus Adaptive) (cost=0.00..0.00 rows=0 width=0) Task Count: 4 Tasks Shown: One of 4 -> Task Node: host=localhost port=xxxxx dbname=regression -> Aggregate (cost=13.68..13.69 rows=1 width=8) -> Seq Scan on orders_hash_partitioned_630000 orders_hash_partitioned (cost=0.00..13.68 rows=1 width=0) Filter: ((o_orderkey = ANY ('{1,2}'::integer[])) AND ((o_custkey = 11) OR (o_custkey = 22))) (9 rows) ``` After this commit the task count is what one would expect from the query defining multiple distinct values for the distribution column: ``` EXPLAIN SELECT count(*) FROM orders_hash_partitioned WHERE (o_orderkey IN (1,2)) AND (o_custkey = 11 OR o_custkey = 22); QUERY PLAN --------------------------------------------------------------------- Aggregate (cost=0.00..0.00 rows=0 width=0) -> Custom Scan (Citus Adaptive) (cost=0.00..0.00 rows=0 width=0) Task Count: 2 Tasks Shown: One of 2 -> Task Node: host=localhost port=xxxxx dbname=regression -> Aggregate (cost=13.68..13.69 rows=1 width=8) -> Seq Scan on orders_hash_partitioned_630000 orders_hash_partitioned (cost=0.00..13.68 rows=1 width=0) Filter: ((o_orderkey = ANY ('{1,2}'::integer[])) AND ((o_custkey = 11) OR (o_custkey = 22))) (9 rows) ``` "Core" of the pruning logic works as previously where it uses `PrunableInstances` to queue ORable valid constraints for shard pruning. The difference is that now we build a compact internal representation of the query expression tree with PruningTreeNodes before actual shard pruning is run. Pruning tree nodes represent boolean operators and the associated constraints of it. This internal format allows us to have compact representation of the query WHERE clauses which allows "core" pruning logic to work with OR-clauses correctly. For example query having `WHERE (o_orderkey IN (1,2)) AND (o_custkey=11 OR (o_shippriority > 1 AND o_shippriority < 10))` gets transformed into: 1. AND(o_orderkey IN (1,2), OR(X, AND(X, X))) 2. AND(o_orderkey IN (1,2), OR(X, X)) 3. AND(o_orderkey IN (1,2), X) Here X is any set of unknown condition(s) for shard pruning. This allow the final shard pruning to correctly recognize that shard pruning is done with the valid condition of `o_orderkey IN (1,2)`. Another example with unprunable condition in query `WHERE (o_orderkey IN (1,2)) OR (o_custkey=11 AND o_custkey=22)` gets transformed into: 1. OR(o_orderkey IN (1,2), AND(X, X)) 2. OR(o_orderkey IN (1,2), X) Which is recognized as unprunable due to the OR condition between distribution column and unknown constraint -> goes to all shards. Issue https://github.com/citusdata/citus/issues/1537 originally suggested transforming the query conditions into a full disjunctive normal form (DNF), but this process of transforming into DNF is quite a heavy operation. It may "blow up" into a really large DNF form with complex queries having non trivial `WHERE` clauses. I think the logic for shard pruning could be simplified further but I decided to leave the "core" of the shard pruning untouched.pull/3486/head
parent
3d8efe303e
commit
cdedb98c54
File diff suppressed because it is too large
Load Diff
|
@ -87,7 +87,6 @@ DEBUG: Plan is router executable
|
||||||
DELETE FROM modify_fast_path WHERE value_1 = 15 AND (key = 1 OR value_2 = 'citus');
|
DELETE FROM modify_fast_path WHERE value_1 = 15 AND (key = 1 OR value_2 = 'citus');
|
||||||
DEBUG: Creating router plan
|
DEBUG: Creating router plan
|
||||||
DEBUG: Plan is router executable
|
DEBUG: Plan is router executable
|
||||||
DETAIL: distribution column value: 1
|
|
||||||
-- goes through fast-path planning even if the key is updated to the same value
|
-- goes through fast-path planning even if the key is updated to the same value
|
||||||
UPDATE modify_fast_path SET key = 1 WHERE key = 1;
|
UPDATE modify_fast_path SET key = 1 WHERE key = 1;
|
||||||
DEBUG: Distributed planning for a fast-path router query
|
DEBUG: Distributed planning for a fast-path router query
|
||||||
|
|
|
@ -29,6 +29,11 @@ SELECT create_distributed_table('orders_hash_partitioned', 'o_orderkey');
|
||||||
|
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
|
INSERT INTO orders_hash_partitioned (o_orderkey, o_custkey, o_totalprice, o_shippriority, o_clerk) VALUES
|
||||||
|
(1, 11, 10, 111, 'aaa'),
|
||||||
|
(2, 22, 20, 222, 'bbb'),
|
||||||
|
(3, 33, 30, 333, 'ccc'),
|
||||||
|
(4, 44, 40, 444, 'ddd');
|
||||||
SET client_min_messages TO DEBUG2;
|
SET client_min_messages TO DEBUG2;
|
||||||
-- Check that we can prune shards for simple cases, boolean expressions and
|
-- Check that we can prune shards for simple cases, boolean expressions and
|
||||||
-- immutable functions.
|
-- immutable functions.
|
||||||
|
@ -36,7 +41,7 @@ SELECT count(*) FROM orders_hash_partitioned;
|
||||||
DEBUG: Router planner cannot handle multi-shard select queries
|
DEBUG: Router planner cannot handle multi-shard select queries
|
||||||
count
|
count
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
0
|
4
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
SELECT count(*) FROM orders_hash_partitioned WHERE o_orderkey = 1;
|
SELECT count(*) FROM orders_hash_partitioned WHERE o_orderkey = 1;
|
||||||
|
@ -45,7 +50,7 @@ DEBUG: Plan is router executable
|
||||||
DETAIL: distribution column value: 1
|
DETAIL: distribution column value: 1
|
||||||
count
|
count
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
0
|
1
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
SELECT count(*) FROM orders_hash_partitioned WHERE o_orderkey = 2;
|
SELECT count(*) FROM orders_hash_partitioned WHERE o_orderkey = 2;
|
||||||
|
@ -54,7 +59,7 @@ DEBUG: Plan is router executable
|
||||||
DETAIL: distribution column value: 2
|
DETAIL: distribution column value: 2
|
||||||
count
|
count
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
0
|
1
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
SELECT count(*) FROM orders_hash_partitioned WHERE o_orderkey = 3;
|
SELECT count(*) FROM orders_hash_partitioned WHERE o_orderkey = 3;
|
||||||
|
@ -63,7 +68,7 @@ DEBUG: Plan is router executable
|
||||||
DETAIL: distribution column value: 3
|
DETAIL: distribution column value: 3
|
||||||
count
|
count
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
0
|
1
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
SELECT count(*) FROM orders_hash_partitioned WHERE o_orderkey = 4;
|
SELECT count(*) FROM orders_hash_partitioned WHERE o_orderkey = 4;
|
||||||
|
@ -72,7 +77,7 @@ DEBUG: Plan is router executable
|
||||||
DETAIL: distribution column value: 4
|
DETAIL: distribution column value: 4
|
||||||
count
|
count
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
0
|
1
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
SELECT count(*) FROM orders_hash_partitioned
|
SELECT count(*) FROM orders_hash_partitioned
|
||||||
|
@ -82,7 +87,7 @@ DEBUG: Plan is router executable
|
||||||
DETAIL: distribution column value: 1
|
DETAIL: distribution column value: 1
|
||||||
count
|
count
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
0
|
1
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
SELECT count(*) FROM orders_hash_partitioned WHERE o_orderkey = abs(-1);
|
SELECT count(*) FROM orders_hash_partitioned WHERE o_orderkey = abs(-1);
|
||||||
|
@ -91,7 +96,7 @@ DEBUG: Plan is router executable
|
||||||
DETAIL: distribution column value: 1
|
DETAIL: distribution column value: 1
|
||||||
count
|
count
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
0
|
1
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
-- disable router planning
|
-- disable router planning
|
||||||
|
@ -100,35 +105,35 @@ SELECT count(*) FROM orders_hash_partitioned;
|
||||||
DEBUG: Router planner not enabled.
|
DEBUG: Router planner not enabled.
|
||||||
count
|
count
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
0
|
4
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
SELECT count(*) FROM orders_hash_partitioned WHERE o_orderkey = 1;
|
SELECT count(*) FROM orders_hash_partitioned WHERE o_orderkey = 1;
|
||||||
DEBUG: Router planner not enabled.
|
DEBUG: Router planner not enabled.
|
||||||
count
|
count
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
0
|
1
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
SELECT count(*) FROM orders_hash_partitioned WHERE o_orderkey = 2;
|
SELECT count(*) FROM orders_hash_partitioned WHERE o_orderkey = 2;
|
||||||
DEBUG: Router planner not enabled.
|
DEBUG: Router planner not enabled.
|
||||||
count
|
count
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
0
|
1
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
SELECT count(*) FROM orders_hash_partitioned WHERE o_orderkey = 3;
|
SELECT count(*) FROM orders_hash_partitioned WHERE o_orderkey = 3;
|
||||||
DEBUG: Router planner not enabled.
|
DEBUG: Router planner not enabled.
|
||||||
count
|
count
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
0
|
1
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
SELECT count(*) FROM orders_hash_partitioned WHERE o_orderkey = 4;
|
SELECT count(*) FROM orders_hash_partitioned WHERE o_orderkey = 4;
|
||||||
DEBUG: Router planner not enabled.
|
DEBUG: Router planner not enabled.
|
||||||
count
|
count
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
0
|
1
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
SELECT count(*) FROM orders_hash_partitioned
|
SELECT count(*) FROM orders_hash_partitioned
|
||||||
|
@ -136,14 +141,14 @@ SELECT count(*) FROM orders_hash_partitioned
|
||||||
DEBUG: Router planner not enabled.
|
DEBUG: Router planner not enabled.
|
||||||
count
|
count
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
0
|
1
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
SELECT count(*) FROM orders_hash_partitioned WHERE o_orderkey = abs(-1);
|
SELECT count(*) FROM orders_hash_partitioned WHERE o_orderkey = abs(-1);
|
||||||
DEBUG: Router planner not enabled.
|
DEBUG: Router planner not enabled.
|
||||||
count
|
count
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
0
|
1
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
SET citus.enable_router_execution TO DEFAULT;
|
SET citus.enable_router_execution TO DEFAULT;
|
||||||
|
@ -158,14 +163,14 @@ SELECT count(*) FROM orders_hash_partitioned WHERE o_orderkey is not NULL;
|
||||||
DEBUG: Router planner cannot handle multi-shard select queries
|
DEBUG: Router planner cannot handle multi-shard select queries
|
||||||
count
|
count
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
0
|
4
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
SELECT count(*) FROM orders_hash_partitioned WHERE o_orderkey > 2;
|
SELECT count(*) FROM orders_hash_partitioned WHERE o_orderkey > 2;
|
||||||
DEBUG: Router planner cannot handle multi-shard select queries
|
DEBUG: Router planner cannot handle multi-shard select queries
|
||||||
count
|
count
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
0
|
2
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
SELECT count(*) FROM orders_hash_partitioned
|
SELECT count(*) FROM orders_hash_partitioned
|
||||||
|
@ -173,7 +178,7 @@ SELECT count(*) FROM orders_hash_partitioned
|
||||||
DEBUG: Router planner cannot handle multi-shard select queries
|
DEBUG: Router planner cannot handle multi-shard select queries
|
||||||
count
|
count
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
0
|
2
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
SELECT count(*) FROM orders_hash_partitioned
|
SELECT count(*) FROM orders_hash_partitioned
|
||||||
|
@ -181,15 +186,15 @@ SELECT count(*) FROM orders_hash_partitioned
|
||||||
DEBUG: Router planner cannot handle multi-shard select queries
|
DEBUG: Router planner cannot handle multi-shard select queries
|
||||||
count
|
count
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
0
|
1
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
SELECT count(*) FROM orders_hash_partitioned
|
SELECT count(*) FROM orders_hash_partitioned
|
||||||
WHERE o_orderkey = 1 OR (o_orderkey = 3 AND o_clerk = 'aaa');
|
WHERE o_orderkey = 1 OR (o_orderkey = 3 AND o_clerk = 'ccc');
|
||||||
DEBUG: Router planner cannot handle multi-shard select queries
|
DEBUG: Router planner cannot handle multi-shard select queries
|
||||||
count
|
count
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
0
|
2
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
SELECT count(*) FROM orders_hash_partitioned
|
SELECT count(*) FROM orders_hash_partitioned
|
||||||
|
@ -197,7 +202,7 @@ SELECT count(*) FROM orders_hash_partitioned
|
||||||
DEBUG: Router planner cannot handle multi-shard select queries
|
DEBUG: Router planner cannot handle multi-shard select queries
|
||||||
count
|
count
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
0
|
1
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
SELECT count(*) FROM
|
SELECT count(*) FROM
|
||||||
|
@ -207,13 +212,25 @@ DEBUG: Plan is router executable
|
||||||
DETAIL: distribution column value: 1
|
DETAIL: distribution column value: 1
|
||||||
count
|
count
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
0
|
1
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
SET client_min_messages TO DEFAULT;
|
SET client_min_messages TO DEBUG3;
|
||||||
-- Check that we support runing for ANY/IN with literal.
|
-- Check that we support runing for ANY/IN with literal.
|
||||||
SELECT count(*) FROM lineitem_hash_part
|
SELECT count(*) FROM lineitem_hash_part
|
||||||
WHERE l_orderkey = ANY ('{1,2,3}');
|
WHERE l_orderkey = ANY ('{1,2,3}');
|
||||||
|
DEBUG: constraint value: '1'::bigint COLLATE "default",
|
||||||
|
DEBUG: constraint value: '2'::bigint COLLATE "default",
|
||||||
|
DEBUG: constraint value: '3'::bigint COLLATE "default",
|
||||||
|
DEBUG: shard count: 3
|
||||||
|
DEBUG: Router planner cannot handle multi-shard select queries
|
||||||
|
DEBUG: constraint value: '1'::bigint COLLATE "default",
|
||||||
|
DEBUG: constraint value: '2'::bigint COLLATE "default",
|
||||||
|
DEBUG: constraint value: '3'::bigint COLLATE "default",
|
||||||
|
DEBUG: shard count: 3
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
count
|
count
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
13
|
13
|
||||||
|
@ -221,6 +238,18 @@ SELECT count(*) FROM lineitem_hash_part
|
||||||
|
|
||||||
SELECT count(*) FROM lineitem_hash_part
|
SELECT count(*) FROM lineitem_hash_part
|
||||||
WHERE l_orderkey IN (1,2,3);
|
WHERE l_orderkey IN (1,2,3);
|
||||||
|
DEBUG: constraint value: '1'::bigint COLLATE "default",
|
||||||
|
DEBUG: constraint value: '2'::bigint COLLATE "default",
|
||||||
|
DEBUG: constraint value: '3'::bigint COLLATE "default",
|
||||||
|
DEBUG: shard count: 3
|
||||||
|
DEBUG: Router planner cannot handle multi-shard select queries
|
||||||
|
DEBUG: constraint value: '1'::bigint COLLATE "default",
|
||||||
|
DEBUG: constraint value: '2'::bigint COLLATE "default",
|
||||||
|
DEBUG: constraint value: '3'::bigint COLLATE "default",
|
||||||
|
DEBUG: shard count: 3
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
count
|
count
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
13
|
13
|
||||||
|
@ -229,6 +258,8 @@ SELECT count(*) FROM lineitem_hash_part
|
||||||
-- Check whether we can deal with null arrays
|
-- Check whether we can deal with null arrays
|
||||||
SELECT count(*) FROM lineitem_hash_part
|
SELECT count(*) FROM lineitem_hash_part
|
||||||
WHERE l_orderkey IN (NULL);
|
WHERE l_orderkey IN (NULL);
|
||||||
|
DEBUG: Creating router plan
|
||||||
|
DEBUG: Plan is router executable
|
||||||
count
|
count
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
0
|
0
|
||||||
|
@ -236,6 +267,15 @@ SELECT count(*) FROM lineitem_hash_part
|
||||||
|
|
||||||
SELECT count(*) FROM lineitem_hash_part
|
SELECT count(*) FROM lineitem_hash_part
|
||||||
WHERE l_orderkey = ANY (NULL);
|
WHERE l_orderkey = ANY (NULL);
|
||||||
|
DEBUG: no valid constraints found
|
||||||
|
DEBUG: shard count: 4
|
||||||
|
DEBUG: Router planner cannot handle multi-shard select queries
|
||||||
|
DEBUG: no valid constraints found
|
||||||
|
DEBUG: shard count: 4
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
count
|
count
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
0
|
0
|
||||||
|
@ -243,13 +283,31 @@ SELECT count(*) FROM lineitem_hash_part
|
||||||
|
|
||||||
SELECT count(*) FROM lineitem_hash_part
|
SELECT count(*) FROM lineitem_hash_part
|
||||||
WHERE l_orderkey IN (NULL) OR TRUE;
|
WHERE l_orderkey IN (NULL) OR TRUE;
|
||||||
|
DEBUG: no valid constraints found
|
||||||
|
DEBUG: shard count: 4
|
||||||
|
DEBUG: Router planner cannot handle multi-shard select queries
|
||||||
|
DEBUG: no valid constraints found
|
||||||
|
DEBUG: shard count: 4
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
count
|
count
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
12000
|
12000
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
SELECT count(*) FROM lineitem_hash_part
|
SELECT count(*) FROM lineitem_hash_part
|
||||||
WHERE l_orderkey = ANY (NULL) OR TRUE;
|
WHERE l_orderkey = ANY (NULL) OR TRUE;
|
||||||
|
DEBUG: no valid constraints found
|
||||||
|
DEBUG: shard count: 4
|
||||||
|
DEBUG: Router planner cannot handle multi-shard select queries
|
||||||
|
DEBUG: no valid constraints found
|
||||||
|
DEBUG: shard count: 4
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
count
|
count
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
12000
|
12000
|
||||||
|
@ -257,20 +315,77 @@ SELECT count(*) FROM lineitem_hash_part
|
||||||
|
|
||||||
-- Check whether we support IN/ANY in subquery
|
-- Check whether we support IN/ANY in subquery
|
||||||
SELECT count(*) FROM lineitem_hash_part WHERE l_orderkey IN (SELECT l_orderkey FROM lineitem_hash_part);
|
SELECT count(*) FROM lineitem_hash_part WHERE l_orderkey IN (SELECT l_orderkey FROM lineitem_hash_part);
|
||||||
|
DEBUG: no valid constraints found
|
||||||
|
DEBUG: shard count: 4
|
||||||
|
DEBUG: no valid constraints found
|
||||||
|
DEBUG: shard count: 4
|
||||||
|
DEBUG: Router planner cannot handle multi-shard select queries
|
||||||
|
DEBUG: no valid constraints found
|
||||||
|
DEBUG: shard count: 4
|
||||||
|
DEBUG: no valid constraints found
|
||||||
|
DEBUG: shard count: 4
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
count
|
count
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
12000
|
12000
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
SELECT count(*) FROM lineitem_hash_part WHERE l_orderkey = ANY (SELECT l_orderkey FROM lineitem_hash_part);
|
SELECT count(*) FROM lineitem_hash_part WHERE l_orderkey = ANY (SELECT l_orderkey FROM lineitem_hash_part);
|
||||||
|
DEBUG: no valid constraints found
|
||||||
|
DEBUG: shard count: 4
|
||||||
|
DEBUG: no valid constraints found
|
||||||
|
DEBUG: shard count: 4
|
||||||
|
DEBUG: Router planner cannot handle multi-shard select queries
|
||||||
|
DEBUG: no valid constraints found
|
||||||
|
DEBUG: shard count: 4
|
||||||
|
DEBUG: no valid constraints found
|
||||||
|
DEBUG: shard count: 4
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
count
|
count
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
12000
|
12000
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
|
-- Check whether we support range queries with append distributed table
|
||||||
|
SELECT count(*) FROM lineitem
|
||||||
|
WHERE l_orderkey >= 1 AND l_orderkey <= 3;
|
||||||
|
DEBUG: Router planner does not support append-partitioned tables.
|
||||||
|
DEBUG: constraint (lteq) value: '3'::bigint,
|
||||||
|
DEBUG: constraint (gteq) value: '1'::bigint,
|
||||||
|
DEBUG: shard count: 1
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
count
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
13
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
SELECT count(*) FROM lineitem
|
||||||
|
WHERE (l_orderkey >= 1 AND l_orderkey <= 3) AND (l_quantity > 11 AND l_quantity < 22);
|
||||||
|
DEBUG: Router planner does not support append-partitioned tables.
|
||||||
|
DEBUG: constraint (lteq) value: '3'::bigint,
|
||||||
|
DEBUG: constraint (gteq) value: '1'::bigint,
|
||||||
|
DEBUG: shard count: 1
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
count
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
1
|
||||||
|
(1 row)
|
||||||
|
|
||||||
-- Check whether we support IN/ANY in subquery with append and range distributed table
|
-- Check whether we support IN/ANY in subquery with append and range distributed table
|
||||||
SELECT count(*) FROM lineitem
|
SELECT count(*) FROM lineitem
|
||||||
WHERE l_orderkey = ANY ('{1,2,3}');
|
WHERE l_orderkey = ANY ('{1,2,3}');
|
||||||
|
DEBUG: Router planner does not support append-partitioned tables.
|
||||||
|
DEBUG: constraint value: '1'::bigint COLLATE "default",
|
||||||
|
DEBUG: constraint value: '2'::bigint COLLATE "default",
|
||||||
|
DEBUG: constraint value: '3'::bigint COLLATE "default",
|
||||||
|
DEBUG: shard count: 1
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
count
|
count
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
13
|
13
|
||||||
|
@ -278,13 +393,24 @@ SELECT count(*) FROM lineitem
|
||||||
|
|
||||||
SELECT count(*) FROM lineitem
|
SELECT count(*) FROM lineitem
|
||||||
WHERE l_orderkey IN (1,2,3);
|
WHERE l_orderkey IN (1,2,3);
|
||||||
|
DEBUG: Router planner does not support append-partitioned tables.
|
||||||
|
DEBUG: constraint value: '1'::bigint COLLATE "default",
|
||||||
|
DEBUG: constraint value: '2'::bigint COLLATE "default",
|
||||||
|
DEBUG: constraint value: '3'::bigint COLLATE "default",
|
||||||
|
DEBUG: shard count: 1
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
count
|
count
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
13
|
13
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
SELECT count(*) FROM lineitem
|
SELECT count(*) FROM lineitem
|
||||||
WHERE l_orderkey = ANY(NULL) OR TRUE;
|
WHERE l_orderkey = ANY(NULL) OR TRUE;
|
||||||
|
DEBUG: Router planner does not support append-partitioned tables.
|
||||||
|
DEBUG: no valid constraints found
|
||||||
|
DEBUG: shard count: 2
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
count
|
count
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
12000
|
12000
|
||||||
|
@ -292,6 +418,12 @@ SELECT count(*) FROM lineitem
|
||||||
|
|
||||||
SELECT count(*) FROM lineitem_range
|
SELECT count(*) FROM lineitem_range
|
||||||
WHERE l_orderkey = ANY ('{1,2,3}');
|
WHERE l_orderkey = ANY ('{1,2,3}');
|
||||||
|
DEBUG: constraint value: '1'::bigint COLLATE "default",
|
||||||
|
DEBUG: constraint value: '2'::bigint COLLATE "default",
|
||||||
|
DEBUG: constraint value: '3'::bigint COLLATE "default",
|
||||||
|
DEBUG: shard count: 1
|
||||||
|
DEBUG: Creating router plan
|
||||||
|
DEBUG: Plan is router executable
|
||||||
count
|
count
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
13
|
13
|
||||||
|
@ -299,24 +431,44 @@ SELECT count(*) FROM lineitem_range
|
||||||
|
|
||||||
SELECT count(*) FROM lineitem_range
|
SELECT count(*) FROM lineitem_range
|
||||||
WHERE l_orderkey IN (1,2,3);
|
WHERE l_orderkey IN (1,2,3);
|
||||||
|
DEBUG: constraint value: '1'::bigint COLLATE "default",
|
||||||
|
DEBUG: constraint value: '2'::bigint COLLATE "default",
|
||||||
|
DEBUG: constraint value: '3'::bigint COLLATE "default",
|
||||||
|
DEBUG: shard count: 1
|
||||||
|
DEBUG: Creating router plan
|
||||||
|
DEBUG: Plan is router executable
|
||||||
count
|
count
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
13
|
13
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
SELECT count(*) FROM lineitem_range
|
SELECT count(*) FROM lineitem_range
|
||||||
WHERE l_orderkey = ANY(NULL) OR TRUE;
|
WHERE l_orderkey = ANY(NULL) OR TRUE;
|
||||||
|
DEBUG: no valid constraints found
|
||||||
|
DEBUG: shard count: 2
|
||||||
|
DEBUG: Router planner cannot handle multi-shard select queries
|
||||||
|
DEBUG: no valid constraints found
|
||||||
|
DEBUG: shard count: 2
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
count
|
count
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
12000
|
12000
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
SET client_min_messages TO DEBUG2;
|
|
||||||
-- Check that we don't show the message if the operator is not
|
-- Check that we don't show the message if the operator is not
|
||||||
-- equality operator
|
-- equality operator
|
||||||
SELECT count(*) FROM orders_hash_partitioned
|
SELECT count(*) FROM orders_hash_partitioned
|
||||||
WHERE o_orderkey < ALL ('{1,2,3}');
|
WHERE o_orderkey < ALL ('{1,2,3}');
|
||||||
|
DEBUG: no valid constraints found
|
||||||
|
DEBUG: shard count: 4
|
||||||
DEBUG: Router planner cannot handle multi-shard select queries
|
DEBUG: Router planner cannot handle multi-shard select queries
|
||||||
|
DEBUG: no valid constraints found
|
||||||
|
DEBUG: shard count: 4
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
count
|
count
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
0
|
0
|
||||||
|
@ -325,31 +477,57 @@ DEBUG: Router planner cannot handle multi-shard select queries
|
||||||
-- Check that we don't give a spurious hint message when non-partition
|
-- Check that we don't give a spurious hint message when non-partition
|
||||||
-- columns are used with ANY/IN/ALL
|
-- columns are used with ANY/IN/ALL
|
||||||
SELECT count(*) FROM orders_hash_partitioned
|
SELECT count(*) FROM orders_hash_partitioned
|
||||||
WHERE o_orderkey = 1 OR o_totalprice IN (2, 5);
|
WHERE o_orderkey = 1 OR o_totalprice IN (20, 30);
|
||||||
|
DEBUG: no valid constraints found
|
||||||
|
DEBUG: shard count: 4
|
||||||
DEBUG: Router planner cannot handle multi-shard select queries
|
DEBUG: Router planner cannot handle multi-shard select queries
|
||||||
|
DEBUG: no valid constraints found
|
||||||
|
DEBUG: shard count: 4
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
count
|
count
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
0
|
3
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
-- Check that we cannot prune for mutable functions.
|
-- Check that we cannot prune for mutable functions.
|
||||||
SELECT count(*) FROM orders_hash_partitioned WHERE o_orderkey = random();
|
SELECT count(*) FROM orders_hash_partitioned WHERE o_orderkey = (random() + 100);
|
||||||
|
DEBUG: no valid constraints found
|
||||||
|
DEBUG: shard count: 4
|
||||||
DEBUG: Router planner cannot handle multi-shard select queries
|
DEBUG: Router planner cannot handle multi-shard select queries
|
||||||
|
DEBUG: no valid constraints found
|
||||||
|
DEBUG: shard count: 4
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
count
|
count
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
0
|
0
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
SELECT count(*) FROM orders_hash_partitioned
|
SELECT count(*) FROM orders_hash_partitioned
|
||||||
WHERE o_orderkey = random() OR o_orderkey = 1;
|
WHERE o_orderkey = (random() + 100) OR o_orderkey = 1;
|
||||||
|
DEBUG: no valid constraints found
|
||||||
|
DEBUG: shard count: 4
|
||||||
DEBUG: Router planner cannot handle multi-shard select queries
|
DEBUG: Router planner cannot handle multi-shard select queries
|
||||||
|
DEBUG: no valid constraints found
|
||||||
|
DEBUG: shard count: 4
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
count
|
count
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
0
|
1
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
SELECT count(*) FROM orders_hash_partitioned
|
SELECT count(*) FROM orders_hash_partitioned
|
||||||
WHERE o_orderkey = random() AND o_orderkey = 1;
|
WHERE o_orderkey = (random() + 100) AND o_orderkey = 1;
|
||||||
|
DEBUG: constraint value: 1,
|
||||||
|
DEBUG: shard count: 1
|
||||||
DEBUG: Creating router plan
|
DEBUG: Creating router plan
|
||||||
DEBUG: Plan is router executable
|
DEBUG: Plan is router executable
|
||||||
DETAIL: distribution column value: 1
|
DETAIL: distribution column value: 1
|
||||||
|
@ -362,7 +540,15 @@ DETAIL: distribution column value: 1
|
||||||
SELECT count(*)
|
SELECT count(*)
|
||||||
FROM orders_hash_partitioned orders1, orders_hash_partitioned orders2
|
FROM orders_hash_partitioned orders1, orders_hash_partitioned orders2
|
||||||
WHERE orders1.o_orderkey = orders2.o_orderkey;
|
WHERE orders1.o_orderkey = orders2.o_orderkey;
|
||||||
|
DEBUG: no valid constraints found
|
||||||
|
DEBUG: shard count: 4
|
||||||
|
DEBUG: no valid constraints found
|
||||||
|
DEBUG: shard count: 4
|
||||||
DEBUG: Router planner cannot handle multi-shard select queries
|
DEBUG: Router planner cannot handle multi-shard select queries
|
||||||
|
DEBUG: no valid constraints found
|
||||||
|
DEBUG: shard count: 4
|
||||||
|
DEBUG: no valid constraints found
|
||||||
|
DEBUG: shard count: 4
|
||||||
DEBUG: join prunable for intervals [-2147483648,-1073741825] and [-1073741824,-1]
|
DEBUG: join prunable for intervals [-2147483648,-1073741825] and [-1073741824,-1]
|
||||||
DEBUG: join prunable for intervals [-2147483648,-1073741825] and [0,1073741823]
|
DEBUG: join prunable for intervals [-2147483648,-1073741825] and [0,1073741823]
|
||||||
DEBUG: join prunable for intervals [-2147483648,-1073741825] and [1073741824,2147483647]
|
DEBUG: join prunable for intervals [-2147483648,-1073741825] and [1073741824,2147483647]
|
||||||
|
@ -375,9 +561,13 @@ DEBUG: join prunable for intervals [0,1073741823] and [1073741824,2147483647]
|
||||||
DEBUG: join prunable for intervals [1073741824,2147483647] and [-2147483648,-1073741825]
|
DEBUG: join prunable for intervals [1073741824,2147483647] and [-2147483648,-1073741825]
|
||||||
DEBUG: join prunable for intervals [1073741824,2147483647] and [-1073741824,-1]
|
DEBUG: join prunable for intervals [1073741824,2147483647] and [-1073741824,-1]
|
||||||
DEBUG: join prunable for intervals [1073741824,2147483647] and [0,1073741823]
|
DEBUG: join prunable for intervals [1073741824,2147483647] and [0,1073741823]
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
count
|
count
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
0
|
4
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
SELECT count(*)
|
SELECT count(*)
|
||||||
|
@ -385,6 +575,10 @@ SELECT count(*)
|
||||||
WHERE orders1.o_orderkey = orders2.o_orderkey
|
WHERE orders1.o_orderkey = orders2.o_orderkey
|
||||||
AND orders1.o_orderkey = 1
|
AND orders1.o_orderkey = 1
|
||||||
AND orders2.o_orderkey is NULL;
|
AND orders2.o_orderkey is NULL;
|
||||||
|
DEBUG: constraint value: 1,
|
||||||
|
DEBUG: shard count: 1
|
||||||
|
DEBUG: constraint value: 1,
|
||||||
|
DEBUG: shard count: 1
|
||||||
DEBUG: Creating router plan
|
DEBUG: Creating router plan
|
||||||
DEBUG: Plan is router executable
|
DEBUG: Plan is router executable
|
||||||
DETAIL: distribution column value: 1
|
DETAIL: distribution column value: 1
|
||||||
|
@ -393,3 +587,412 @@ DETAIL: distribution column value: 1
|
||||||
0
|
0
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
|
-- All shards used without constraints
|
||||||
|
SELECT count(*) FROM orders_hash_partitioned;
|
||||||
|
DEBUG: no valid constraints found
|
||||||
|
DEBUG: shard count: 4
|
||||||
|
DEBUG: Router planner cannot handle multi-shard select queries
|
||||||
|
DEBUG: no valid constraints found
|
||||||
|
DEBUG: shard count: 4
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
count
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
4
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
-- Shards restricted correctly with prunable constraint
|
||||||
|
SELECT count(*) FROM orders_hash_partitioned
|
||||||
|
WHERE o_orderkey = 1;
|
||||||
|
DEBUG: constraint value: 1,
|
||||||
|
DEBUG: shard count: 1
|
||||||
|
DEBUG: Creating router plan
|
||||||
|
DEBUG: Plan is router executable
|
||||||
|
DETAIL: distribution column value: 1
|
||||||
|
count
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
1
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
-- Shards restricted correctly with prunable constraint ANDed with unprunable expression using OR
|
||||||
|
SELECT count(*) FROM orders_hash_partitioned
|
||||||
|
WHERE o_orderkey = 1 AND (o_custkey = 11 OR o_custkey = 22);
|
||||||
|
DEBUG: constraint value: 1,
|
||||||
|
DEBUG: shard count: 1
|
||||||
|
DEBUG: Creating router plan
|
||||||
|
DEBUG: Plan is router executable
|
||||||
|
DETAIL: distribution column value: 1
|
||||||
|
count
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
1
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
-- Shards restricted correctly with prunable constraints ORed
|
||||||
|
SELECT count(*) FROM orders_hash_partitioned
|
||||||
|
WHERE (o_orderkey = 1 OR o_orderkey = 2);
|
||||||
|
DEBUG: constraint value: 1,
|
||||||
|
DEBUG: constraint value: 2,
|
||||||
|
DEBUG: shard count: 2
|
||||||
|
DEBUG: Router planner cannot handle multi-shard select queries
|
||||||
|
DEBUG: constraint value: 1,
|
||||||
|
DEBUG: constraint value: 2,
|
||||||
|
DEBUG: shard count: 2
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
count
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
2
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
-- Shards restricted correctly with prunable constraints ANDed with unprunable expression using OR
|
||||||
|
SELECT count(*) FROM orders_hash_partitioned
|
||||||
|
WHERE (o_orderkey = 1 OR o_orderkey = 2) AND (o_custkey = 11 OR o_custkey = 22);
|
||||||
|
DEBUG: constraint value: 1,
|
||||||
|
DEBUG: constraint value: 2,
|
||||||
|
DEBUG: shard count: 2
|
||||||
|
DEBUG: Router planner cannot handle multi-shard select queries
|
||||||
|
DEBUG: constraint value: 1,
|
||||||
|
DEBUG: constraint value: 2,
|
||||||
|
DEBUG: shard count: 2
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
count
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
2
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
-- Shards restricted correctly with many different prunable constraints ORed
|
||||||
|
SELECT count(*) FROM orders_hash_partitioned
|
||||||
|
WHERE (o_orderkey = 1 AND o_custkey = 11) OR (o_orderkey = 1 AND o_custkey = 33) OR (o_orderkey = 2 AND o_custkey = 22) OR (o_orderkey = 2 AND o_custkey = 44);
|
||||||
|
DEBUG: constraint value: 1,
|
||||||
|
DEBUG: constraint value: 1,
|
||||||
|
DEBUG: constraint value: 2,
|
||||||
|
DEBUG: constraint value: 2,
|
||||||
|
DEBUG: shard count: 2
|
||||||
|
DEBUG: Router planner cannot handle multi-shard select queries
|
||||||
|
DEBUG: constraint value: 1,
|
||||||
|
DEBUG: constraint value: 1,
|
||||||
|
DEBUG: constraint value: 2,
|
||||||
|
DEBUG: constraint value: 2,
|
||||||
|
DEBUG: shard count: 2
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
count
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
2
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
-- Shards restricted correctly with prunable SAO constraint ANDed with unprunable expression using OR
|
||||||
|
SELECT count(*) FROM orders_hash_partitioned
|
||||||
|
WHERE (o_orderkey IN (1,2)) AND (o_custkey = 11 OR o_custkey = 22 OR o_custkey = 33);
|
||||||
|
DEBUG: constraint value: 1 COLLATE "default",
|
||||||
|
DEBUG: constraint value: 2 COLLATE "default",
|
||||||
|
DEBUG: shard count: 2
|
||||||
|
DEBUG: Router planner cannot handle multi-shard select queries
|
||||||
|
DEBUG: constraint value: 1 COLLATE "default",
|
||||||
|
DEBUG: constraint value: 2 COLLATE "default",
|
||||||
|
DEBUG: shard count: 2
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
count
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
2
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
-- Shards restricted correctly with prunable SAO constraint ANDed with multiple unprunable expressions
|
||||||
|
SELECT count(*) FROM orders_hash_partitioned
|
||||||
|
WHERE (o_orderkey IN (1,2)) AND (o_totalprice < 11 OR o_totalprice > 19) AND o_shippriority > 100 AND (o_custkey = 11 OR o_custkey = 22);
|
||||||
|
DEBUG: constraint value: 1 COLLATE "default",
|
||||||
|
DEBUG: constraint value: 2 COLLATE "default",
|
||||||
|
DEBUG: shard count: 2
|
||||||
|
DEBUG: Router planner cannot handle multi-shard select queries
|
||||||
|
DEBUG: constraint value: 1 COLLATE "default",
|
||||||
|
DEBUG: constraint value: 2 COLLATE "default",
|
||||||
|
DEBUG: shard count: 2
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
count
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
2
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
-- Shards restricted correctly with prunable SAO constraints ORed
|
||||||
|
SELECT count(*) FROM orders_hash_partitioned
|
||||||
|
WHERE (o_orderkey IN (1,2) AND o_custkey = 11) OR (o_orderkey IN (2,3) AND o_custkey = 22);
|
||||||
|
DEBUG: constraint value: 1 COLLATE "default",
|
||||||
|
DEBUG: constraint value: 2 COLLATE "default",
|
||||||
|
DEBUG: constraint value: 2 COLLATE "default",
|
||||||
|
DEBUG: constraint value: 3 COLLATE "default",
|
||||||
|
DEBUG: shard count: 3
|
||||||
|
DEBUG: Router planner cannot handle multi-shard select queries
|
||||||
|
DEBUG: constraint value: 1 COLLATE "default",
|
||||||
|
DEBUG: constraint value: 2 COLLATE "default",
|
||||||
|
DEBUG: constraint value: 2 COLLATE "default",
|
||||||
|
DEBUG: constraint value: 3 COLLATE "default",
|
||||||
|
DEBUG: shard count: 3
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
count
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
2
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
-- All shards used with prunable expression ORed with unprunable expression
|
||||||
|
SELECT count(*) FROM orders_hash_partitioned
|
||||||
|
WHERE o_orderkey IN (1,2) OR o_custkey = 33;
|
||||||
|
DEBUG: no valid constraints found
|
||||||
|
DEBUG: shard count: 4
|
||||||
|
DEBUG: Router planner cannot handle multi-shard select queries
|
||||||
|
DEBUG: no valid constraints found
|
||||||
|
DEBUG: shard count: 4
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
count
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
3
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
-- Shards restricted correctly with prunable constraint ORed
|
||||||
|
SELECT count(*) FROM orders_hash_partitioned
|
||||||
|
WHERE o_orderkey = 1 OR ((o_orderkey = 2 AND o_custkey = 22) OR (o_orderkey = 3 AND o_custkey = 33));
|
||||||
|
DEBUG: constraint value: 1,
|
||||||
|
DEBUG: constraint value: 2,
|
||||||
|
DEBUG: constraint value: 3,
|
||||||
|
DEBUG: shard count: 3
|
||||||
|
DEBUG: Router planner cannot handle multi-shard select queries
|
||||||
|
DEBUG: constraint value: 1,
|
||||||
|
DEBUG: constraint value: 2,
|
||||||
|
DEBUG: constraint value: 3,
|
||||||
|
DEBUG: shard count: 3
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
count
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
3
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
-- Shards restricted correctly with prunable constraint ORed with falsy expression
|
||||||
|
SELECT count(*) FROM orders_hash_partitioned
|
||||||
|
WHERE o_orderkey = 1 OR (o_orderkey = 2 AND (o_custkey = 11 OR (o_orderkey = 3 AND o_custkey = 44)));
|
||||||
|
DEBUG: constraint value: 1,
|
||||||
|
DEBUG: constraint value: 2,
|
||||||
|
DEBUG: shard count: 2
|
||||||
|
DEBUG: Router planner cannot handle multi-shard select queries
|
||||||
|
DEBUG: constraint value: 1,
|
||||||
|
DEBUG: constraint value: 2,
|
||||||
|
DEBUG: shard count: 2
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
count
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
1
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
-- Shards restricted correctly with prunable SAO constraint ORed with prunable nested EQ constraint
|
||||||
|
SELECT count(*) FROM orders_hash_partitioned
|
||||||
|
WHERE (o_orderkey IN (1,2)) AND (o_custkey = 11 OR o_custkey = 22 OR o_custkey = 33) AND o_totalprice <= 20;
|
||||||
|
DEBUG: constraint value: 1 COLLATE "default",
|
||||||
|
DEBUG: constraint value: 2 COLLATE "default",
|
||||||
|
DEBUG: shard count: 2
|
||||||
|
DEBUG: Router planner cannot handle multi-shard select queries
|
||||||
|
DEBUG: constraint value: 1 COLLATE "default",
|
||||||
|
DEBUG: constraint value: 2 COLLATE "default",
|
||||||
|
DEBUG: shard count: 2
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
count
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
2
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
-- Shards restricted correctly with prunable SAO constraint ANDed with unprunable expressions
|
||||||
|
SELECT count(*) FROM orders_hash_partitioned
|
||||||
|
WHERE (o_orderkey IN (1,2)) AND (o_custkey = 11 OR o_custkey = 33) AND o_custkey = 22;
|
||||||
|
DEBUG: constraint value: 1 COLLATE "default",
|
||||||
|
DEBUG: constraint value: 2 COLLATE "default",
|
||||||
|
DEBUG: shard count: 2
|
||||||
|
DEBUG: Router planner cannot handle multi-shard select queries
|
||||||
|
DEBUG: constraint value: 1 COLLATE "default",
|
||||||
|
DEBUG: constraint value: 2 COLLATE "default",
|
||||||
|
DEBUG: shard count: 2
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
count
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
0
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
-- All shards used with prunable SAO constraint ORed with unprunable nested expression
|
||||||
|
SELECT count(*) FROM orders_hash_partitioned
|
||||||
|
WHERE ((o_orderkey IN (1,2)) AND (o_custkey = 11 OR o_custkey = 22)) OR o_custkey = 33;
|
||||||
|
DEBUG: no valid constraints found
|
||||||
|
DEBUG: shard count: 4
|
||||||
|
DEBUG: Router planner cannot handle multi-shard select queries
|
||||||
|
DEBUG: no valid constraints found
|
||||||
|
DEBUG: shard count: 4
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
count
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
3
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
-- Shards restricted correctly with prunable SAO constraint ORed with prunable nested EQ constraint
|
||||||
|
SELECT count(*) FROM orders_hash_partitioned
|
||||||
|
WHERE ((o_orderkey IN (1,2)) AND (o_custkey = 11 OR o_custkey = 22)) OR (o_orderkey = 3 AND o_custkey = 33);
|
||||||
|
DEBUG: constraint value: 3,
|
||||||
|
DEBUG: constraint value: 1 COLLATE "default",
|
||||||
|
DEBUG: constraint value: 2 COLLATE "default",
|
||||||
|
DEBUG: shard count: 3
|
||||||
|
DEBUG: Router planner cannot handle multi-shard select queries
|
||||||
|
DEBUG: constraint value: 3,
|
||||||
|
DEBUG: constraint value: 1 COLLATE "default",
|
||||||
|
DEBUG: constraint value: 2 COLLATE "default",
|
||||||
|
DEBUG: shard count: 3
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
count
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
3
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
-- All shards used with ORed top level unprunable expression
|
||||||
|
SELECT count(*) FROM orders_hash_partitioned
|
||||||
|
WHERE o_custkey = 11 OR (o_orderkey = 2 AND o_custkey = 22);
|
||||||
|
DEBUG: no valid constraints found
|
||||||
|
DEBUG: shard count: 4
|
||||||
|
DEBUG: Router planner cannot handle multi-shard select queries
|
||||||
|
DEBUG: no valid constraints found
|
||||||
|
DEBUG: shard count: 4
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
count
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
2
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
-- Single shard used when deeply nested prunable expression is restrictive with nested ANDs
|
||||||
|
SELECT count(*) FROM orders_hash_partitioned
|
||||||
|
WHERE o_orderkey = 1 OR (o_orderkey = 2 AND (o_orderkey = 3 OR (o_orderkey = 1 AND o_custkey = 11)));
|
||||||
|
DEBUG: constraint value: 1,
|
||||||
|
DEBUG: shard count: 1
|
||||||
|
DEBUG: Creating router plan
|
||||||
|
DEBUG: Plan is router executable
|
||||||
|
count
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
1
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
-- Single shard used when top prunable expression is restrictive with nested ANDs
|
||||||
|
SELECT count(*) FROM orders_hash_partitioned
|
||||||
|
WHERE o_orderkey = 1 AND ((o_orderkey = 2 OR o_orderkey = 3) AND (o_custkey = 11 OR o_custkey = 22));
|
||||||
|
DEBUG: no valid constraints found
|
||||||
|
DEBUG: shard count: 0
|
||||||
|
DEBUG: Creating router plan
|
||||||
|
DEBUG: Plan is router executable
|
||||||
|
DETAIL: distribution column value: 1
|
||||||
|
count
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
0
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
-- Deeply nested prunable expression affects used shards
|
||||||
|
SELECT count(*) FROM orders_hash_partitioned
|
||||||
|
WHERE o_orderkey = 1 OR ((o_orderkey = 2 OR o_orderkey = 3) AND (o_custkey = 22 OR o_custkey = 33));
|
||||||
|
DEBUG: constraint value: 1,
|
||||||
|
DEBUG: constraint value: 2,
|
||||||
|
DEBUG: constraint value: 3,
|
||||||
|
DEBUG: shard count: 3
|
||||||
|
DEBUG: Router planner cannot handle multi-shard select queries
|
||||||
|
DEBUG: constraint value: 1,
|
||||||
|
DEBUG: constraint value: 2,
|
||||||
|
DEBUG: constraint value: 3,
|
||||||
|
DEBUG: shard count: 3
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
count
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
3
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
-- Deeply nested non prunable expression uses all shards
|
||||||
|
SELECT count(*) FROM orders_hash_partitioned
|
||||||
|
WHERE o_orderkey = 1 OR ((o_orderkey = 2 OR o_custkey = 11) AND (o_custkey = 22 OR o_custkey = 33));
|
||||||
|
DEBUG: no valid constraints found
|
||||||
|
DEBUG: shard count: 4
|
||||||
|
DEBUG: Router planner cannot handle multi-shard select queries
|
||||||
|
DEBUG: no valid constraints found
|
||||||
|
DEBUG: shard count: 4
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
count
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
2
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
-- a OR partkey != x Uses all shards
|
||||||
|
SELECT count(*) FROM orders_hash_partitioned
|
||||||
|
WHERE o_orderkey = 1 OR o_orderkey != 2;
|
||||||
|
DEBUG: no valid constraints found
|
||||||
|
DEBUG: shard count: 4
|
||||||
|
DEBUG: Router planner cannot handle multi-shard select queries
|
||||||
|
DEBUG: no valid constraints found
|
||||||
|
DEBUG: shard count: 4
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
count
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
3
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
-- a OR partkey IS NULL Uses all shards
|
||||||
|
SELECT count(*) FROM orders_hash_partitioned
|
||||||
|
WHERE o_orderkey = 1 OR o_orderkey IS NULL;
|
||||||
|
DEBUG: no valid constraints found
|
||||||
|
DEBUG: shard count: 4
|
||||||
|
DEBUG: Router planner cannot handle multi-shard select queries
|
||||||
|
DEBUG: no valid constraints found
|
||||||
|
DEBUG: shard count: 4
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
count
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
1
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
-- a OR partkey IS NOT NULL Uses all shards
|
||||||
|
SELECT count(*) FROM orders_hash_partitioned
|
||||||
|
WHERE o_orderkey = 1 OR o_orderkey IS NOT NULL;
|
||||||
|
DEBUG: no valid constraints found
|
||||||
|
DEBUG: shard count: 4
|
||||||
|
DEBUG: Router planner cannot handle multi-shard select queries
|
||||||
|
DEBUG: no valid constraints found
|
||||||
|
DEBUG: shard count: 4
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
count
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
4
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
SET client_min_messages TO DEFAULT;
|
||||||
|
|
|
@ -65,6 +65,10 @@ GROUP BY
|
||||||
ORDER BY
|
ORDER BY
|
||||||
l_partkey, o_orderkey;
|
l_partkey, o_orderkey;
|
||||||
DEBUG: Router planner does not support append-partitioned tables.
|
DEBUG: Router planner does not support append-partitioned tables.
|
||||||
|
DEBUG: no valid constraints found
|
||||||
|
DEBUG: shard count: 2
|
||||||
|
DEBUG: no valid constraints found
|
||||||
|
DEBUG: shard count: 2
|
||||||
DEBUG: join prunable for intervals [1,5986] and [8997,14947]
|
DEBUG: join prunable for intervals [1,5986] and [8997,14947]
|
||||||
DEBUG: join prunable for intervals [8997,14947] and [1,5986]
|
DEBUG: join prunable for intervals [8997,14947] and [1,5986]
|
||||||
DEBUG: generated sql query for task 1
|
DEBUG: generated sql query for task 1
|
||||||
|
@ -73,6 +77,8 @@ DEBUG: generated sql query for task 2
|
||||||
DETAIL: query string: "SELECT lineitem.l_partkey, orders.o_orderkey, lineitem.l_quantity, lineitem.l_extendedprice, orders.o_custkey FROM (lineitem_290001 lineitem JOIN orders_290003 orders ON ((lineitem.l_orderkey OPERATOR(pg_catalog.=) orders.o_orderkey))) WHERE ((lineitem.l_partkey OPERATOR(pg_catalog.<) 1000) AND (orders.o_totalprice OPERATOR(pg_catalog.>) 10.0))"
|
DETAIL: query string: "SELECT lineitem.l_partkey, orders.o_orderkey, lineitem.l_quantity, lineitem.l_extendedprice, orders.o_custkey FROM (lineitem_290001 lineitem JOIN orders_290003 orders ON ((lineitem.l_orderkey OPERATOR(pg_catalog.=) orders.o_orderkey))) WHERE ((lineitem.l_partkey OPERATOR(pg_catalog.<) 1000) AND (orders.o_totalprice OPERATOR(pg_catalog.>) 10.0))"
|
||||||
DEBUG: assigned task to node localhost:xxxxx
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
DEBUG: assigned task to node localhost:xxxxx
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
DEBUG: no valid constraints found
|
||||||
|
DEBUG: shard count: 2
|
||||||
DEBUG: join prunable for intervals [1,1000] and [6001,7000]
|
DEBUG: join prunable for intervals [1,1000] and [6001,7000]
|
||||||
DEBUG: join prunable for intervals [6001,7000] and [1,1000]
|
DEBUG: join prunable for intervals [6001,7000] and [1,1000]
|
||||||
DEBUG: generated sql query for task 2
|
DEBUG: generated sql query for task 2
|
||||||
|
@ -85,6 +91,8 @@ DEBUG: pruning merge fetch taskId 3
|
||||||
DETAIL: Creating dependency on merge taskId 6
|
DETAIL: Creating dependency on merge taskId 6
|
||||||
DEBUG: assigned task to node localhost:xxxxx
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
DEBUG: assigned task to node localhost:xxxxx
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
DEBUG: no valid constraints found
|
||||||
|
DEBUG: shard count: 3
|
||||||
DEBUG: join prunable for intervals [1,1000] and [1001,2000]
|
DEBUG: join prunable for intervals [1,1000] and [1001,2000]
|
||||||
DEBUG: join prunable for intervals [1,1000] and [6001,7000]
|
DEBUG: join prunable for intervals [1,1000] and [6001,7000]
|
||||||
DEBUG: join prunable for intervals [1001,2000] and [1,1000]
|
DEBUG: join prunable for intervals [1001,2000] and [1,1000]
|
||||||
|
@ -157,12 +165,16 @@ GROUP BY
|
||||||
ORDER BY
|
ORDER BY
|
||||||
l_partkey, o_orderkey;
|
l_partkey, o_orderkey;
|
||||||
DEBUG: Router planner does not support append-partitioned tables.
|
DEBUG: Router planner does not support append-partitioned tables.
|
||||||
|
DEBUG: no valid constraints found
|
||||||
|
DEBUG: shard count: 2
|
||||||
DEBUG: generated sql query for task 1
|
DEBUG: generated sql query for task 1
|
||||||
DETAIL: query string: "SELECT l_partkey, l_suppkey FROM lineitem_290000 lineitem WHERE (l_quantity OPERATOR(pg_catalog.<) 5.0)"
|
DETAIL: query string: "SELECT l_partkey, l_suppkey FROM lineitem_290000 lineitem WHERE (l_quantity OPERATOR(pg_catalog.<) 5.0)"
|
||||||
DEBUG: generated sql query for task 2
|
DEBUG: generated sql query for task 2
|
||||||
DETAIL: query string: "SELECT l_partkey, l_suppkey FROM lineitem_290001 lineitem WHERE (l_quantity OPERATOR(pg_catalog.<) 5.0)"
|
DETAIL: query string: "SELECT l_partkey, l_suppkey FROM lineitem_290001 lineitem WHERE (l_quantity OPERATOR(pg_catalog.<) 5.0)"
|
||||||
DEBUG: assigned task to node localhost:xxxxx
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
DEBUG: assigned task to node localhost:xxxxx
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
DEBUG: no valid constraints found
|
||||||
|
DEBUG: shard count: 2
|
||||||
DEBUG: generated sql query for task 1
|
DEBUG: generated sql query for task 1
|
||||||
DETAIL: query string: "SELECT o_orderkey, o_shippriority FROM orders_290002 orders WHERE (o_totalprice OPERATOR(pg_catalog.<>) 4.0)"
|
DETAIL: query string: "SELECT o_orderkey, o_shippriority FROM orders_290002 orders WHERE (o_totalprice OPERATOR(pg_catalog.<>) 4.0)"
|
||||||
DEBUG: generated sql query for task 2
|
DEBUG: generated sql query for task 2
|
||||||
|
@ -231,12 +243,16 @@ GROUP BY
|
||||||
ORDER BY
|
ORDER BY
|
||||||
o_orderkey;
|
o_orderkey;
|
||||||
DEBUG: Router planner does not support append-partitioned tables.
|
DEBUG: Router planner does not support append-partitioned tables.
|
||||||
|
DEBUG: no valid constraints found
|
||||||
|
DEBUG: shard count: 2
|
||||||
DEBUG: generated sql query for task 1
|
DEBUG: generated sql query for task 1
|
||||||
DETAIL: query string: "SELECT l_suppkey FROM lineitem_290000 lineitem WHERE true"
|
DETAIL: query string: "SELECT l_suppkey FROM lineitem_290000 lineitem WHERE true"
|
||||||
DEBUG: generated sql query for task 2
|
DEBUG: generated sql query for task 2
|
||||||
DETAIL: query string: "SELECT l_suppkey FROM lineitem_290001 lineitem WHERE true"
|
DETAIL: query string: "SELECT l_suppkey FROM lineitem_290001 lineitem WHERE true"
|
||||||
DEBUG: assigned task to node localhost:xxxxx
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
DEBUG: assigned task to node localhost:xxxxx
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
DEBUG: no valid constraints found
|
||||||
|
DEBUG: shard count: 2
|
||||||
DEBUG: generated sql query for task 1
|
DEBUG: generated sql query for task 1
|
||||||
DETAIL: query string: "SELECT o_orderkey, o_shippriority FROM orders_290002 orders WHERE true"
|
DETAIL: query string: "SELECT o_orderkey, o_shippriority FROM orders_290002 orders WHERE true"
|
||||||
DEBUG: generated sql query for task 2
|
DEBUG: generated sql query for task 2
|
||||||
|
@ -307,12 +323,16 @@ GROUP BY
|
||||||
ORDER BY
|
ORDER BY
|
||||||
o_orderkey;
|
o_orderkey;
|
||||||
DEBUG: Router planner does not support append-partitioned tables.
|
DEBUG: Router planner does not support append-partitioned tables.
|
||||||
|
DEBUG: no valid constraints found
|
||||||
|
DEBUG: shard count: 2
|
||||||
DEBUG: generated sql query for task 1
|
DEBUG: generated sql query for task 1
|
||||||
DETAIL: query string: "SELECT l_suppkey FROM lineitem_290000 lineitem WHERE true"
|
DETAIL: query string: "SELECT l_suppkey FROM lineitem_290000 lineitem WHERE true"
|
||||||
DEBUG: generated sql query for task 2
|
DEBUG: generated sql query for task 2
|
||||||
DETAIL: query string: "SELECT l_suppkey FROM lineitem_290001 lineitem WHERE true"
|
DETAIL: query string: "SELECT l_suppkey FROM lineitem_290001 lineitem WHERE true"
|
||||||
DEBUG: assigned task to node localhost:xxxxx
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
DEBUG: assigned task to node localhost:xxxxx
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
DEBUG: no valid constraints found
|
||||||
|
DEBUG: shard count: 2
|
||||||
DEBUG: generated sql query for task 1
|
DEBUG: generated sql query for task 1
|
||||||
DETAIL: query string: "SELECT o_orderkey, o_shippriority FROM orders_290002 orders WHERE true"
|
DETAIL: query string: "SELECT o_orderkey, o_shippriority FROM orders_290002 orders WHERE true"
|
||||||
DEBUG: generated sql query for task 2
|
DEBUG: generated sql query for task 2
|
||||||
|
@ -381,12 +401,16 @@ GROUP BY
|
||||||
ORDER BY
|
ORDER BY
|
||||||
o_orderkey;
|
o_orderkey;
|
||||||
DEBUG: Router planner does not support append-partitioned tables.
|
DEBUG: Router planner does not support append-partitioned tables.
|
||||||
|
DEBUG: no valid constraints found
|
||||||
|
DEBUG: shard count: 2
|
||||||
DEBUG: generated sql query for task 1
|
DEBUG: generated sql query for task 1
|
||||||
DETAIL: query string: "SELECT l_suppkey FROM lineitem_290000 lineitem WHERE true"
|
DETAIL: query string: "SELECT l_suppkey FROM lineitem_290000 lineitem WHERE true"
|
||||||
DEBUG: generated sql query for task 2
|
DEBUG: generated sql query for task 2
|
||||||
DETAIL: query string: "SELECT l_suppkey FROM lineitem_290001 lineitem WHERE true"
|
DETAIL: query string: "SELECT l_suppkey FROM lineitem_290001 lineitem WHERE true"
|
||||||
DEBUG: assigned task to node localhost:xxxxx
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
DEBUG: assigned task to node localhost:xxxxx
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
DEBUG: no valid constraints found
|
||||||
|
DEBUG: shard count: 2
|
||||||
DEBUG: generated sql query for task 1
|
DEBUG: generated sql query for task 1
|
||||||
DETAIL: query string: "SELECT o_orderkey, o_shippriority FROM orders_290002 orders WHERE true"
|
DETAIL: query string: "SELECT o_orderkey, o_shippriority FROM orders_290002 orders WHERE true"
|
||||||
DEBUG: generated sql query for task 2
|
DEBUG: generated sql query for task 2
|
||||||
|
@ -452,7 +476,13 @@ select s_i_id
|
||||||
group by s_i_id, s_w_id, s_quantity
|
group by s_i_id, s_w_id, s_quantity
|
||||||
having s_quantity > random()
|
having s_quantity > random()
|
||||||
;
|
;
|
||||||
|
DEBUG: no valid constraints found
|
||||||
|
DEBUG: shard count: 4
|
||||||
|
DEBUG: no valid constraints found
|
||||||
|
DEBUG: shard count: 4
|
||||||
DEBUG: Router planner cannot handle multi-shard select queries
|
DEBUG: Router planner cannot handle multi-shard select queries
|
||||||
|
DEBUG: no valid constraints found
|
||||||
|
DEBUG: shard count: 4
|
||||||
DEBUG: generated sql query for task 1
|
DEBUG: generated sql query for task 1
|
||||||
DETAIL: query string: "SELECT s_i_id, s_w_id, s_quantity FROM stock_690004 stock WHERE true"
|
DETAIL: query string: "SELECT s_i_id, s_w_id, s_quantity FROM stock_690004 stock WHERE true"
|
||||||
DEBUG: generated sql query for task 2
|
DEBUG: generated sql query for task 2
|
||||||
|
@ -465,6 +495,8 @@ DEBUG: assigned task to node localhost:xxxxx
|
||||||
DEBUG: assigned task to node localhost:xxxxx
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
DEBUG: assigned task to node localhost:xxxxx
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
DEBUG: assigned task to node localhost:xxxxx
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
DEBUG: no valid constraints found
|
||||||
|
DEBUG: shard count: 4
|
||||||
DEBUG: generated sql query for task 1
|
DEBUG: generated sql query for task 1
|
||||||
DETAIL: query string: "SELECT ol_i_id FROM order_line_690000 order_line WHERE true"
|
DETAIL: query string: "SELECT ol_i_id FROM order_line_690000 order_line WHERE true"
|
||||||
DEBUG: generated sql query for task 2
|
DEBUG: generated sql query for task 2
|
||||||
|
|
|
@ -18,8 +18,12 @@ FROM
|
||||||
WHERE
|
WHERE
|
||||||
o_custkey = c_custkey;
|
o_custkey = c_custkey;
|
||||||
DEBUG: Router planner does not support append-partitioned tables.
|
DEBUG: Router planner does not support append-partitioned tables.
|
||||||
|
DEBUG: no valid constraints found
|
||||||
|
DEBUG: shard count: 2
|
||||||
DEBUG: assigned task to node localhost:xxxxx
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
DEBUG: assigned task to node localhost:xxxxx
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
DEBUG: no valid constraints found
|
||||||
|
DEBUG: shard count: 3
|
||||||
DEBUG: join prunable for intervals [1,1000] and [1001,2000]
|
DEBUG: join prunable for intervals [1,1000] and [1001,2000]
|
||||||
DEBUG: join prunable for intervals [1,1000] and [6001,7000]
|
DEBUG: join prunable for intervals [1,1000] and [6001,7000]
|
||||||
DEBUG: join prunable for intervals [1001,2000] and [1,1000]
|
DEBUG: join prunable for intervals [1001,2000] and [1,1000]
|
||||||
|
@ -52,9 +56,13 @@ WHERE
|
||||||
o_custkey = c_custkey AND
|
o_custkey = c_custkey AND
|
||||||
o_orderkey = l_orderkey;
|
o_orderkey = l_orderkey;
|
||||||
DEBUG: Router planner does not support append-partitioned tables.
|
DEBUG: Router planner does not support append-partitioned tables.
|
||||||
|
DEBUG: no valid constraints found
|
||||||
|
DEBUG: shard count: 3
|
||||||
DEBUG: assigned task to node localhost:xxxxx
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
DEBUG: assigned task to node localhost:xxxxx
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
DEBUG: assigned task to node localhost:xxxxx
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
DEBUG: no valid constraints found
|
||||||
|
DEBUG: shard count: 2
|
||||||
DEBUG: join prunable for intervals [1,5986] and [8997,14947]
|
DEBUG: join prunable for intervals [1,5986] and [8997,14947]
|
||||||
DEBUG: join prunable for intervals [8997,14947] and [1,5986]
|
DEBUG: join prunable for intervals [8997,14947] and [1,5986]
|
||||||
DEBUG: pruning merge fetch taskId 1
|
DEBUG: pruning merge fetch taskId 1
|
||||||
|
@ -77,8 +85,12 @@ FROM
|
||||||
WHERE
|
WHERE
|
||||||
l_partkey = c_nationkey;
|
l_partkey = c_nationkey;
|
||||||
DEBUG: Router planner does not support append-partitioned tables.
|
DEBUG: Router planner does not support append-partitioned tables.
|
||||||
|
DEBUG: no valid constraints found
|
||||||
|
DEBUG: shard count: 2
|
||||||
DEBUG: assigned task to node localhost:xxxxx
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
DEBUG: assigned task to node localhost:xxxxx
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
DEBUG: no valid constraints found
|
||||||
|
DEBUG: shard count: 3
|
||||||
DEBUG: assigned task to node localhost:xxxxx
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
DEBUG: assigned task to node localhost:xxxxx
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
DEBUG: assigned task to node localhost:xxxxx
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
|
|
@ -70,6 +70,8 @@ SET client_min_messages TO DEBUG3;
|
||||||
SET citus.task_assignment_policy TO 'greedy';
|
SET citus.task_assignment_policy TO 'greedy';
|
||||||
EXPLAIN SELECT count(*) FROM task_assignment_test_table;
|
EXPLAIN SELECT count(*) FROM task_assignment_test_table;
|
||||||
DEBUG: Router planner does not support append-partitioned tables.
|
DEBUG: Router planner does not support append-partitioned tables.
|
||||||
|
DEBUG: no valid constraints found
|
||||||
|
DEBUG: shard count: 3
|
||||||
DEBUG: assigned task to node localhost:xxxxx
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
DEBUG: assigned task to node localhost:xxxxx
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
DEBUG: assigned task to node localhost:xxxxx
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
@ -82,6 +84,8 @@ DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
|
||||||
EXPLAIN SELECT count(*) FROM task_assignment_test_table;
|
EXPLAIN SELECT count(*) FROM task_assignment_test_table;
|
||||||
DEBUG: Router planner does not support append-partitioned tables.
|
DEBUG: Router planner does not support append-partitioned tables.
|
||||||
|
DEBUG: no valid constraints found
|
||||||
|
DEBUG: shard count: 3
|
||||||
DEBUG: assigned task to node localhost:xxxxx
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
DEBUG: assigned task to node localhost:xxxxx
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
DEBUG: assigned task to node localhost:xxxxx
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
@ -96,6 +100,8 @@ DEBUG: assigned task to node localhost:xxxxx
|
||||||
SET citus.task_assignment_policy TO 'first-replica';
|
SET citus.task_assignment_policy TO 'first-replica';
|
||||||
EXPLAIN SELECT count(*) FROM task_assignment_test_table;
|
EXPLAIN SELECT count(*) FROM task_assignment_test_table;
|
||||||
DEBUG: Router planner does not support append-partitioned tables.
|
DEBUG: Router planner does not support append-partitioned tables.
|
||||||
|
DEBUG: no valid constraints found
|
||||||
|
DEBUG: shard count: 3
|
||||||
DEBUG: assigned task to node localhost:xxxxx
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
DEBUG: assigned task to node localhost:xxxxx
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
DEBUG: assigned task to node localhost:xxxxx
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
@ -108,6 +114,8 @@ DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
|
||||||
EXPLAIN SELECT count(*) FROM task_assignment_test_table;
|
EXPLAIN SELECT count(*) FROM task_assignment_test_table;
|
||||||
DEBUG: Router planner does not support append-partitioned tables.
|
DEBUG: Router planner does not support append-partitioned tables.
|
||||||
|
DEBUG: no valid constraints found
|
||||||
|
DEBUG: shard count: 3
|
||||||
DEBUG: assigned task to node localhost:xxxxx
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
DEBUG: assigned task to node localhost:xxxxx
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
DEBUG: assigned task to node localhost:xxxxx
|
DEBUG: assigned task to node localhost:xxxxx
|
||||||
|
|
|
@ -32,6 +32,12 @@ CREATE TABLE orders_hash_partitioned (
|
||||||
o_comment varchar(79) );
|
o_comment varchar(79) );
|
||||||
SELECT create_distributed_table('orders_hash_partitioned', 'o_orderkey');
|
SELECT create_distributed_table('orders_hash_partitioned', 'o_orderkey');
|
||||||
|
|
||||||
|
INSERT INTO orders_hash_partitioned (o_orderkey, o_custkey, o_totalprice, o_shippriority, o_clerk) VALUES
|
||||||
|
(1, 11, 10, 111, 'aaa'),
|
||||||
|
(2, 22, 20, 222, 'bbb'),
|
||||||
|
(3, 33, 30, 333, 'ccc'),
|
||||||
|
(4, 44, 40, 444, 'ddd');
|
||||||
|
|
||||||
SET client_min_messages TO DEBUG2;
|
SET client_min_messages TO DEBUG2;
|
||||||
|
|
||||||
-- Check that we can prune shards for simple cases, boolean expressions and
|
-- Check that we can prune shards for simple cases, boolean expressions and
|
||||||
|
@ -68,13 +74,13 @@ SELECT count(*) FROM orders_hash_partitioned
|
||||||
SELECT count(*) FROM orders_hash_partitioned
|
SELECT count(*) FROM orders_hash_partitioned
|
||||||
WHERE o_orderkey = 1 OR o_clerk = 'aaa';
|
WHERE o_orderkey = 1 OR o_clerk = 'aaa';
|
||||||
SELECT count(*) FROM orders_hash_partitioned
|
SELECT count(*) FROM orders_hash_partitioned
|
||||||
WHERE o_orderkey = 1 OR (o_orderkey = 3 AND o_clerk = 'aaa');
|
WHERE o_orderkey = 1 OR (o_orderkey = 3 AND o_clerk = 'ccc');
|
||||||
SELECT count(*) FROM orders_hash_partitioned
|
SELECT count(*) FROM orders_hash_partitioned
|
||||||
WHERE o_orderkey = 1 OR o_orderkey is NULL;
|
WHERE o_orderkey = 1 OR o_orderkey is NULL;
|
||||||
SELECT count(*) FROM
|
SELECT count(*) FROM
|
||||||
(SELECT o_orderkey FROM orders_hash_partitioned WHERE o_orderkey = 1) AS orderkeys;
|
(SELECT o_orderkey FROM orders_hash_partitioned WHERE o_orderkey = 1) AS orderkeys;
|
||||||
|
|
||||||
SET client_min_messages TO DEFAULT;
|
SET client_min_messages TO DEBUG3;
|
||||||
|
|
||||||
-- Check that we support runing for ANY/IN with literal.
|
-- Check that we support runing for ANY/IN with literal.
|
||||||
SELECT count(*) FROM lineitem_hash_part
|
SELECT count(*) FROM lineitem_hash_part
|
||||||
|
@ -100,6 +106,13 @@ SELECT count(*) FROM lineitem_hash_part
|
||||||
SELECT count(*) FROM lineitem_hash_part WHERE l_orderkey IN (SELECT l_orderkey FROM lineitem_hash_part);
|
SELECT count(*) FROM lineitem_hash_part WHERE l_orderkey IN (SELECT l_orderkey FROM lineitem_hash_part);
|
||||||
SELECT count(*) FROM lineitem_hash_part WHERE l_orderkey = ANY (SELECT l_orderkey FROM lineitem_hash_part);
|
SELECT count(*) FROM lineitem_hash_part WHERE l_orderkey = ANY (SELECT l_orderkey FROM lineitem_hash_part);
|
||||||
|
|
||||||
|
-- Check whether we support range queries with append distributed table
|
||||||
|
SELECT count(*) FROM lineitem
|
||||||
|
WHERE l_orderkey >= 1 AND l_orderkey <= 3;
|
||||||
|
|
||||||
|
SELECT count(*) FROM lineitem
|
||||||
|
WHERE (l_orderkey >= 1 AND l_orderkey <= 3) AND (l_quantity > 11 AND l_quantity < 22);
|
||||||
|
|
||||||
-- Check whether we support IN/ANY in subquery with append and range distributed table
|
-- Check whether we support IN/ANY in subquery with append and range distributed table
|
||||||
SELECT count(*) FROM lineitem
|
SELECT count(*) FROM lineitem
|
||||||
WHERE l_orderkey = ANY ('{1,2,3}');
|
WHERE l_orderkey = ANY ('{1,2,3}');
|
||||||
|
@ -119,8 +132,6 @@ SELECT count(*) FROM lineitem_range
|
||||||
SELECT count(*) FROM lineitem_range
|
SELECT count(*) FROM lineitem_range
|
||||||
WHERE l_orderkey = ANY(NULL) OR TRUE;
|
WHERE l_orderkey = ANY(NULL) OR TRUE;
|
||||||
|
|
||||||
SET client_min_messages TO DEBUG2;
|
|
||||||
|
|
||||||
-- Check that we don't show the message if the operator is not
|
-- Check that we don't show the message if the operator is not
|
||||||
-- equality operator
|
-- equality operator
|
||||||
SELECT count(*) FROM orders_hash_partitioned
|
SELECT count(*) FROM orders_hash_partitioned
|
||||||
|
@ -129,15 +140,15 @@ SELECT count(*) FROM orders_hash_partitioned
|
||||||
-- Check that we don't give a spurious hint message when non-partition
|
-- Check that we don't give a spurious hint message when non-partition
|
||||||
-- columns are used with ANY/IN/ALL
|
-- columns are used with ANY/IN/ALL
|
||||||
SELECT count(*) FROM orders_hash_partitioned
|
SELECT count(*) FROM orders_hash_partitioned
|
||||||
WHERE o_orderkey = 1 OR o_totalprice IN (2, 5);
|
WHERE o_orderkey = 1 OR o_totalprice IN (20, 30);
|
||||||
|
|
||||||
-- Check that we cannot prune for mutable functions.
|
-- Check that we cannot prune for mutable functions.
|
||||||
|
|
||||||
SELECT count(*) FROM orders_hash_partitioned WHERE o_orderkey = random();
|
SELECT count(*) FROM orders_hash_partitioned WHERE o_orderkey = (random() + 100);
|
||||||
SELECT count(*) FROM orders_hash_partitioned
|
SELECT count(*) FROM orders_hash_partitioned
|
||||||
WHERE o_orderkey = random() OR o_orderkey = 1;
|
WHERE o_orderkey = (random() + 100) OR o_orderkey = 1;
|
||||||
SELECT count(*) FROM orders_hash_partitioned
|
SELECT count(*) FROM orders_hash_partitioned
|
||||||
WHERE o_orderkey = random() AND o_orderkey = 1;
|
WHERE o_orderkey = (random() + 100) AND o_orderkey = 1;
|
||||||
|
|
||||||
-- Check that we can do join pruning.
|
-- Check that we can do join pruning.
|
||||||
|
|
||||||
|
@ -150,3 +161,101 @@ SELECT count(*)
|
||||||
WHERE orders1.o_orderkey = orders2.o_orderkey
|
WHERE orders1.o_orderkey = orders2.o_orderkey
|
||||||
AND orders1.o_orderkey = 1
|
AND orders1.o_orderkey = 1
|
||||||
AND orders2.o_orderkey is NULL;
|
AND orders2.o_orderkey is NULL;
|
||||||
|
|
||||||
|
|
||||||
|
-- All shards used without constraints
|
||||||
|
SELECT count(*) FROM orders_hash_partitioned;
|
||||||
|
|
||||||
|
-- Shards restricted correctly with prunable constraint
|
||||||
|
SELECT count(*) FROM orders_hash_partitioned
|
||||||
|
WHERE o_orderkey = 1;
|
||||||
|
|
||||||
|
-- Shards restricted correctly with prunable constraint ANDed with unprunable expression using OR
|
||||||
|
SELECT count(*) FROM orders_hash_partitioned
|
||||||
|
WHERE o_orderkey = 1 AND (o_custkey = 11 OR o_custkey = 22);
|
||||||
|
|
||||||
|
-- Shards restricted correctly with prunable constraints ORed
|
||||||
|
SELECT count(*) FROM orders_hash_partitioned
|
||||||
|
WHERE (o_orderkey = 1 OR o_orderkey = 2);
|
||||||
|
|
||||||
|
-- Shards restricted correctly with prunable constraints ANDed with unprunable expression using OR
|
||||||
|
SELECT count(*) FROM orders_hash_partitioned
|
||||||
|
WHERE (o_orderkey = 1 OR o_orderkey = 2) AND (o_custkey = 11 OR o_custkey = 22);
|
||||||
|
|
||||||
|
-- Shards restricted correctly with many different prunable constraints ORed
|
||||||
|
SELECT count(*) FROM orders_hash_partitioned
|
||||||
|
WHERE (o_orderkey = 1 AND o_custkey = 11) OR (o_orderkey = 1 AND o_custkey = 33) OR (o_orderkey = 2 AND o_custkey = 22) OR (o_orderkey = 2 AND o_custkey = 44);
|
||||||
|
|
||||||
|
-- Shards restricted correctly with prunable SAO constraint ANDed with unprunable expression using OR
|
||||||
|
SELECT count(*) FROM orders_hash_partitioned
|
||||||
|
WHERE (o_orderkey IN (1,2)) AND (o_custkey = 11 OR o_custkey = 22 OR o_custkey = 33);
|
||||||
|
|
||||||
|
-- Shards restricted correctly with prunable SAO constraint ANDed with multiple unprunable expressions
|
||||||
|
SELECT count(*) FROM orders_hash_partitioned
|
||||||
|
WHERE (o_orderkey IN (1,2)) AND (o_totalprice < 11 OR o_totalprice > 19) AND o_shippriority > 100 AND (o_custkey = 11 OR o_custkey = 22);
|
||||||
|
|
||||||
|
-- Shards restricted correctly with prunable SAO constraints ORed
|
||||||
|
SELECT count(*) FROM orders_hash_partitioned
|
||||||
|
WHERE (o_orderkey IN (1,2) AND o_custkey = 11) OR (o_orderkey IN (2,3) AND o_custkey = 22);
|
||||||
|
|
||||||
|
-- All shards used with prunable expression ORed with unprunable expression
|
||||||
|
SELECT count(*) FROM orders_hash_partitioned
|
||||||
|
WHERE o_orderkey IN (1,2) OR o_custkey = 33;
|
||||||
|
|
||||||
|
-- Shards restricted correctly with prunable constraint ORed
|
||||||
|
SELECT count(*) FROM orders_hash_partitioned
|
||||||
|
WHERE o_orderkey = 1 OR ((o_orderkey = 2 AND o_custkey = 22) OR (o_orderkey = 3 AND o_custkey = 33));
|
||||||
|
|
||||||
|
-- Shards restricted correctly with prunable constraint ORed with falsy expression
|
||||||
|
SELECT count(*) FROM orders_hash_partitioned
|
||||||
|
WHERE o_orderkey = 1 OR (o_orderkey = 2 AND (o_custkey = 11 OR (o_orderkey = 3 AND o_custkey = 44)));
|
||||||
|
|
||||||
|
-- Shards restricted correctly with prunable SAO constraint ORed with prunable nested EQ constraint
|
||||||
|
SELECT count(*) FROM orders_hash_partitioned
|
||||||
|
WHERE (o_orderkey IN (1,2)) AND (o_custkey = 11 OR o_custkey = 22 OR o_custkey = 33) AND o_totalprice <= 20;
|
||||||
|
|
||||||
|
-- Shards restricted correctly with prunable SAO constraint ANDed with unprunable expressions
|
||||||
|
SELECT count(*) FROM orders_hash_partitioned
|
||||||
|
WHERE (o_orderkey IN (1,2)) AND (o_custkey = 11 OR o_custkey = 33) AND o_custkey = 22;
|
||||||
|
|
||||||
|
-- All shards used with prunable SAO constraint ORed with unprunable nested expression
|
||||||
|
SELECT count(*) FROM orders_hash_partitioned
|
||||||
|
WHERE ((o_orderkey IN (1,2)) AND (o_custkey = 11 OR o_custkey = 22)) OR o_custkey = 33;
|
||||||
|
|
||||||
|
-- Shards restricted correctly with prunable SAO constraint ORed with prunable nested EQ constraint
|
||||||
|
SELECT count(*) FROM orders_hash_partitioned
|
||||||
|
WHERE ((o_orderkey IN (1,2)) AND (o_custkey = 11 OR o_custkey = 22)) OR (o_orderkey = 3 AND o_custkey = 33);
|
||||||
|
|
||||||
|
-- All shards used with ORed top level unprunable expression
|
||||||
|
SELECT count(*) FROM orders_hash_partitioned
|
||||||
|
WHERE o_custkey = 11 OR (o_orderkey = 2 AND o_custkey = 22);
|
||||||
|
|
||||||
|
-- Single shard used when deeply nested prunable expression is restrictive with nested ANDs
|
||||||
|
SELECT count(*) FROM orders_hash_partitioned
|
||||||
|
WHERE o_orderkey = 1 OR (o_orderkey = 2 AND (o_orderkey = 3 OR (o_orderkey = 1 AND o_custkey = 11)));
|
||||||
|
|
||||||
|
-- Single shard used when top prunable expression is restrictive with nested ANDs
|
||||||
|
SELECT count(*) FROM orders_hash_partitioned
|
||||||
|
WHERE o_orderkey = 1 AND ((o_orderkey = 2 OR o_orderkey = 3) AND (o_custkey = 11 OR o_custkey = 22));
|
||||||
|
|
||||||
|
-- Deeply nested prunable expression affects used shards
|
||||||
|
SELECT count(*) FROM orders_hash_partitioned
|
||||||
|
WHERE o_orderkey = 1 OR ((o_orderkey = 2 OR o_orderkey = 3) AND (o_custkey = 22 OR o_custkey = 33));
|
||||||
|
|
||||||
|
-- Deeply nested non prunable expression uses all shards
|
||||||
|
SELECT count(*) FROM orders_hash_partitioned
|
||||||
|
WHERE o_orderkey = 1 OR ((o_orderkey = 2 OR o_custkey = 11) AND (o_custkey = 22 OR o_custkey = 33));
|
||||||
|
|
||||||
|
-- a OR partkey != x Uses all shards
|
||||||
|
SELECT count(*) FROM orders_hash_partitioned
|
||||||
|
WHERE o_orderkey = 1 OR o_orderkey != 2;
|
||||||
|
|
||||||
|
-- a OR partkey IS NULL Uses all shards
|
||||||
|
SELECT count(*) FROM orders_hash_partitioned
|
||||||
|
WHERE o_orderkey = 1 OR o_orderkey IS NULL;
|
||||||
|
|
||||||
|
-- a OR partkey IS NOT NULL Uses all shards
|
||||||
|
SELECT count(*) FROM orders_hash_partitioned
|
||||||
|
WHERE o_orderkey = 1 OR o_orderkey IS NOT NULL;
|
||||||
|
|
||||||
|
SET client_min_messages TO DEFAULT;
|
||||||
|
|
Loading…
Reference in New Issue