CertKeen

AWS Generative AI Developer Professional (AIP-C01) · Free practice question 12 of 12

pgvector iterative scans with filters

Hexley Realty's knowledge base uses Aurora PostgreSQL with pgvector and an HNSW index. Retrieval requests with selective metadata filters, such as one postcode, return far fewer results than requested even though matching chunks exist. Which change addresses this?

  1. A.Enable HNSW iterative index scans so filtered queries keep scanning
  2. B.Drop the GIN index on the custom metadata column so that filters run without an index
  3. C.Lower numberOfResults to one so that the filtered query always returns a full result set
  4. D.Switch the embeddings model to a version with more dimensions and re-embed all documents
Show answer and explanation

Correct answer: A. Enable HNSW iterative index scans so filtered queries keep scanning

Why: With pgvector, filtering is applied after the HNSW index scan, so selective filters can leave too few results; iterative index scans (pgvector 0.8.0 or later) keep scanning until enough filtered rows are found. Dropping the GIN index slows metadata filtering. Requesting one result hides the problem. Changing embedding dimensions does not alter how filters interact with the index scan.

More free AWS Generative AI Developer Professional (AIP-C01) questions