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?.
version |
---|
PostgreSQL 9.6.24 on x86_64-pc-linux-musl, compiled by gcc (Alpine 11.2.1_git20220219) 11.2.1 20220219, 64-bit |
SELECT 1
INSERT 0 5
person_id | datetime |
---|---|
1234 | 2016-04-01 00:00:00 |
1234 | 2016-05-04 00:00:00 |
9102 | 2018-05-17 00:00:00 |
5678 | 2019-09-01 00:00:00 |
1234 | 2016-04-01 00:00:00 |
SELECT 5
person_id | datetime | unique_combination_id |
---|---|---|
1234 | 2016-04-01 00:00:00 | 1 |
1234 | 2016-04-01 00:00:00 | 1 |
1234 | 2016-05-04 00:00:00 | 2 |
5678 | 2019-09-01 00:00:00 | 3 |
9102 | 2018-05-17 00:00:00 | 4 |
SELECT 5