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?.
SELECT 100000
DELETE 9975
VACUUM
count count
10001 5
SELECT 1
lots few
2345 2
SELECT 1
CREATE INDEX
QUERY PLAN
Index Only Scan using tbl_lf_idx on tbl (cost=0.29..4.33 rows=2 width=8) (actual rows=1 loops=1)
  Index Cond: ((lots = 2345) AND (few = 2))
  Heap Fetches: 0
Planning Time: 0.221 ms
Execution Time: 0.094 ms
EXPLAIN
QUERY PLAN
Index Only Scan using tbl_lf_idx on tbl (cost=0.29..4.33 rows=2 width=8) (actual rows=1 loops=1)
  Index Cond: ((lots = 2345) AND (few = 2))
  Heap Fetches: 0
Planning Time: 0.086 ms
Execution Time: 0.032 ms
EXPLAIN
DROP INDEX
CREATE INDEX
QUERY PLAN
Index Only Scan using tbl_fl_idx on tbl (cost=0.29..4.33 rows=2 width=8) (actual rows=1 loops=1)
  Index Cond: ((few = 2) AND (lots = 2345))
  Heap Fetches: 0
Planning Time: 0.220 ms
Execution Time: 0.075 ms
EXPLAIN
QUERY PLAN
Index Only Scan using tbl_fl_idx on tbl (cost=0.29..4.33 rows=2 width=8) (actual rows=1 loops=1)
  Index Cond: ((few = 2) AND (lots = 2345))
  Heap Fetches: 0
Planning Time: 0.050 ms
Execution Time: 0.023 ms
EXPLAIN