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
id | number |
---|---|
1 | 1 |
2 | 2 |
3 | 2 |
4 | 3 |
5 | 4 |
6 | 4 |
7 | 4 |
8 | 5 |
9 | 13 |
10 | 13 |
11 | 17 |
INSERT 0 11
id | number |
---|---|
3 | 2 |
6 | 4 |
7 | 4 |
10 | 13 |
SELECT 4
number |
---|
6 |
7 |
8 |
9 |
10 |
11 |
12 |
14 |
15 |
16 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
SELECT 20
DO
id | number |
---|---|
1 | 1 |
2 | 2 |
4 | 3 |
5 | 4 |
8 | 5 |
3 | 6 |
6 | 7 |
7 | 8 |
9 | 13 |
10 | 14 |
11 | 17 |
SELECT 11