MP109WARNINGFree

require-vector-index-params

What It Detects

pgvector HNSW or IVFFlat index created without explicit build parameters.

Why It's Dangerous

These are build-time decisions and they are expensive to revisit. For HNSW, m and ef_construction set the shape of the graph and therefore the recall ceiling, and the defaults are conservative. For IVFFlat, lists decides how the vectors are clustered, and pgvector ties the right value to the row count — rows / 1000 up to a million rows, sqrt(rows) beyond that — so a default that ignores the row count is wrong at scale in one direction or the other. Changing any of them later means rebuilding the whole index.

Bad Example

CREATE INDEX idx_items_embedding ON items USING hnsw (embedding vector_cosine_ops);

CREATE INDEX idx_docs_embedding ON documents USING ivfflat (embedding vector_l2_ops);

Good Example

CREATE INDEX idx_items_embedding ON items
  USING hnsw (embedding vector_cosine_ops)
  WITH (m = 16, ef_construction = 128);

-- lists sized to the data: 4M rows -> sqrt(4,000,000) = 2,000
CREATE INDEX idx_docs_embedding ON documents
  USING ivfflat (embedding vector_l2_ops)
  WITH (lists = 2000);

Configuration

Disable this rule:

# .migrationpilotrc.yml
rules:
  MP109: false

Or change its severity:

# .migrationpilotrc.yml
rules:
  MP109:
    severity: warning