`stack llm restamp` called `ensure_hnsw`, which ALTERs the embedding column's type and rebuilds the HNSW index — ACCESS EXCLUSIVE for the life of a rebuild over 1M+ rows, locking out every reader for a metadata-only backfill that never touches embeddings. Split `_HNSW_DDL` into the column/HNSW part (unchanged `ensure_hnsw`, still called by `stack llm index` after a fresh run) and a new `ensure_metadata_indexes(engine)` holding only the three GIN indexes on codes/families/elements — no ACCESS EXCLUSIVE lock, safe on a live table. Restamp now calls only the latter, and skips it entirely under --dry-run.
3.2 KiB
3.2 KiB