Home Explore Blog CI



postgresql

4th chunk of `doc/src/sgml/ref/alter_index.sgml`
cd12f6a67d9f31a2044c4750c86083d7abbc2613bb5dbe470000000100000eeb
 exist. A notice is issued
        in this case.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term><replaceable class="parameter">column_number</replaceable></term>
      <listitem>
       <para>
        The ordinal number refers to the ordinal (left-to-right) position
        of the index column.
       </para>
      </listitem>
     </varlistentry>

     <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>
        The new name for the index.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term><replaceable class="parameter">tablespace_name</replaceable></term>
      <listitem>
       <para>
        The tablespace to which the index will be moved.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term><replaceable class="parameter">extension_name</replaceable></term>
      <listitem>
       <para>
        The name of the extension that the index is to depend on.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term><replaceable class="parameter">storage_parameter</replaceable></term>
      <listitem>
       <para>
        The name of an index-method-specific storage parameter.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term><replaceable class="parameter">value</replaceable></term>
      <listitem>
       <para>
        The new value for an index-method-specific storage parameter.
        This might be a number or a word depending on the parameter.
       </para>
      </listitem>
     </varlistentry>

    </variablelist>
 </refsect1>

 <refsect1>
  <title>Notes</title>

   <para>
    These operations are also possible using
    <link linkend="sql-altertable"><command>ALTER TABLE</command></link>.
    <command>ALTER INDEX</command> is in fact just an alias for the forms
    of <command>ALTER TABLE</command> that apply to indexes.
   </para>

   <para>
    There was formerly an <command>ALTER INDEX OWNER</command> variant, but
    this is now ignored (with a warning).  An index cannot have an owner
    different from its table's owner.  Changing the table's owner
    automatically changes the index as well.
   </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 an index to a different tablespace:
<programlisting>
ALTER INDEX distributors SET TABLESPACE fasttablespace;
</programlisting>
  </para>

  <para>
   To change an index's fill factor (assuming that the index method
   supports it):
<programlisting>
ALTER INDEX distributors SET (fillfactor = 75);
REINDEX INDEX distributors;
</programlisting></para>

  <para>
   Set the statistics-gathering target for an expression index:
<programlisting>
CREATE INDEX coord_idx ON measured (x, y, (z + t));
ALTER INDEX coord_idx ALTER COLUMN 3 SET STATISTICS 1000;
</programlisting></para>

 </refsect1>

 <refsect1>
  <title>Compatibility</title>

  <para>
   <command>ALTER INDEX</command> is a <productname>PostgreSQL</productname>
   extension.
  </para>
 </refsect1>


 <refsect1>
  <title>See Also</title>

  <simplelist type="inline">
   <member><xref linkend="sql-createindex"/></member>
   <member><xref linkend="sql-reindex"/></member>
  </simplelist>
 </refsect1>
</refentry>

Title: ALTER INDEX Parameters, Notes, Examples, and Compatibility
Summary
This section describes the remaining parameters for the ALTER INDEX command, including tablespace_name, extension_name, storage_parameter, and value. It notes that ALTER INDEX is an alias for ALTER TABLE when applied to indexes. It also provides examples of renaming an index, moving it to a different tablespace, changing its fill factor, and setting the statistics-gathering target for an expression index. Finally, it states that ALTER INDEX is a PostgreSQL extension and lists related commands like CREATE INDEX and REINDEX.