Indexes

Index commands are used to create, build, inspect, and drop indexes on Lakehouse tables to accelerate specific query patterns.


Index Types

Lakehouse provides three index types — choose based on your query pattern:

Index TypeApplicable QueriesTypical Use Case
Bloom Filter IndexEquality filters on high-cardinality columns (=, IN)Queries by user ID, order number, phone number
Inverted IndexFull-text search on text fields, supports Chinese tokenizationLog search, comment retrieval, keyword matching
Vector IndexVector similarity search (ANN)Semantic search, image similarity, recommendation systems

In This Chapter

PageDescription
Bloom Filter IndexBloom filter principles, creation, and usage
CREATE BLOOMFILTER INDEXFull syntax for creating a bloom filter index
Inverted IndexInverted index principles, analyzer configuration, and usage
CREATE INVERTED INDEXFull syntax for creating an inverted index
Vector IndexVector search principles, index types, and usage
CREATE VECTOR INDEXFull syntax for creating a vector index
BUILD INDEXBuild an index for existing data
DESC INDEXView index details
DROP INDEXDrop an index
SHOW INDEXList all indexes on a table

Common Operations

Create a Bloom Filter Index

-- Create a bloom filter on a high-cardinality column to accelerate equality queries CREATE BLOOMFILTER INDEX idx_user_id ON TABLE orders(user_id);

Create an Inverted Index

-- Create an inverted index on a text column to support full-text search CREATE INVERTED INDEX idx_content ON TABLE app_logs(content) PROPERTIES('analyzer' = 'chinese');

Build an Index for Existing Data

-- A new index does not cover historical data; trigger a build manually BUILD INDEX idx_content ON app_logs;

View and Drop Indexes

-- List all indexes on a table SHOW INDEX IN orders; -- Drop an index DROP INDEX idx_user_id;


DocumentDescription
SQL Commands OverviewCategorized navigation for all SQL commands
Index Usage GuideComplete examples for creating and validating indexes by scenario
Full-Text Search GuideDetailed usage of inverted index full-text search
Lakehouse Index Best PracticesIndex selection, maintenance, and performance tuning recommendations