By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
Help with an interesting Postgres question: Why isn't an Index Only Scan used on a partition accessed via the parent table?.
CREATE TABLE
line | a | b | c | d | e | f | g | h |
---|---|---|---|---|---|---|---|---|
1 | 18 | 2 | 2 | 22 | 0 | 2 | 1 | 2 |
2 | 20 | 2 | 2 | 2 | 0 | 0 | 0 | 2 |
3 | 10 | 2 | 2 | 222 | 0 | 2 | 1 | 2 |
4 | 12 | 2 | 2 | 3 | 0 | 0 | 0 | 0 |
5 | 15 | 2 | 2 | 3 | 0 | 0 | 0 | 0 |
INSERT 0 5
CREATE TABLE
line | criteria |
---|---|
1 | a,b |
2 | b,c,f,h |
3 | a,b,e,g,h |
4 | c,e |
INSERT 0 4
CREATE FUNCTION
t2_line | criteria | result |
---|---|---|
1 | a,b | 18,2 |
1 | a,b | 12,2 |
1 | a,b | 15,2 |
1 | a,b | 10,2 |
1 | a,b | 20,2 |
2 | b,c,f,h | 2,2,2,2 |
2 | b,c,f,h | 2,2,0,2 |
2 | b,c,f,h | 2,2,0,0 |
3 | a,b,e,g,h | 10,2,0,1,2 |
3 | a,b,e,g,h | 15,2,0,0,0 |
3 | a,b,e,g,h | 20,2,0,0,2 |
3 | a,b,e,g,h | 12,2,0,0,0 |
3 | a,b,e,g,h | 18,2,0,1,2 |
4 | c,e | 2,0 |
SELECT 14
t2_line | criteria | result |
---|---|---|
1 | a,b | 10,2 |
1 | a,b | 20,2 |
1 | a,b | 15,2 |
1 | a,b | 12,2 |
1 | a,b | 18,2 |
2 | b,c,f,h | 2,2,0,0 |
2 | b,c,f,h | 2,2,2,2 |
2 | b,c,f,h | 2,2,0,2 |
3 | a,b,e,g,h | 20,2,0,0,2 |
3 | a,b,e,g,h | 12,2,0,0,0 |
3 | a,b,e,g,h | 15,2,0,0,0 |
3 | a,b,e,g,h | 18,2,0,1,2 |
3 | a,b,e,g,h | 10,2,0,1,2 |
4 | c,e | 2,0 |
SELECT 14
t2_line | criteria | result |
---|---|---|
1 | a,b | 10,2 |
1 | a,b | 20,2 |
1 | a,b | 15,2 |
1 | a,b | 12,2 |
1 | a,b | 18,2 |
2 | b,c,f,h | 2,2,0,0 |
2 | b,c,f,h | 2,2,2,2 |
2 | b,c,f,h | 2,2,0,2 |
3 | a,b,e,g,h | 20,2,0,0,2 |
3 | a,b,e,g,h | 12,2,0,0,0 |
3 | a,b,e,g,h | 15,2,0,0,0 |
3 | a,b,e,g,h | 18,2,0,1,2 |
3 | a,b,e,g,h | 10,2,0,1,2 |
4 | c,e | 2,0 |
SELECT 14