<!--
doc/src/sgml/ref/alter_statistics.sgml
PostgreSQL documentation
-->

<refentry id="SQL-ALTERSTATISTICS">
 <indexterm zone="sql-alterstatistics">
  <primary>ALTER STATISTICS</primary>
 </indexterm>

 <refmeta>
  <refentrytitle>ALTER STATISTICS</refentrytitle>
  <manvolnum>7</manvolnum>
  <refmiscinfo>SQL - Language Statements</refmiscinfo>
 </refmeta>

 <refnamediv>
  <refname>ALTER STATISTICS</refname>
  <refpurpose>
   change the definition of a extended statistics
  </refpurpose>
 </refnamediv>

 <refsynopsisdiv>
<synopsis>
ALTER STATISTICS <replaceable class="parameter">name</replaceable> OWNER TO { <replaceable class="PARAMETER">new_owner</replaceable> | CURRENT_USER | SESSION_USER }
ALTER STATISTICS <replaceable class="parameter">name</replaceable> RENAME TO <replaceable class="parameter">new_name</replaceable>
ALTER STATISTICS <replaceable class="parameter">name</replaceable> SET SCHEMA <replaceable class="parameter">new_schema</replaceable>
</synopsis>
 </refsynopsisdiv>

 <refsect1>
  <title>Description</title>

  <para>
   <command>ALTER STATISTICS</command> changes the parameters of an existing
   extended statistics.  Any parameters not specifically set in the
   <command>ALTER STATISTICS</command> command retain their prior settings.
  </para>

  <para>
   You must own the statistics to use <command>ALTER STATISTICS</>.
   To change a statistics' schema, you must also have <literal>CREATE</>
   privilege on the new schema.
   To alter the owner, you must also be a direct or indirect member of the new
   owning role, and that role must have <literal>CREATE</literal> privilege on
   the statistics' schema.  (These restrictions enforce that altering the owner
   doesn't do anything you couldn't do by dropping and recreating the statistics.
   However, a superuser can alter ownership of any statistics anyway.)
  </para>
 </refsect1>

 <refsect1>
  <title>Parameters</title>

   <para>
    <variablelist>
     <varlistentry>
      <term><replaceable class="parameter">name</replaceable></term>
      <listitem>
       <para>
        The name (optionally schema-qualified) of the statistics to be altered.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term><replaceable class="PARAMETER">new_owner</replaceable></term>
      <listitem>
       <para>
        The user name of the new owner of the statistics.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term><replaceable class="parameter">new_name</replaceable></term>
      <listitem>
       <para>
        The new name for the statistics.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term><replaceable class="parameter">new_schema</replaceable></term>
      <listitem>
       <para>
        The new schema for the statistics.
       </para>
      </listitem>
     </varlistentry>

    </variablelist>
   </para>
  </refsect1>

 <refsect1>
  <title>Compatibility</title>

  <para>
   There's no <command>ALTER STATISTICS</command> command in the SQL standard.
  </para>
 </refsect1>

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

  <simplelist type="inline">
   <member><xref linkend="sql-createstatistics"></member>
   <member><xref linkend="sql-dropstatistics"></member>
  </simplelist>
 </refsect1>

</refentry>
