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 12.14 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-16), 64-bit
SELECT 1
CREATE TABLE
CREATE TABLE
CREATE TABLE
INSERT 0 1
product_id product_name
1 P1
SELECT 1
order_id order_name
SELECT 0
product_id order_id
SELECT 0
CREATE PROCEDURE
DO
product_id product_name
1 P1
4 P2
6 P3
SELECT 3
order_id order_name
1 Oa
2 Ob
5 Oc
SELECT 3
product_id order_id
1 1
1 2
4 1
4 2
6 5
1 5
SELECT 6
order_name product_name
Oa P1
Oa P2
Ob P1
Ob P2
Oc P1
Oc P3
SELECT 6