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?.
3 rows affected
id | created_date | created_time |
---|---|---|
1 | 2020-05-27 | 1000 |
2 | 2020-05-27 | 23456 |
3 | 2020-05-27 | 84000 |
id | created_date | created_time | created_at |
---|---|---|---|
2 | 2020-05-27 | 23456 | 2020-05-27 06:30:56 |
3 | 2020-05-27 | 84000 | 2020-05-27 23:20:00 |
QUERY PLAN |
---|
Index Scan using multicolumn_created on mycustomers (cost=0.13..8.15 rows=1 width=12) (actual time=0.021..0.022 rows=2 loops=1) |
Index Cond: (ROW(created_date, created_time) > ROW('2020-05-27'::date, 2208)) |
Planning Time: 0.058 ms |
Execution Time: 0.046 ms |
id | created_at |
---|---|
2 | 2020-05-27 06:30:56 |
3 | 2020-05-27 23:20:00 |
QUERY PLAN |
---|
Index Scan using simple_created on mycustomers (cost=0.13..8.15 rows=1 width=12) (actual time=0.007..0.009 rows=2 loops=1) |
Index Cond: (created_at > '2020-05-27 00:36:48.131509'::timestamp without time zone) |
Planning Time: 0.039 ms |
Execution Time: 0.022 ms |