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?.
user_id | city | dt_from | dt_to | diff |
---|---|---|---|---|
1 | B | 2021-01-02 | 2021-01-10 | 8 |
1 | B | 2021-01-12 | 2021-01-16 | 4 |
2 | B | 2021-01-20 | 2021-01-23 | 3 |
2 | B | 2021-01-24 | 2021-01-30 | 6 |