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
name | price | qty | running purchased | running cost | next option | next price | next option |
---|---|---|---|---|---|---|---|
A | 3 | 30 | 30 | 90 | B | 5 | 3 |
B | 5 | 3 | 33 | 105 | C | 5 | 3 |
C | 5 | 3 | 36 | 120 | D | 6 | 20 |
D | 6 | 20 | 56 | 240 | null | null | null |
SELECT 4
name | price | qty | running purchased | running cost | next option | next price | next option | next purchased | next cost | total purchased | total spent | remaining money |
---|---|---|---|---|---|---|---|---|---|---|---|---|
A | 3 | 30 | 30 | 90 | B | 5 | 3 | 2 | 10 | 32 | 100 | 0 |
SELECT 1