|
| 1 | +<!-- |
| 2 | +$PostgreSQL: pgsql/doc/src/sgml/ref/alter_index.sgml,v 1.1 2004/08/20 04:29:32 momjian Exp $ |
| 3 | +PostgreSQL documentation |
| 4 | +--> |
| 5 | + |
| 6 | +<refentry id="SQL-ALTERINDEX"> |
| 7 | + <refmeta> |
| 8 | + <refentrytitle id="sql-alterindex-title">ALTER INDEX</refentrytitle> |
| 9 | + <refmiscinfo>SQL - Language Statements</refmiscinfo> |
| 10 | + </refmeta> |
| 11 | + |
| 12 | + <refnamediv> |
| 13 | + <refname>ALTER INDEX</refname> |
| 14 | + <refpurpose>change the definition of an index</refpurpose> |
| 15 | + </refnamediv> |
| 16 | + |
| 17 | + <indexterm zone="sql-alterindex"> |
| 18 | + <primary>ALTER INDEX</primary> |
| 19 | + </indexterm> |
| 20 | + |
| 21 | + <refsynopsisdiv> |
| 22 | +<synopsis> |
| 23 | +ALTER INDEX <replaceable class="PARAMETER">name</replaceable> |
| 24 | + <replaceable class="PARAMETER">action</replaceable> [, ... ] |
| 25 | +ALTER INDEX <replaceable class="PARAMETER">name</replaceable> |
| 26 | + RENAME TO <replaceable class="PARAMETER">new_name</replaceable> |
| 27 | + |
| 28 | +where <replaceable class="PARAMETER">action</replaceable> is one of: |
| 29 | + |
| 30 | + OWNER TO <replaceable class="PARAMETER">new_owner</replaceable> |
| 31 | + SET INDEXSPACE <replaceable class="PARAMETER">indexspace_name</replaceable> |
| 32 | +</synopsis> |
| 33 | + </refsynopsisdiv> |
| 34 | + |
| 35 | + <refsect1> |
| 36 | + <title>Description</title> |
| 37 | + |
| 38 | + <para> |
| 39 | + <command>ALTER INDEX</command> changes the definition of an existing index. |
| 40 | + There are several subforms: |
| 41 | + |
| 42 | + <variablelist> |
| 43 | + |
| 44 | + <varlistentry> |
| 45 | + <term><literal>OWNER</literal></term> |
| 46 | + <listitem> |
| 47 | + <para> |
| 48 | + This form changes the owner of the index to the |
| 49 | + specified user. |
| 50 | + </para> |
| 51 | + </listitem> |
| 52 | + </varlistentry> |
| 53 | + |
| 54 | + <varlistentry> |
| 55 | + <term><literal>SET TABLESPACE</literal></term> |
| 56 | + <listitem> |
| 57 | + <para> |
| 58 | + This form changes the index's tablespace to the specified tablespace and |
| 59 | + moves the data file(s) associated with the index to the new tablespace. |
| 60 | + See also |
| 61 | + <xref linkend="SQL-CREATETABLESPACE" endterm="sql-createtablespace-title">. |
| 62 | + </para> |
| 63 | + </listitem> |
| 64 | + </varlistentry> |
| 65 | + |
| 66 | + <varlistentry> |
| 67 | + <term><literal>RENAME</literal></term> |
| 68 | + <listitem> |
| 69 | + <para> |
| 70 | + The <literal>RENAME</literal> forms change the name of the index. |
| 71 | + There is no effect on the stored data. |
| 72 | + </para> |
| 73 | + </listitem> |
| 74 | + </varlistentry> |
| 75 | + |
| 76 | + </variablelist> |
| 77 | + </para> |
| 78 | + |
| 79 | + <para> |
| 80 | + All the actions except <literal>RENAME</literal> can be combined into |
| 81 | + a list of multiple alterations to apply in parallel. |
| 82 | + </para> |
| 83 | + |
| 84 | + </refsect1> |
| 85 | + |
| 86 | + <refsect1> |
| 87 | + <title>Parameters</title> |
| 88 | + |
| 89 | + <variablelist> |
| 90 | + |
| 91 | + <varlistentry> |
| 92 | + <term><replaceable class="PARAMETER">name</replaceable></term> |
| 93 | + <listitem> |
| 94 | + <para> |
| 95 | + The name (possibly schema-qualified) of an existing index to |
| 96 | + alter. |
| 97 | + </para> |
| 98 | + </listitem> |
| 99 | + </varlistentry> |
| 100 | + |
| 101 | + |
| 102 | + <varlistentry> |
| 103 | + <term><replaceable class="PARAMETER">new_name</replaceable></term> |
| 104 | + <listitem> |
| 105 | + <para> |
| 106 | + New name for the index. |
| 107 | + </para> |
| 108 | + </listitem> |
| 109 | + </varlistentry> |
| 110 | + |
| 111 | + |
| 112 | + <varlistentry> |
| 113 | + <term><replaceable class="PARAMETER">new_owner</replaceable></term> |
| 114 | + <listitem> |
| 115 | + <para> |
| 116 | + The user name of the new owner of the index. |
| 117 | + </para> |
| 118 | + </listitem> |
| 119 | + </varlistentry> |
| 120 | + |
| 121 | + <varlistentry> |
| 122 | + <term><replaceable class="PARAMETER">tablespace_name</replaceable></term> |
| 123 | + <listitem> |
| 124 | + <para> |
| 125 | + The tablespace name to which the index will be moved. |
| 126 | + </para> |
| 127 | + </listitem> |
| 128 | + </varlistentry> |
| 129 | + |
| 130 | + </variablelist> |
| 131 | + </refsect1> |
| 132 | + |
| 133 | + <refsect1> |
| 134 | + <title>Notes</title> |
| 135 | + |
| 136 | + <para> |
| 137 | + This same operations are supported by <literal>ALTER TABLE</>. See also |
| 138 | + <xref linkend="SQL-ALTERTABLE" endterm="SQL-ALTERTABLE-TITLE">. |
| 139 | + </para> |
| 140 | + |
| 141 | + <para> |
| 142 | + Changing any part of a system catalog index is not permitted. |
| 143 | + </para> |
| 144 | + </refsect1> |
| 145 | + |
| 146 | + <refsect1> |
| 147 | + <title>Examples</title> |
| 148 | + <para> |
| 149 | + To rename an existing index: |
| 150 | +<programlisting> |
| 151 | +ALTER INDEX distributors RENAME TO suppliers; |
| 152 | +</programlisting> |
| 153 | + </para> |
| 154 | + |
| 155 | + <para> |
| 156 | + To move a index to a different tablespace: |
| 157 | +<programlisting> |
| 158 | +ALTER INDEX distributors SET TABLESPACE fasttablespace; |
| 159 | +</programlisting> |
| 160 | + </para> |
| 161 | + |
| 162 | + </refsect1> |
| 163 | + |
| 164 | + <refsect1> |
| 165 | + <title>Compatibility</title> |
| 166 | + |
| 167 | + <para> |
| 168 | + <literal>ALTER INDEX</> is a PostgreSQL extension. |
| 169 | + </para> |
| 170 | + </refsect1> |
| 171 | +</refentry> |
| 172 | + |
| 173 | +<!-- Keep this comment at the end of the file |
| 174 | +Local variables: |
| 175 | +mode: sgml |
| 176 | +sgml-omittag:nil |
| 177 | +sgml-shorttag:t |
| 178 | +sgml-minimize-attributes:nil |
| 179 | +sgml-always-quote-attributes:t |
| 180 | +sgml-indent-step:1 |
| 181 | +sgml-indent-data:t |
| 182 | +sgml-parent-document:nil |
| 183 | +sgml-default-dtd-file:"../reference.ced" |
| 184 | +sgml-exposed-tags:nil |
| 185 | +sgml-local-catalogs:"/usr/lib/sgml/catalog" |
| 186 | +sgml-local-ecat-files:nil |
| 187 | +End: |
| 188 | +--> |
0 commit comments