MP112WARNINGFreeNeeds --database-url
warn-hnsw-build-memory
What It Detects
HNSW build on a large table with a small maintenance_work_mem will spill and slow down sharply.
Why It's Dangerous
pgvector builds the HNSW graph in maintenance_work_mem. While the graph fits, the build is fast; once it does not, pgvector logs "hnsw graph no longer fits into maintenance_work_mem after N tuples" and finishes the rest on a much slower path. The statement is identical either way, which is what makes this hard to catch — a build that took minutes in staging can run for hours in production purely because the setting is lower there. The setting can be raised for the session that runs the build, so this is usually the cheapest fix available.
Bad Example
-- items has 8M rows; maintenance_work_mem is 64MB CREATE INDEX idx_items_embedding ON items USING hnsw (embedding vector_cosine_ops) WITH (m = 16, ef_construction = 64);
Good Example
-- Raise the limits for the session that builds the index, then run the -- CREATE INDEX in that same session. SET maintenance_work_mem = '8GB'; SET max_parallel_maintenance_workers = 7;
Configuration
Disable this rule:
# .migrationpilotrc.yml rules: MP112: false
Or change its severity:
# .migrationpilotrc.yml
rules:
MP112:
severity: warning