Skip to content

executor: add TiCIVectorQueryInfo for hybrid vector queries#405

Open
kolafish wants to merge 1 commit intopingcap:masterfrom
kolafish:feature/tici-vector-query
Open

executor: add TiCIVectorQueryInfo for hybrid vector queries#405
kolafish wants to merge 1 commit intopingcap:masterfrom
kolafish:feature/tici-vector-query

Conversation

@kolafish
Copy link
Contributor

What problem does this PR solve?

Add TiCIVectorQueryInfo protobuf message to support TiCI hybrid index vector search.

Currently, vector search in TiDB uses the legacy ANN/columnar path (ANNQueryInfo). For hybrid indexes that contain both inverted and vector components, we need a dedicated query payload so the TiDB planner can push down vector top-k queries through the TiCI path, enabling combined vector + filter execution within a single TiCI query.

What changed and how does it work?

New message TiCIVectorQueryInfo in executor.proto:

  • index_id — the hybrid index containing the vector component
  • column_id — vector column ID (TiCI resolves vector sub-index by (column_id, distance_metric))
  • distance_metric — reuses existing VectorDistanceMetric enum (L2, COSINE, INNER_PRODUCT)
  • top_k — number of nearest neighbors to return
  • query_vector — query vector serialized as little-endian float32 bytes
  • dimension — dimensionality for validation
  • filter_expr — optional pushed-down filter expression (reuses tipb Expr)
  • column_name — for debug/explain output

IndexScan field 8: tici_vector_query_info, used alongside the existing fts_query_info (field 7). Only one should be set per scan.

TiFlashScanContext fields 200-205: TiCI vector scan metrics (query count, search time, filter time, candidate count, result count, shard count).

Check List

Tests

  • No need to test
    • Proto definition only; downstream consumers (TiDB, TiFlash) will add integration tests.

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

None

@kolafish
Copy link
Contributor Author

@wshwsh12 @ChangRui-Ryan @winoros PTAL

Add TiCIVectorQueryInfo protobuf message to support TiCI hybrid index
vector search. This enables TiDB planner to push down vector top-k
queries through the TiCI path instead of the legacy ANN path.

Changes:
- Add TiCIVectorQueryInfo message with index_id, column_id,
  distance_metric, top_k, query_vector, dimension, filter_expr,
  and column_name fields.
- Add tici_vector_query_info field to IndexScan (field 8).
- Add TiCI vector scan context metrics to TiFlashScanContext
  (fields 200-205).
- Regenerate Go code.
@kolafish kolafish force-pushed the feature/tici-vector-query branch from 5b61584 to a25a67b Compare March 17, 2026 11:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants