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?.
CREATE TABLE
INSERT 0 4
id fifo_cumul lifo_cumul
1 5 25
2 8 20
3 17 17
4 25 8
SELECT 4
id stock_item_id quantity received fifo_running lifo_running
1 1 5 2023-08-01 00:00:00 0 20
2 1 3 2023-08-02 00:00:00 5 17
3 1 9 2023-08-03 00:00:00 8 8
SELECT 3
id stock_item_id quantity received fifo_running lifo_running
3 1 9 2023-08-03 00:00:00 8 8
4 1 8 2023-08-04 00:00:00 17 0
SELECT 2