USING clause.
This page is the syntax reference. For how each index works, when to use it, and how to tune it, follow the link next to each form into Storage and indexing.
Aggregating indexes use a different grammar; see
CREATE AGGREGATING INDEX. To remove an index, see DROP INDEX.Syntax
| Parameter | Description |
|---|---|
<index_name> | Unique name for the index across all tables, indexes, and views in the database. |
<table_name> | The FACT or DIMENSION table to index. External tables are not supported. |
<method> | The index kind: SKIP_INDEX, INVERTED_INDEX, FULL_TEXT, or HNSW. |
<arguments>, <parameters> | Method-specific. See the forms below. |
SKIP_INDEX: data skipping (minmax)
Skips granules whose stored min/max range cannot match a comparison predicate. For mechanism and tuning, see Data skipping index.
| Parameter | Description |
|---|---|
<expression> | A column or scalar expression of a comparable type (INT, BIGINT, REAL, DOUBLE PRECISION, DECIMAL, DATE, TIMESTAMP, TIMESTAMPTZ, TEXT, BOOLEAN, BYTEA). ARRAY and STRUCT are not supported. |
TYPE | The index type. Only minmax is supported. Required. |
GRANULARITY | Positive integer: how many consecutive data granules share one min/max summary. Required. |
INVERTED_INDEX: exact token membership
Maps each token to the rows that contain it, accelerating has_all_tokens. For mechanism and tuning, see Inverted index.
| Parameter | Description |
|---|---|
<expression> | A column or scalar expression returning TEXT or ARRAY(TEXT). For ARRAY(TEXT), each element is indexed as a separate token. |
FULL_TEXT: substring search
Indexes overlapping n-grams to accelerate search, which is equivalent to LIKE '%pattern%'. For mechanism and tuning, see Full-text search index.
| Parameter | Description |
|---|---|
<column> | A TEXT column. Arbitrary expressions are not supported. |
ngram_size | Positive integer n-gram length. The shortest pattern that can use the index. Typical values are 2 to 4. Required. |
HNSW: vector search
Builds an HNSW graph for approximate nearest-neighbor search, queried with the vector_search() TVF. The HNSW form has its own parameter set, documented on CREATE VECTOR SEARCH INDEX. For mechanism and tuning, see Vector search index.
Index creation on populated tables
When you create an index on a table that already contains data, existing tablets carry no index data until they are rewritten. RunVACUUM with REINDEX=TRUE to backfill them. All subsequent inserts populate the index automatically.
See also
- Storage and indexing describes how indexes fit into the scan pipeline.
CREATE AGGREGATING INDEX,CREATE VECTOR SEARCH INDEX, andDROP INDEX.information_schema.indexeslists indexes and their on-disk sizes.