Incorrect classification of deferred pruning
- Dominant language
- C
- Stars
- 12.8k
- Forks
- 794
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 31
Description
This is a minor bug, that doesn't seem to lead any issues. Could only be confusing for some users/devs.
```SQL
CREATE TABLE test_table (key int, value int);
SELECT create_distributed_table('test_table', 'key');
PREPARE parameter_on_value(int) AS SELECT count(*) FROM test_table WHERE value = $1 AND key = 1;
SET client_min_messages TO DEBUG;
EXECUTE parameter_on_value(1);
DEBUG: Deferred pruning for a fast-path router query
DEBUG: Creating router plan
DEBUG: Plan is router executable
┌───────┐
│ count │
├───────┤
│ 0 │
└───────┘
(1 row)
Time: 3.133 ms
```
But, that's a very specific case, depending on the order of the filters in the query. For example, this time the query is not deferred pruning since key filter comes before value
```SQL
PREPARE parameter_on_value(int) AS SELECT count(*) FROM test_table WHERE key = 1 AND value = $1;
EXECUTE parameter_on_value(1);
DEBUG: Distributed planning for a fast-path router query
DEBUG: Creating router plan
DEBUG: Plan is router executable
DETAIL: distribution column value: 1
┌───────┐
│ count │
├───────┤
│ 0 │
└───────┘
(1 row)
Time: 1.242 ms
```
Contributor guide
Assessment
This issue has not been assessed yet.