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?.
4 rows affected
3 rows affected
pk | columna | columnb | columnc | id |
---|---|---|---|---|
1 | 2022-06-05 | 1234 | 1 | 1 |
2 | 2022-06-05 | 1234 | 2 | 2 |
QUERY PLAN |
---|
Nested Loop Left Join (cost=1.22..10.29 rows=1 width=20) |
InitPlan 1 (returns $1) |
-> Aggregate (cost=1.05..1.06 rows=1 width=4) |
-> Seq Scan on tablea (cost=0.00..1.05 rows=1 width=4) |
Filter: (columnb = 1234) |
-> Seq Scan on tablea a (cost=0.00..1.05 rows=1 width=16) |
Filter: (columna = $1) |
-> Index Only Scan using tablex_pkey on tablex x (cost=0.15..8.17 rows=1 width=4) |
Index Cond: (id = a.columnc) |