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?.
setseed |
---|
SELECT 1
CREATE TABLE
CREATE TABLE
CREATE TABLE
INSERT 0 2000
INSERT 0 40000
INSERT 0 20000
ERROR: invalid reference to FROM-clause entry for table "r" LINE 8: where rts.route_id = r.route_id ^ DETAIL: There is an entry for table "r", but it cannot be referenced from this part of the query. HINT: To reference that table, you must mark this subquery with LATERAL.