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?.
CREATE TABLE
CREATE TABLE
CREATE TABLE
INSERT 0 5
INSERT 0 7
INSERT 0 4
id | date_time | sender_uname | amount_sent | sender_updated_balance | receiver_uname | amount_received | receiver_updated_balance |
---|---|---|---|---|---|---|---|
1 | 2023-01-01 | u1 | 100 | 900 | u2 | 100 | 1100 |
2 | 2023-01-03 | u1 | 100 | 800 | u3 | 100 | 1100 |
3 | 2023-01-04 | u4 | 100 | 900 | u1 | 100 | 900 |
4 | 2023-01-05 | u1 | 100 | 800 | u5 | 100 | 1100 |
SELECT 4