9951 explained code solutions for 126 technologies


clickhouseHow to add index to table


ALTER TABLE tbl ADD INDEX col_index(col) TYPE minmax GRANULARITY 3ctrl + c
ALTER TABLE

change specified table

tbl

sample table to add index to

ADD INDEX

adds data skipping index

col_index

index name

col

column to index (can have multiple columns, separated by ,)

TYPE

index type

minmax

simple minmax index (the same type as primary key)

GRANULARITY

how many granules to store for each table granule (3 in our case)