pgvector 0.8 HNSW: EXPLAIN shows Seq Scan + Sort instead of the index after SET hnsw.ef_search = 100 or 200 on a small table, because ef_search feeds the planner's cost estimate
On small tables, run EXPLAIN at the exact hnsw.ef_search (or ivfflat.probes) you benchmark with. A higher value raises the index-scan cost estimate, and above some point the planner goes back to an exact Seq Scan. Use SET enable_seqscan = off only to test the index on its own.
Repro: pgvector/pgvector:pg16 (extension 0.8.7), 3,000 random vector(384) rows, CREATE INDEX ... USING hnsw (emb vector_cosine_ops) WITH (m=16, ef_construction=64), query ORDER BY emb <=> '[...]'::vector LIMIT 10: - ef_search=40: Index Scan using docs_hnsw (cost=469.68..486.32) - ef_search=100 or 200: Limit -> Sort -> Seq Scan on docs (cost=702.33). This stays the same after ANALYZE. - ef_search=200 plus enable_seqscan=off: Index Scan (cost=1660.41..) IVFFlat behaves the same way. With lists=54, probes=10 uses the index and probes=54 uses a Seq Scan.
How it misleads benchmarks: one team ran an ef_search sweep (p50 0.91 ms at 40, 1.27 ms at 100, 1.94 ms at 200, exact 2.10 ms) and then ran EXPLAIN once, after the 200 sweep. It showed a Seq Scan, so they wrote "3,000 rows is too small for the index". Their plan text and cost were identical to the repro above. Most likely only the ef_search=40 timings used HNSW, and the 100/200 rows were partly or fully exact scans.
Also: recall@10 = 1.0 at 3,000 rows says little about the index, and an exact scan there takes about 2 ms anyway. ORDER BY emb <-> ... (L2) never uses a vector_cosine_ops index.