Home Explore Blog CI



postgresql

2nd chunk of `doc/src/sgml/ref/alter_index.sgml`
55fa17cb54a72890651578d10ccb126d7a634ffd144661a30000000100000fa0
 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.
      To change the tablespace of an index, you must own the index and have
      <literal>CREATE</literal> privilege on the new tablespace.
      All indexes in the current database in a tablespace can be moved by using
      the <literal>ALL IN TABLESPACE</literal> form, which will lock all
      indexes to be moved and then move each one.  This form also supports
      <literal>OWNED BY</literal>, which will only move indexes owned by the
      roles specified.  If the <literal>NOWAIT</literal> option is specified
      then the command will fail if it is unable to acquire all of the locks
      required immediately.  Note that system catalogs will not be moved by
      this command, use <command>ALTER DATABASE</command> or explicit
      <command>ALTER INDEX</command> invocations instead if desired.
      See also
      <link linkend="sql-createtablespace"><command>CREATE TABLESPACE</command></link>.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry>
    <term><literal>ATTACH PARTITION <replaceable class="parameter">index_name</replaceable></literal></term>
    <listitem>
     <para>
      Causes the named index (possibly schema-qualified) to become attached
      to the altered index.
      The named index must be on a partition of the table containing the
      index being altered, and have an equivalent definition.  An attached
      index cannot be dropped by itself, and will automatically be dropped
      if its parent index is dropped.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry>
    <term><literal>DEPENDS ON EXTENSION <replaceable class="parameter">extension_name</replaceable></literal></term>
    <term><literal>NO DEPENDS ON EXTENSION <replaceable class="parameter">extension_name</replaceable></literal></term>
    <listitem>
     <para>
      This form marks the index as dependent on the extension, or no longer
      dependent on that extension if <literal>NO</literal> is specified.
      An index that's marked as dependent on an extension is automatically
      dropped when the extension is dropped.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry>
    <term><literal>SET ( <replaceable class="parameter">storage_parameter</replaceable> [= <replaceable class="parameter">value</replaceable>] [, ... ] )</literal></term>
    <listitem>
     <para>
      This form changes one or more index-method-specific storage parameters
      for the index.  See
      <link linkend="sql-createindex"><command>CREATE INDEX</command></link>
      for details on the available parameters.  Note that the index contents
      will not be modified immediately by this command; depending on the
      parameter you might need to rebuild the index with
      <link linkend="sql-reindex"><command>REINDEX</command></link>
      to get the desired effects.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry>
    <term><literal>RESET ( <replaceable class="parameter">storage_parameter</replaceable> [, ... ] )</literal></term>
    <listitem>
     <para>
      This form resets one or more index-method-specific storage parameters to
      their defaults.  As with <literal>SET</literal>, a <literal>REINDEX</literal>
      might be needed to update the index entirely.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry>
    <term><literal>ALTER [ COLUMN ] <replaceable class="parameter">column_number</replaceable> SET STATISTICS <replaceable class="parameter">integer</replaceable></literal></term>
    <listitem>
     <para>
      This form sets the per-column statistics-gathering target for
      subsequent <link linkend="sql-analyze"><command>ANALYZE</command></link> operations, though can
      be used only on index columns that are defined as an expression.
     

Title: ALTER INDEX: Detailed Options for Modifying Index Definitions
Summary
This section describes specific options for the `ALTER INDEX` command, including changing the tablespace of an index, attaching an index to a partitioned table, managing dependencies on extensions, setting and resetting index-method-specific storage parameters, and altering statistics gathering for index columns defined as expressions. It also mentions the necessity of rebuilding the index using `REINDEX` in some cases to apply the changes fully.