Documentation
¶
Overview ¶
Package runtime holds the CAGRA algorithm's catalog-side metadata. See pkg/vectorindex/ivfpq/plugin/runtime for the canonical template.
Index ¶
- Constants
- type CatalogHooks
- func (CatalogHooks) AlterTableCloneBehavior() catalogplugin.AlterTableCloneBehavior
- func (CatalogHooks) BuildSessionVars() []string
- func (CatalogHooks) DefaultOptions() map[string]string
- func (CatalogHooks) ExperimentalFlag() string
- func (CatalogHooks) HiddenTableTypes() []string
- func (CatalogHooks) ParamsFromTree(idx *tree.Index) (map[string]string, error)
- func (CatalogHooks) RestoreBehavior() catalogplugin.RestoreBehavior
- func (CatalogHooks) ShouldTruncateHiddenTable(_ string) bool
- func (CatalogHooks) SupportedIncludeColumnTypes() []types.T
- func (CatalogHooks) SupportedOpTypes() map[string]string
- func (CatalogHooks) SupportedPrimaryKeyTypes() []types.T
- func (CatalogHooks) SupportedVectorTypes() []types.T
- func (CatalogHooks) SyncDescriptor() catalogplugin.SyncDescriptor
Constants ¶
const CagraIndexFlag = "experimental_cagra_index"
CagraIndexFlag is the experimental-feature flag gating CAGRA DDL. Single source of truth; both the catalog gate (pkg/sql/compile/util.go via ExperimentalFlag) and the per-plugin HandleCreateIndex gate reference this constant.
const DefaultMaxIndexCapacity = int64(0)
DefaultMaxIndexCapacity mirrors the cagra_max_index_capacity session-var default; the build path (cagra_create) uses it when the flat algo_params key is absent (a legacy index). 0 means "auto-detect from source row count".
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CatalogHooks ¶
type CatalogHooks struct{}
CatalogHooks implements plugin/catalog.Hooks for CAGRA.
func (CatalogHooks) AlterTableCloneBehavior ¶
func (CatalogHooks) AlterTableCloneBehavior() catalogplugin.AlterTableCloneBehavior
AlterTableCloneBehavior — CAGRA leaves both hidden tables empty at CREATE-INDEX time. Mirrors HNSW.
func (CatalogHooks) BuildSessionVars ¶
func (CatalogHooks) BuildSessionVars() []string
BuildSessionVars are the environmental/perf vars captured into algo_params.session_vars at CREATE INDEX (cagra_* threads, lower_case for name resolution). CAGRA does NOT train k-means; its index-defining max_index_capacity rides a flat algo_params key written by ParamsFromTree only when explicitly set in CREATE INDEX. The experimental flag is NOT captured: the background reindex (ProcessInitSQL, IsFrontend=false) skips the experimental gate, so its create-time value is never consulted.
func (CatalogHooks) DefaultOptions ¶
func (CatalogHooks) DefaultOptions() map[string]string
func (CatalogHooks) ExperimentalFlag ¶
func (CatalogHooks) ExperimentalFlag() string
ExperimentalFlag: CAGRA DDL is gated by CagraIndexFlag.
func (CatalogHooks) HiddenTableTypes ¶
func (CatalogHooks) HiddenTableTypes() []string
func (CatalogHooks) ParamsFromTree ¶
ParamsFromTree is lifted verbatim from catalog.indexParamsToMap's INDEX_TYPE_CAGRA case (pkg/catalog/secondary_index_utils.go:376-433).
func (CatalogHooks) RestoreBehavior ¶
func (CatalogHooks) RestoreBehavior() catalogplugin.RestoreBehavior
RestoreBehavior — CAGRA's hidden tables (Storage tag=0 model blob + Metadata) are keyed by index_id, so the restore's block-level clone overwrites the CreateTable seed rather than appending — nothing needs delete-before-clone (empty DeleteBeforeClone). The model is rebuilt post-clone by the compile hook's RestoreInitSQL (ALTER … REINDEX … cagra FORCE_SYNC), run by the CDC's first iteration.
func (CatalogHooks) ShouldTruncateHiddenTable ¶
func (CatalogHooks) ShouldTruncateHiddenTable(_ string) bool
ShouldTruncateHiddenTable — CAGRA has no preserved-across-truncate state; both hidden tables are derived from source rows and must reset.
func (CatalogHooks) SupportedIncludeColumnTypes ¶
func (CatalogHooks) SupportedIncludeColumnTypes() []types.T
SupportedIncludeColumnTypes: cuvs INCLUDE (pre-filter) columns accept int32/int64/float32/float64 scalars.
func (CatalogHooks) SupportedOpTypes ¶
func (CatalogHooks) SupportedOpTypes() map[string]string
func (CatalogHooks) SupportedPrimaryKeyTypes ¶
func (CatalogHooks) SupportedPrimaryKeyTypes() []types.T
SupportedPrimaryKeyTypes: requires an int64 primary key.
func (CatalogHooks) SupportedVectorTypes ¶
func (CatalogHooks) SupportedVectorTypes() []types.T
SupportedVectorTypes: CAGRA (cuvs) indexes f32 vectors only.
func (CatalogHooks) SyncDescriptor ¶
func (CatalogHooks) SyncDescriptor() catalogplugin.SyncDescriptor
SyncDescriptor: CAGRA is always async via ISCP CDC (event-level deltas) AND participates in idxcron (periodic model rebuild). The initial cagra_create build runs via the CDC pipeline's InitSQL on first iteration; subsequent source-table mutations stream in as tag=1 events (see pkg/vectorindex/cagra/sync.go). When the user sets auto_update=true, the idxcron task fires on the configured day/hour cadence to refresh tag=0.
IdxcronListsAware=false: CAGRA has no nlist / training-sample concept, so the executor's checkIndexUpdatable skips the IVF-FLAT heuristic and just enforces "lastUpdateAt + interval < now".