On 25.07.2017 01:15, David G. Johnston wrote:
ALTER TABLE ids ALTER COLUMN id SET NOT NULL; EXPLAIN (ANALYZE, BUFFERS) SELECT count(*) FROM ids WHERE id IN :values_clause; Aggregate (cost=245006.46..245006.47 rows=1 width=8) (actual time=3824.095..3824.095 rows=1 loops=1) Buffers: shared hit=44248 -> Hash Join (cost=7.50..235006.42 rows=4000019 width=0) (actual time=1.108..3327.112 rows=3998646 loops=1) ... Hmmm. No Semi-Join. PostgreSQL can use Semi-Join for IN too. |