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?.
version
PostgreSQL 9.3.25 on x86_64-pc-linux-musl, compiled by gcc (Alpine 11.2.1_git20220219) 11.2.1 20220219, 64-bit
SELECT 1
INSERT 0 6
name id dimensionvalueid volume totals
A1 1 null null 700
A1:1 2 1 200 700
A1:1:1 3 2 200 500
A1:1:1:1 4 3 200 200
A1:1:1:2 5 3 100 100
B1 6 null null 200
B1:1 7 6 100 100
B1:2 8 6 100 100
B1:2:1 9 8 null null
SELECT 9
parent_child_tree id name dimensionvalueid level order_sequence volume totals
A1 1 A1 null 0 1 null 700
-----A1:1 2 A1:1 1 1 1_1 200 700
----------A1:1:1 3 A1:1:1 2 2 1_1_2 200 500
-----------A1:1:1:1 4 A1:1:1:1 3 3 1_1_2_3 200 200
-----------A1:1:1:2 5 A1:1:1:2 3 3 1_1_2_3 100 100
B1 6 B1 null 0 6 null 200
-----B1:1 7 B1:1 6 1 6_6 100 100
-----B1:2 8 B1:2 6 1 6_6 100 100
----------B1:2:1 9 B1:2:1 8 2 6_6_8 null null
SELECT 9