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?.
WITH C (id,end_time)
AS
(
SELECT 1,'2019-01-01' UNION ALL
SELECT 2,'2020-01-01' UNION ALL
SELECT 3,'2019-07-01'
),
F(id,parent_id)
AS
(
SELECT 12,1 UNION ALL
SELECT 13,1 UNION ALL

SELECT 21,2 UNION ALL
SELECT 22,2 UNION ALL

SELECT 31,3 UNION ALL
SELECT 32,3 UNION ALL
SELECT 33,3 UNION ALL
SELECT 34,3
),
oui (rel_id,Product_Version)
AS
(
SELECT 1,'2' UNION ALL
SELECT 12,'2' UNION ALL
SELECT 13,'1' UNION ALL
SELECT 2,'1' UNION ALL
SELECT 21,'2' UNION ALL
SELECT 22,'1' UNION ALL
SELECT 3,'2' UNION ALL
SELECT 31,'1' UNION ALL
SELECT 32,'1' UNION ALL
SELECT 33,'1' UNION ALL
SELECT 34,'1'
)
id
3
SELECT 1