add batch remove batch split batch comment selection show hidden batches hide batch highlight batch
db<>fiddle
donate feedback about
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?.
2 rows affected
6 rows affected
user_id amount
1 100
2 200
user_id due amount
1 2021-04-01 00:00:00 20
1 2021-04-02 00:00:00 20
1 2021-04-03 00:00:00 20
2 2021-04-01 00:00:00 100
2 2021-04-02 00:00:00 300
3 2021-04-03 00:00:00 20
user_id due amount available used remaining
1 2021-04-01 00:00:00 20 100 20 80
1 2021-04-02 00:00:00 20 80 20 60
1 2021-04-03 00:00:00 20 60 20 40
2 2021-04-01 00:00:00 100 200 100 100
2 2021-04-02 00:00:00 300 100 100 0
3 2021-04-03 00:00:00 20 0 0 0