Repository navigation
Show vector index state and ClickHouse plans - #419
Draft
iskakaushik wants to merge 1 commit into
Draft
iskakaushik wants to merge 1 commit into
iskakaushik wants to merge 1 commit into
Conversation
iskakaushik
force-pushed
the
vector-index-state
branch
from
October 15, 2026 23:34
23481ee to
d513ca0
Compare
iskakaushik
force-pushed
the
vector-index-state
branch
from
October 15, 2026 23:40
d513ca0 to
e0c7ff6
Compare
iskakaushik
force-pushed
the
vector-index-state
branch
from
October 15, 2026 23:44
e0c7ff6 to
d4d8f7f
Compare
iskakaushik
force-pushed
the
vector-index-state
branch
2 times, most recently
from
October 16, 2026 17:01
2e68474 to
070f500
Compare
iskakaushik
force-pushed
the
vector-index-state
branch
from
October 19, 2026 15:02
070f500 to
d5a3d31
Compare
Add `clickhouse_vector_indexes()`, which lists the vector similarity indexes ClickHouse reports for a foreign table, with each index's definition, compressed size, and unfinished build mutations. Users can now see whether an index exists and whether ClickHouse has finished building it. It counts only mutations of the index itself, not those of indexes whose names start with its name, and rejects a table that is not a pg_clickhouse foreign table. Add `pg_clickhouse.explain_remote`. When on, `EXPLAIN` runs `EXPLAIN indexes = 1` on ClickHouse for each foreign scan and shows the result under "Remote Plan". That plan lists the indexes ClickHouse actually uses, including vector similarity indexes. This matters because the `Vector Index` line names an index ClickHouse can use, not one it must: with a `WHERE` condition, it may filter rows first and compare them exactly. Queries with parameters are not explained, since their remote SQL has no values. `ExplainIndentText()` is not exported before Postgres 18, so indent the remote plan directly.
iskakaushik
force-pushed
the
vector-index-state
branch
from
October 19, 2026 21:03
d5a3d31 to
98376d1
Compare
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
Two ways to see what ClickHouse does with vector indexes:
clickhouse_vector_indexes(regclass)lists a foreign table's vector similarity indexes, each with its column, definition, compressed size, and unfinished build mutations.pg_clickhouse.explain_remote(default off) adds ClickHouse's ownEXPLAIN indexes = 1plan toEXPLAIN, under "Remote Plan".Part of the vector search stack; it sits on #418.
Why
The
Vector Indexline from #414 names an index ClickHouse can use. With aWHEREcondition, ClickHouse may instead filter rows first and compare them exactly, for example when the condition matches the primary key. The benchmark in #424 showed exactly that for its filtered searches.explain_remoteshows the plan ClickHouse actually chooses.Notes for review
clickhouse_vector_indexes()is a C SRF insrc/vector_meta.cthat readssystem.data_skipping_indicesandsystem.mutations. It counts a mutation as pending only if it builds that exact index, not one whose name starts with the same text. It rejects a table that isn't a pg_clickhouse foreign table.explain_remoteruns on the scan's connection and supports everyEXPLAINformat. Queries with parameters are reported as unavailable, since their remote SQL has no values.ExplainIndentText()isn't exported before Postgres 18, so the plan text is indented directly.explain_remotefor the plan ClickHouse chooses.