1ALTER INDEX(7)                   SQL Commands                   ALTER INDEX(7)
2
3
4

NAME

6       ALTER INDEX - change the definition of an index
7
8

SYNOPSIS

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

DESCRIPTION

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

PARAMETERS

43       name   The  name  (possibly  schema-qualified)  of an existing index to
44              alter.
45
46       new_name
47              The new name for the index.
48
49       tablespace_name
50              The tablespace to which the index will be moved.
51
52       storage_parameter
53              The name of an index-method-specific storage parameter.
54
55       value  The new value for an  index-method-specific  storage  parameter.
56              This might be a number or a word depending on the parameter.
57

NOTES

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

EXAMPLES

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

COMPATIBILITY

89       ALTER INDEX is a PostgreSQL extension.
90

SEE ALSO

92       CREATE INDEX [create_index(7)], REINDEX [reindex(7)]
93
94
95
96SQL - Language Statements         2011-09-22                    ALTER INDEX(7)
Impressum