v.21.8New Feature
Add FIRST keyword to ADD INDEX command in ClickHouse
Add theFIRSTkeyword to theADD INDEXcommand to be able to add the index at the beginning of the indices list. #25904 (xjewer).
Why it matters
This feature addresses the need to control the position of an index within the indices list. By specifyingFIRST, users can add a new index at the very start, which can affect query optimization and index priority.How to use it
When altering a table to add a new index, use theADD INDEX ... FIRST syntax to place the index at the beginning. For example:ALTER TABLE table_name ADD INDEX index_name (column) TYPE type() GRANULARITY 1 FIRST;