docs(collection): describe what create_index actually does - #119
Open
skritosss wants to merge 1 commit into
Open
docs(collection): describe what create_index actually does#119skritosss wants to merge 1 commit into
skritosss wants to merge 1 commit into
Conversation
The Note block described a multi-step process (clone table, copy rows, swap, rename) that the current implementation no longer performs. It also warned about dropping dependent views, which only applied to that older approach. Replaced it with what the method does today, plus the auto method selection rule, the n_lists formula, and the fact that CREATE INDEX is not concurrent.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What kind of change does this PR introduce?
Docs update. No functional change.
What is the current behavior?
The
Noteblock onCollection.create_indexdescribes a multi-step process: create a new table, sample rows into it, build the index there, copy everything over, drop the original, rename. It also warns that dependent views may need to be dropped first.The current implementation does none of that.
create_indexrunsdrop index(whenreplaceis true) and a singlecreate indexon the collection's own table.clone_table,from_selectandon_conflict_do_nothingno longer appear anywhere incollection.py.The stale warning about dependent views is the part most likely to mislead — the underlying table is not recreated, so views are unaffected.
What is the new behavior?
The Note describes what the method does today, plus three things worth knowing:
IndexMethod.autopicks between HNSW and IVFFlatn_listsformula used when noindex_argumentsare givenCREATE INDEXis not run concurrently, so writes are blocked for the duration of the buildAdditional context
Docstring only, no code touched — no new tests, coverage unaffected.
Noticed while looking at #10: the
create_indexhalf of that issue points at the copy loop that no longer exists, so a progress bar there would need a different approach — pollingpg_stat_progress_create_indexfrom a second connection, assuming pgvector fills in the counters for ivfflat/hnsw. Happy to open a separate issue for that if it's useful.Used Claude (Anthropic) to review the code and draft this change.