1ALTER INDEX(7)          PostgreSQL 9.2.24 Documentation         ALTER INDEX(7)
2
3
4

NAME

6       ALTER_INDEX - change the definition of an index
7

SYNOPSIS

9       ALTER INDEX [ IF EXISTS ] name RENAME TO new_name
10       ALTER INDEX [ IF EXISTS ] name SET TABLESPACE tablespace_name
11       ALTER INDEX [ IF EXISTS ] name SET ( storage_parameter = value [, ... ] )
12       ALTER INDEX [ IF EXISTS ] name RESET ( storage_parameter [, ... ] )
13

DESCRIPTION

15       ALTER INDEX changes the definition of an existing index. There are
16       several subforms:
17
18       RENAME
19           The RENAME form changes the name of the index. There is no effect
20           on the stored data.
21
22       SET TABLESPACE
23           This form changes the index's tablespace to the specified
24           tablespace and moves the data file(s) associated with the index to
25           the new tablespace. See also CREATE TABLESPACE
26           (CREATE_TABLESPACE(7)).
27
28       SET ( storage_parameter = value [, ... ] )
29           This form changes one or more index-method-specific storage
30           parameters for the index. See CREATE INDEX (CREATE_INDEX(7)) for
31           details on the available parameters. Note that the index contents
32           will not be modified immediately by this command; depending on the
33           parameter you might need to rebuild the index with REINDEX(7) to
34           get the desired effects.
35
36       RESET ( storage_parameter [, ... ] )
37           This form resets one or more index-method-specific storage
38           parameters to their defaults. As with SET, a REINDEX might be
39           needed to update the index entirely.
40

PARAMETERS

42       IF EXISTS
43           Do not throw an error if the index does not exist. A notice is
44           issued in this case.
45
46       name
47           The name (possibly schema-qualified) of an existing index to alter.
48
49       new_name
50           The new name for the index.
51
52       tablespace_name
53           The tablespace to which the index will be moved.
54
55       storage_parameter
56           The name of an index-method-specific storage parameter.
57
58       value
59           The new value for an index-method-specific storage parameter. This
60           might be a number or a word depending on the parameter.
61

NOTES

63       These operations are also possible using ALTER TABLE (ALTER_TABLE(7)).
64       ALTER INDEX is in fact just an alias for the forms of ALTER TABLE that
65       apply to indexes.
66
67       There was formerly an ALTER INDEX OWNER variant, but this is now
68       ignored (with a warning). An index cannot have an owner different from
69       its table's owner. Changing the table's owner automatically changes the
70       index as well.
71
72       Changing any part of a system catalog index is not permitted.
73

EXAMPLES

75       To rename an existing index:
76
77           ALTER INDEX distributors RENAME TO suppliers;
78
79       To move an index to a different tablespace:
80
81           ALTER INDEX distributors SET TABLESPACE fasttablespace;
82
83       To change an index's fill factor (assuming that the index method
84       supports it):
85
86           ALTER INDEX distributors SET (fillfactor = 75);
87           REINDEX INDEX distributors;
88

COMPATIBILITY

90       ALTER INDEX is a PostgreSQL extension.
91

SEE ALSO

93       CREATE INDEX (CREATE_INDEX(7)), REINDEX(7)
94
95
96
97PostgreSQL 9.2.24                 2017-11-06                    ALTER INDEX(7)
Impressum