All Products
Search
Document Center

Lindorm:BUILD INDEX

Last Updated:Oct 23, 2024

In LindormTable 2.2.16 and later versions, you can use the BUILD INDEX syntax to individually build a secondary index.

Applicable engines and versions

The BUILD INDEX syntax is supported only by LindormTable whose version is later than 2.2.16 and is equal to or earlier than 2.6.3.

Note

The usage of the BUILD INDEX syntax is different in different versions of LindormTable.

  • In LindormTable whose version is later than 2.2.16 and is equal to or earlier than 2.6.3, you must execute the BUILD INDEX statement to separately build secondary indexes after you submit an asynchronous index building task.

  • In LindormTable whose version is later than 2.6.3, you do not need to execute the BUILD INDEX statement after you initiate a request to asynchronously build an index because the index creation rules are optimized in LindormTable.

Syntax

build_index_statement ::=  BUILD INDEX [ index_identifier ]
                                ON table_identifier

Usage notes

The number of index building tasks are limited.

  • Up to two concurrent index building tasks can be performed at the same time.

  • Only one index building task can be performed for a single table at the same time.

In conclusion, two index building tasks can be individually performed on two different tables at the same time.

Note

If two or more index building tasks are performed on a table at the same table, only the task that is first initiated can be successfully performed and other tasks fail. The INDEX_STATE value of the failed tasks is BUILDING, and the INDEX_PROGRESS value of the failed tasks is N/A. To manually initiate another index building task by using the BUILD INDEX syntax, you must wait until the first task is complete. In this case, the INDEX_STATE value of the successful task is ACTIVE, and the INDEX_PROGRESS value of the successful task is 100%.

Similarly, if two index building tasks are being individually performed on two different tables, other tasks initiated later than the two tasks fail until the two tasks are complete.

Index name (index_identifier)

The name of the index that you want to build. You can use the SHOW INDEX syntax to view all indexes of a table.

Table name (table_identifier)

The table for which you want to build the index.

Example

BUILD INDEX idx1 ON test;

Verify the result

You can run the SHOW INDEX FROM test; statement to check whether the index is built.