Indexes and constraints in YugabyteDB YSQL

Indexes and constraints

Explore indexes and constraints in YSQL

As with tables, indexes in YugabyteDB are stored in a distributed manner - that is, they are split into tablets and replicated. Updates to indexes are transactional, which means that row updates and the corresponding index updates occur as a single transaction. Similar to tables, they are stored in LSM format, as opposed to the B-tree structure used by indexes in PostgreSQL.

YugabyteDB supports most of the PostgreSQL index semantics in the YSQL API.

The following table lists different types of indexes and their support in YSQL.

Type Description
Primary key Unique key that identifies the row
Foreign key Link to a column in another table
Secondary index Index on columns other than the primary key
Unique index Set one or many columns to be unique
Multi-column index Index on multiple columns for faster scan with lesser rows
Partial index Indexes that apply to only some rows of the table
Covering index Store other columns in the index for faster retrieval
Expression index Index based on a functional operation on columns
GIN index Generalized inverted index for fast text search
GIST Index For spatial search. Tracked - #1337

Learn more