Q43 PostgreSQL Domain 2 · 25–30% of exam Priority · Real Exam

A similarity query over 2 million rows runs as a sequential scan despite an HNSW index existing. What is the most likely cause?

  1. A The query uses a different distance operator than the index operator class (correct answer)
  2. B HNSW does not support large tables
  3. C The table needs VACUUM FULL
  4. D work_mem is too high

Shortcut: pgvector indexes are operator-class specific. Querying with <-> against an index built for cosine cannot use that index, so the planner falls back to a full scan.