clear markdown compare help best fiddles feedback dbanow.uk a leap of faith?
clear markdown donate comments/suggestions/bugs a leap of faith? bible365 diddy dollings
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0. 2335700 fiddles created (27456 in the last week).

CREATE TABLE t AS SELECT generate_series (1, 100000) t_id; ALTER TABLE t ADD PRIMARY KEY (t_id);
100000 rows affected
 hidden batch(es)


EXPLAIN ANALYZE SELECT t_id FROM t WHERE t_id IN (SELECT generate_series(1,103));
QUERY PLAN
Nested Loop (cost=17.81..1118.27 rows=50000 width=4) (actual time=3.585..3.759 rows=103 loops=1)
-> HashAggregate (cost=17.52..19.52 rows=200 width=4) (actual time=0.033..0.051 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.012 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.032..0.032 rows=1 loops=103)
Index Cond: (t_id = (generate_series(1, 103)))
Heap Fetches: 103
Planning time: 22.442 ms
Execution time: 6.139 ms
 hidden batch(es)


EXPLAIN ANALYZE SELECT t_id FROM t WHERE t_id IN (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);
QUERY PLAN
Bitmap Heap Scan on t (cost=378.93..637.38 rows=103 width=4) (actual time=0.473..0.479 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.466..0.466 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.525 ms
Execution time: 0.909 ms
 hidden batch(es)