Syntax
Indexes can be standard for accelerating lookups and sorts or vector indexes for similarity search in machine learning, AI applications, etc.Standard index syntax
Vector index syntax
Vector index is added in v2.6.0 and is in technical preview stage. Currently, we only support creating vector indexes on append-only inputs, such as append-only tables or materialized views.
Parameters
Backfill and isolation
When creating an index, RisingWave will backfill historical data from the indexed table or materialized view. Snapshot backfill is enabled by default to improve isolation between the backfill phase and streaming phase. This helps prevent resource contention between backfilling historical data and processing new streaming data. To disable it if needed, setSET streaming_use_snapshot_backfill=false; before creating the index. For more details, see View and configure runtime parameters.
In RisingWave Cloud, you can offload index backfill to dedicated serverless backfiller nodes. Enable it for the current session with SET enable_serverless_backfill = true; or for one statement with WITH (cloud.serverless_backfill_enabled = true). For setup and limitations, see Serverless backfilling.
Examples
Standard index
Let’s create two tables,customers and orders.
c_phone column in the customers table.
o_custkey column in the orders table.
Vector index
In an e-commerce platform, each product can be represented by an embedding vector that captures semantic features derived from its title and description. A vector index can then be used to recommend items similar to a user’s query.- Create a table with vector data. This stores product information along with a semantic embedding vector that represents its features.
- Build a vector index to enable fast similarity search. Include product attributes (name, description) in the index for direct retrieval.
- Given a query vector (e.g., representing “blue running shoes”), retrieve the top 5 most similar products.
Related topics
- RisingWave supports creating indexes on expressions. For more details, see Indexes on expressions.
- Standard indexes
- Vector indexes