v.21.8New Feature

Add FIRST keyword to ADD INDEX command in ClickHouse

Add the FIRST keyword to the ADD INDEX command to be able to add the index at the beginning of the indices list. #25904 (xjewer).
Added the FIRST keyword to the ADD INDEX command, allowing users to insert a new index at the beginning of the indices list in a table.

Why it matters

This feature addresses the need to control the position of an index within the indices list. By specifying FIRST, 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 the ADD 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;