A pgvector query over 2 million rows is slow. Which TWO changes are appropriate?
- A Create an HNSW index on the embedding column (correct answer)
- B Ensure the query's distance operator matches the index's operator class (correct answer)
- C Raise work_mem to 8 GB
- D Drop the primary key
- E Convert the embedding column to text
Shortcut: HNSW gives high recall with fast lookups at scale. Crucially, the index is only used when the query operator matches the operator class it was built with — an index built for cosine distance is ignored by an L2 query, which silently falls back to a sequential scan.