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 1
INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 1
id sku date amount
1 A 2022-01-01 10
2 A 2022-01-02 10
3 A 2022-01-03 11
4 A 2022-01-04 11
5 B 2022-01-01 15
6 B 2022-01-02 20
7 B 2022-01-03 13
8 B 2022-01-04 12
9 C 2022-01-01 10
10 D 2022-01-01 35
11 D 2022-01-02 21
SELECT 11
sku first_in second_in third_in
B 17.5000000000000000 16.5000000000000000 12.5000000000000000
D 28.0000000000000000 21.0000000000000000 null
SELECT 2