runtime

package
v0.0.0-debug-20260702 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 2, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package runtime holds the HNSW algorithm's catalog-side metadata. See pkg/vectorindex/ivfpq/plugin/runtime for the canonical template.

Index

Constants

View Source
const DefaultMaxIndexCapacity = int64(1000000)

DefaultMaxIndexCapacity mirrors the hnsw_max_index_capacity session-var default; the build path (hnsw_create) uses it when the flat algo_params key is absent (a legacy index created before the param was promoted).

View Source
const HnswIndexFlag = "experimental_hnsw_index"

HnswIndexFlag is the experimental-feature flag gating HNSW 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.

Variables

This section is empty.

Functions

This section is empty.

Types

type CatalogHooks

type CatalogHooks struct{}

func (CatalogHooks) AlterTableCloneBehavior

func (CatalogHooks) AlterTableCloneBehavior() catalogplugin.AlterTableCloneBehavior

AlterTableCloneBehavior — HNSW leaves both hidden tables empty at CREATE-INDEX time (data lands later via sync CROSS APPLY hnsw_create or async CDC), so no DELETE before clone is needed. The "skip clone when async" decision happens at the whole-index level (SyncDescriptor) rather than per table, so SkipWhenAsync stays empty here.

func (CatalogHooks) BuildSessionVars

func (CatalogHooks) BuildSessionVars() []string

BuildSessionVars returns nil — HNSW captures no session vars into algo_params, keeping its algo_params byte-compatible with pre-session_vars indexes. The index-defining max_index_capacity rides a flat algo_params key written by ParamsFromTree only when explicitly set in CREATE INDEX.

func (CatalogHooks) DefaultOptions

func (CatalogHooks) DefaultOptions() map[string]string

func (CatalogHooks) ExperimentalFlag

func (CatalogHooks) ExperimentalFlag() string

ExperimentalFlag: HNSW DDL is gated by HnswIndexFlag.

func (CatalogHooks) HiddenTableTypes

func (CatalogHooks) HiddenTableTypes() []string

func (CatalogHooks) ParamsFromTree

func (CatalogHooks) ParamsFromTree(idx *tree.Index) (map[string]string, error)

ParamsFromTree is lifted verbatim from catalog.indexParamsToMap's INDEX_TYPE_HNSW case (pkg/catalog/secondary_index_utils.go:341-375).

func (CatalogHooks) RestoreBehavior

func (CatalogHooks) RestoreBehavior() catalogplugin.RestoreBehavior

RestoreBehavior — HNSW's hidden tables (usearch Storage + Metadata) are keyed, 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 … hnsw FORCE_SYNC), run by the CDC's first iteration.

func (CatalogHooks) ShouldTruncateHiddenTable

func (CatalogHooks) ShouldTruncateHiddenTable(_ string) bool

ShouldTruncateHiddenTable — HNSW 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: this index has no INCLUDE-column support.

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: HNSW (usearch) indexes f32 or f64 vectors.

func (CatalogHooks) SyncDescriptor

func (CatalogHooks) SyncDescriptor() catalogplugin.SyncDescriptor

SyncDescriptor: HNSW is always async via ISCP CDC (matches the legacy hardcoded behaviour in pkg/sql/compile/iscp_util.go:68-71). No idxcron task.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL