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
topic_id | keyword |
---|---|
1 | basketball |
2 | music |
3 | food |
4 | war |
INSERT 0 4
CREATE TABLE
post_id | content |
---|---|
1 | A typhoon warning has been issued in southern Japan |
2 | We are going to play neither basketball nor volleyball |
3 | I am indulging in both the delightful music and delectable food |
4 | That basketball player fouled again |
5 | Basketballs stop wars! |
INSERT 0 5
post_id | topic |
---|---|
1 | Vague! |
2 | 1 |
3 | 2,3 |
4 | 1 |
5 | Vague! |
SELECT 5
CREATE INDEX
post_id | topics |
---|---|
1 | Vague! |
2 | 1 |
3 | 2,3 |
4 | 1 |
5 | Vague! |
SELECT 5
CREATE INDEX
post_id | topics |
---|---|
1 | Vague! |
2 | 1 |
3 | 2,3 |
4 | 1 |
5 | 1,4 |
SELECT 5