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.9 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-4), 64-bit
QUERY PLAN
ProjectSet (cost=0.08..5000.11 rows=1000000 width=36) (actual rows=1000000 loops=1)
  InitPlan 1 (returns $0)
    -> Result (cost=0.00..0.01 rows=1 width=32) (actual rows=1 loops=1)
  -> Aggregate (cost=0.07..0.08 rows=1 width=32) (actual rows=1 loops=1)
        -> Function Scan on unnest x (cost=0.00..0.07 rows=2 width=40) (actual rows=4 loops=1)
              Filter: (num > 1)
              Rows Removed by Filter: 1
Planning Time: 0.334 ms
Execution Time: 1027.829 ms
QUERY PLAN
ProjectSet (cost=0.00..5000.02 rows=1000000 width=36) (actual rows=1000000 loops=1)
  -> Result (cost=0.00..0.01 rows=1 width=0) (actual rows=1 loops=1)
Planning Time: 0.113 ms
Execution Time: 56.763 ms
QUERY PLAN
ProjectSet (cost=0.00..5000.02 rows=1000000 width=36) (actual rows=1000000 loops=1)
  -> Result (cost=0.00..0.01 rows=1 width=0) (actual rows=1 loops=1)
Planning Time: 0.051 ms
Execution Time: 56.646 ms
QUERY PLAN
ProjectSet (cost=0.00..5000.02 rows=1000000 width=36) (actual rows=1000000 loops=1)
  -> Result (cost=0.00..0.01 rows=1 width=0) (actual rows=1 loops=1)
Planning Time: 0.050 ms
Execution Time: 56.642 ms
QUERY PLAN
ProjectSet (cost=0.00..5000.02 rows=1000000 width=36) (actual rows=1000000 loops=1)
  -> Result (cost=0.00..0.01 rows=1 width=0) (actual rows=1 loops=1)
Planning Time: 0.124 ms
Execution Time: 56.749 ms
QUERY PLAN
ProjectSet (cost=0.00..5000.02 rows=1000000 width=36) (actual rows=1000000 loops=1)
  -> Result (cost=0.00..0.01 rows=1 width=0) (actual rows=1 loops=1)
Planning Time: 0.039 ms
Execution Time: 56.442 ms