aboutsummaryrefslogtreecommitdiff
path: root/doc/src
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>2004-08-20 04:29:33 +0000
committerBruce Momjian <bruce@momjian.us>2004-08-20 04:29:33 +0000
commit09d4e96d7e957ae34263650498b279452fe95265 (patch)
treee4a06683989e5feef20c2848305799a18d1b4de5 /doc/src
parentdaa076c4fdd32aff597eda4c34347d488c5b1e3a (diff)
downloadpostgresql-09d4e96d7e957ae34263650498b279452fe95265.tar.gz
postgresql-09d4e96d7e957ae34263650498b279452fe95265.zip
Add ALTER INDEX, particularly for moving tablespaces.
Gavin Sherry
Diffstat (limited to 'doc/src')
-rw-r--r--doc/src/sgml/ref/alter_index.sgml188
1 files changed, 188 insertions, 0 deletions
diff --git a/doc/src/sgml/ref/alter_index.sgml b/doc/src/sgml/ref/alter_index.sgml
new file mode 100644
index 00000000000..3eaf0f7291f
--- /dev/null
+++ b/doc/src/sgml/ref/alter_index.sgml
@@ -0,0 +1,188 @@
+<!--
+$PostgreSQL: pgsql/doc/src/sgml/ref/alter_index.sgml,v 1.1 2004/08/20 04:29:32 momjian Exp $
+PostgreSQL documentation
+-->
+
+<refentry id="SQL-ALTERINDEX">
+ <refmeta>
+ <refentrytitle id="sql-alterindex-title">ALTER INDEX</refentrytitle>
+ <refmiscinfo>SQL - Language Statements</refmiscinfo>
+ </refmeta>
+
+ <refnamediv>
+ <refname>ALTER INDEX</refname>
+ <refpurpose>change the definition of an index</refpurpose>
+ </refnamediv>
+
+ <indexterm zone="sql-alterindex">
+ <primary>ALTER INDEX</primary>
+ </indexterm>
+
+ <refsynopsisdiv>
+<synopsis>
+ALTER INDEX <replaceable class="PARAMETER">name</replaceable>
+ <replaceable class="PARAMETER">action</replaceable> [, ... ]
+ALTER INDEX <replaceable class="PARAMETER">name</replaceable>
+ RENAME TO <replaceable class="PARAMETER">new_name</replaceable>
+
+where <replaceable class="PARAMETER">action</replaceable> is one of:
+
+ OWNER TO <replaceable class="PARAMETER">new_owner</replaceable>
+ SET INDEXSPACE <replaceable class="PARAMETER">indexspace_name</replaceable>
+</synopsis>
+ </refsynopsisdiv>
+
+ <refsect1>
+ <title>Description</title>
+
+ <para>
+ <command>ALTER INDEX</command> changes the definition of an existing index.
+ There are several subforms:
+
+ <variablelist>
+
+ <varlistentry>
+ <term><literal>OWNER</literal></term>
+ <listitem>
+ <para>
+ This form changes the owner of the index to the
+ specified user.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><literal>SET TABLESPACE</literal></term>
+ <listitem>
+ <para>
+ This form changes the index's tablespace to the specified tablespace and
+ moves the data file(s) associated with the index to the new tablespace.
+ See also
+ <xref linkend="SQL-CREATETABLESPACE" endterm="sql-createtablespace-title">.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><literal>RENAME</literal></term>
+ <listitem>
+ <para>
+ The <literal>RENAME</literal> forms change the name of the index.
+ There is no effect on the stored data.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ </variablelist>
+ </para>
+
+ <para>
+ All the actions except <literal>RENAME</literal> can be combined into
+ a list of multiple alterations to apply in parallel.
+ </para>
+
+ </refsect1>
+
+ <refsect1>
+ <title>Parameters</title>
+
+ <variablelist>
+
+ <varlistentry>
+ <term><replaceable class="PARAMETER">name</replaceable></term>
+ <listitem>
+ <para>
+ The name (possibly schema-qualified) of an existing index to
+ alter.
+ </para>
+ </listitem>
+ </varlistentry>
+
+
+ <varlistentry>
+ <term><replaceable class="PARAMETER">new_name</replaceable></term>
+ <listitem>
+ <para>
+ New name for the index.
+ </para>
+ </listitem>
+ </varlistentry>
+
+
+ <varlistentry>
+ <term><replaceable class="PARAMETER">new_owner</replaceable></term>
+ <listitem>
+ <para>
+ The user name of the new owner of the index.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><replaceable class="PARAMETER">tablespace_name</replaceable></term>
+ <listitem>
+ <para>
+ The tablespace name to which the index will be moved.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ </variablelist>
+ </refsect1>
+
+ <refsect1>
+ <title>Notes</title>
+
+ <para>
+ This same operations are supported by <literal>ALTER TABLE</>. See also
+ <xref linkend="SQL-ALTERTABLE" endterm="SQL-ALTERTABLE-TITLE">.
+ </para>
+
+ <para>
+ Changing any part of a system catalog index is not permitted.
+ </para>
+ </refsect1>
+
+ <refsect1>
+ <title>Examples</title>
+ <para>
+ To rename an existing index:
+<programlisting>
+ALTER INDEX distributors RENAME TO suppliers;
+</programlisting>
+ </para>
+
+ <para>
+ To move a index to a different tablespace:
+<programlisting>
+ALTER INDEX distributors SET TABLESPACE fasttablespace;
+</programlisting>
+ </para>
+
+ </refsect1>
+
+ <refsect1>
+ <title>Compatibility</title>
+
+ <para>
+ <literal>ALTER INDEX</> is a PostgreSQL extension.
+ </para>
+ </refsect1>
+</refentry>
+
+<!-- Keep this comment at the end of the file
+Local variables:
+mode: sgml
+sgml-omittag:nil
+sgml-shorttag:t
+sgml-minimize-attributes:nil
+sgml-always-quote-attributes:t
+sgml-indent-step:1
+sgml-indent-data:t
+sgml-parent-document:nil
+sgml-default-dtd-file:"../reference.ced"
+sgml-exposed-tags:nil
+sgml-local-catalogs:"/usr/lib/sgml/catalog"
+sgml-local-ecat-files:nil
+End:
+-->