Changes the definition of an index.
ALTER INDEX <name> RENAME TO <new_name>
ALTER INDEX <name> SET TABLESPACE <tablespace_name>
ALTER INDEX <name> SET ( FILLFACTOR = <value> )
ALTER INDEX <name> RESET ( FILLFACTOR )
ALTER INDEX
changes the definition of an existing index. There are several subforms:
CREATE TABLESPACE
.FILLFACTOR
. The fillfactor for an index is a percentage that determines how full the index method will try to pack index pages. Index contents will not be modified immediately by this command. Use REINDEX
to rebuild the index to get the desired effects.FILLFACTOR
to the default. As with SET
, a REINDEX
may be needed to update the index entirely.The fillfactor for an index is a percentage that determines how full the index method will try to pack index pages. For B-trees, leaf pages are filled to this percentage during initial index build, and also when extending the index at the right (largest key values). If pages subsequently become completely full, they will be split, leading to gradual degradation in the index's efficiency.
These operations are also possible using ALTER TABLE
.
Changing any part of a system catalog index is not permitted.
To rename an existing index:
ALTER INDEX distributors RENAME TO suppliers;
To move an index to a different tablespace:
ALTER INDEX distributors SET TABLESPACE fasttablespace;
To change an index's fill factor (assuming that the index method supports it):
ALTER INDEX distributors SET (fillfactor = 75);
REINDEX INDEX distributors;
ALTER INDEX
is a Greenplum Database extension.
CREATE INDEX, REINDEX, ALTER TABLE
Parent topic: SQL Command Reference