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 | flag | updated_at | prev_flag | most_recent_updated_at |
---|---|---|---|---|
123 | 1 | 101 | null | 101 |
123 | 0 | 102 | 1 | 102 |
123 | 1 | 103 | 0 | 103 |
123 | 1 | 104 | 1 | 103 |
123 | 1 | 105 | 1 | 103 |
124 | 0 | 101 | null | 101 |
124 | 0 | 103 | 0 | 101 |
124 | 0 | 110 | 0 | 101 |
SELECT 8