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
ALTER TABLE
QUERY PLAN
Nested Loop (cost=17.81..1118.27 rows=50000 width=4) (actual time=0.132..0.326 rows=103 loops=1)
  -> HashAggregate (cost=17.52..19.52 rows=200 width=4) (actual time=0.034..0.055 rows=103 loops=1)
        Group Key: generate_series(1, 103)
        -> ProjectSet (cost=0.00..5.02 rows=1000 width=4) (actual time=0.004..0.013 rows=103 loops=1)
              -> Result (cost=0.00..0.01 rows=1 width=0) (actual time=0.001..0.001 rows=1 loops=1)
  -> Index Only Scan using t_pkey on t (cost=0.29..6.53 rows=1 width=4) (actual time=0.002..0.002 rows=1 loops=103)
        Index Cond: (t_id = (generate_series(1, 103)))
        Heap Fetches: 103
Planning time: 0.721 ms
Execution time: 7.797 ms
EXPLAIN
QUERY PLAN
Bitmap Heap Scan on t (cost=378.93..637.38 rows=103 width=4) (actual time=0.268..0.656 rows=103 loops=1)
  Recheck Cond: (t_id = ANY ('{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103}'::integer[]))
  Heap Blocks: exact=1
  -> Bitmap Index Scan on t_pkey (cost=0.00..378.90 rows=103 width=0) (actual time=0.254..0.254 rows=103 loops=1)
        Index Cond: (t_id = ANY ('{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103}'::integer[]))
Planning time: 0.150 ms
Execution time: 2.774 ms
EXPLAIN