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?.
d | row_number | date_part |
---|---|---|
2023-12-28 | 1 | 4 |
2023-12-29 | 2 | 5 |
2023-12-30 | 3 | 6 |
2023-12-31 | 4 | 0 |
2024-01-01 | 5 | 1 |
2024-01-02 | 6 | 2 |
2024-01-03 | 7 | 3 |
2024-01-04 | 8 | 4 |
2024-01-05 | 9 | 5 |
2024-01-06 | 10 | 6 |
2024-01-07 | 11 | 0 |
2024-01-08 | 12 | 1 |
2024-01-09 | 13 | 2 |
SELECT 13
d | row_number | date_part |
---|---|---|
2023-12-27 | 0 | 3 |
2023-12-28 | 1 | 4 |
2023-12-29 | 2 | 5 |
2023-12-30 | 3 | 6 |
2023-12-31 | 4 | 0 |
2024-01-01 | 5 | 1 |
2024-01-02 | 6 | 2 |
2024-01-03 | 7 | 3 |
2024-01-04 | 8 | 4 |
2024-01-05 | 9 | 5 |
2024-01-06 | 10 | 6 |
2024-01-07 | 11 | 0 |
2024-01-08 | 12 | 1 |
2024-01-09 | 13 | 2 |
SELECT 14
d | row_number | date_part |
---|---|---|
2023-12-27 | 0 | 3 |
2023-12-26 | -1 | 2 |
2023-12-25 | -2 | 1 |
2023-12-24 | -3 | 0 |
2023-12-23 | -4 | 6 |
2023-12-22 | -5 | 5 |
2023-12-21 | -6 | 4 |
2023-12-20 | -7 | 3 |
2023-12-19 | -8 | 2 |
2023-12-18 | -9 | 1 |
2023-12-17 | -10 | 0 |
2023-12-16 | -11 | 6 |
2023-12-15 | -12 | 5 |
2023-12-14 | -13 | 4 |
SELECT 14