ALTER INDEX v11

Name

ALTER INDEX -- modify an existing index.

Synopsis

Advanced Server supports two variations of the ALTER INDEX command compatible with Oracle databases. Use the first variation to rename an index:

ALTER INDEX <name> RENAME TO <new_name>

Use the second variation of the ALTER INDEX command to rebuild an index:

ALTER INDEX <name> REBUILD

Description

ALTER INDEX changes the definition of an existing index. The RENAME clause changes the name of the index. The REBUILD clause reconstructs an index, replacing the old copy of the index with an updated version based on the index's table.

The REBUILD clause invokes the PostgreSQL REINDEX command; for more information about using the REBUILD clause, see the PostgreSQL core documentation at:

https://www.postgresql.org/docs/11/static/sql-reindex.html

ALTER INDEX has no effect on stored data.

Parameters

name

The name (possibly schema-qualified) of an existing index.

new_name

New name for the index.

Examples

To change the name of an index from name_idx to empname_idx:

ALTER INDEX name_idx RENAME TO empname_idx;

To rebuild an index named empname_idx:

ALTER INDEX empname_idx REBUILD;

See Also

CREATE INDEX, DROP INDEX