v0: set enable_hashjoin=off; set enable_mergejoin=off; explain (ANALYZE,VERBOSE,COSTS,SETTINGS,BUFFERS,TIMING,MEMORY,IO) select count(*) from t_name_2 n2, t_name_1 n1 where n1.name = 'B' and n2.name = 'B' collate "case_insensitive"; QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------------------- Aggregate (cost=680.98..680.99 rows=1 width=8) (actual time=248.817..248.824 rows=1.00 loops=1) Output: count(*) Buffers: shared read=136 -> Nested Loop (cost=0.29..653.23 rows=11100 width=0) (actual time=2.344..236.425 rows=22200.00 loops=1) Buffers: shared read=136 -> Index Only Scan using idx_t_name_1 on public.t_name_1 n1 (cost=0.29..6.23 rows=111 width=0) (actual time=1.227..1.477 rows=111.00 loops=1) Output: n1.name Index Cond: (n1.name = 'B'::text) Heap Fetches: 0 Index Searches: 1 Buffers: shared read=3 -> Materialize (cost=0.00..508.50 rows=100 width=0) (actual time=0.010..1.993 rows=200.00 loops=111) Storage: Memory Maximum Storage: 24kB Buffers: shared read=133 -> Seq Scan on public.t_name_2 n2 (cost=0.00..508.00 rows=100 width=0) (actual time=1.076..212.332 rows=200.00 loops=1) Filter: (n2.name = 'B'::text COLLATE case_insensitive) Rows Removed by Filter: 29800 Prefetch: avg=7.69 max=16 capacity=94 I/O: count=12 waits=1 size=11.08 in-progress=1.00 Buffers: shared read=133 Settings: enable_hashjoin = 'off', enable_mergejoin = 'off' Planning: Buffers: shared hit=61 read=32 Memory: used=30kB allocated=64kB Planning Time: 28.829 ms Execution Time: 249.304 ms (26 rows) xman1=# set enable_hashjoin=off; set enable_mergejoin=off; set enable_material=off; explain (ANALYZE,VERBOSE,COSTS,SETTINGS,BUFFERS,TIMING,MEMORY,IO) select count(*) from t_name_2 n2, t_name_1 n1 where n1.name = 'B' and n2.name = 'B' collate "case_insensitive";