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
n | x |
---|---|
1 | 0 |
2 | 1 |
3 | 2 |
4 | 3 |
5 | 4 |
6 | 2 |
7 | 1 |
8 | 0 |
9 | 1 |
10 | 0 |
11 | 0 |
12 | 0 |
13 | 0 |
14 | 1 |
15 | 2 |
16 | 3 |
17 | 4 |
INSERT 0 17
n | x | def |
---|---|---|
1 | 0 | 0 |
2 | 1 | 0 |
3 | 2 | 0 |
4 | 3 | 1 |
5 | 4 | 1 |
6 | 2 | 1 |
7 | 1 | 1 |
8 | 0 | 1 |
9 | 1 | 1 |
10 | 0 | 1 |
11 | 0 | 1 |
12 | 0 | 0 |
13 | 0 | 0 |
14 | 1 | 0 |
15 | 2 | 0 |
16 | 3 | 1 |
17 | 4 | 1 |
SELECT 17