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
CREATE TABLE
CREATE TABLE
id | name |
---|---|
1 | A |
2 | B |
3 | C |
4 | D |
INSERT 0 4
id | name |
---|---|
1 | Vegetarian |
2 | Vegan |
3 | Dog owner |
4 | Cat owner |
INSERT 0 4
id | user_id | color | flag_id | priority |
---|---|---|---|---|
1 | 1 | white | 1 | 1 |
2 | 1 | white | 3 | 2 |
3 | 1 | green | 1 | 1 |
4 | 1 | green | 3 | 2 |
5 | 1 | red | 4 | 1 |
6 | 2 | white | 1 | 1 |
7 | 2 | white | 3 | 2 |
8 | 2 | green | 1 | 1 |
9 | 2 | green | 3 | 2 |
10 | 3 | white | 1 | 2 |
11 | 3 | white | 3 | 1 |
12 | 3 | green | 1 | 1 |
13 | 3 | red | 3 | 1 |
14 | 4 | white | 1 | 1 |
15 | 4 | white | 3 | 2 |
16 | 4 | white | 4 | 3 |
INSERT 0 16