Indexes and constraints
Explore indexes and constraints in YCQL
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.
The sharding of indexes is based on the primary key of the index and is independent of how the main table is sharded/distributed. Indexes are not colocated with the base table.
The YCQL API supports most of the Cassandra index semantics while incorporating other improvements.
The following table lists different types of indexes and their support in YCQL.
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 |