Open Source RDBMS - Seamless, Scalable, Stable and Free

한국어 | Login |Register

Versions available for this page: CUBRID 8.3.0 |  CUBRID 8.3.1 |  CUBRID 8.4.0 |  CUBRID 8.4.1 |  CUBRID 8.4.3 |  CUBRID 9.0.0 | 

ALTER INDEX

Description

The ALTER INDEX statement rebuilds an index. In other words, it drops and rebuilds an index. If a table name and a column name are added at the end of the ON clause, a new index is re-created with the table and column names.

Syntax

ALTER [ REVERSE ] [ UNIQUE ] INDEX index_name

ON { ONLY } table_name <index_col_desc> REBUILD [ ; ]

 

<index_col_desc> ::=

    ( column_name[ {, column_name} ...] ) [ WHERE <filter_predicate> ]

    | (function_name (argument_list) )

  • REVERSE: Creates an index in the reverse order. A reverse index helps to increase sorting speed in descending order.
  • UNIQUE: Creates an index with unique values.
  • index_name: Specifies the name of the index to be recreated. The index name must be unique in the table.
  • table_name: Specifies the name of the table where the index is to be recreated.
  • column_name: Specifies the name of the column where the index is to be applied. To create a multiple column index, specify two or more column names.
  • <filter_predicate>: Defines the conditions to create filtered indexes. When there are several comparison conditions between a column and a constant, filtering is available only when the conditions are connected by using AND.
  • function_name (argument_list): Defines the conditions to create function-based indexes.

Note In versions lower than CUBRID 9.0, index names can be deleted; however, from the CUBRID 9.0 version, it is no longer supported.

Example

The following is an example of re-creating indexes in various ways:

ALTER INDEX i_game_medal ON game(medal) REBUILD;

ALTER INDEX game_date_idx REBUILD;

ALTER INDEX char_idx ON athlete(gender, nation_code) WHERE gender='M' AND nation_code='USA' REBUILD;