Home Explore Blog CI



postgresql

2nd chunk of `doc/src/sgml/ref/alter_statistics.sgml`
9e72acc3f6c878814512c579234f5cc7d9504ae7b9d7ae1a0000000100000ca2
 <title>Description</title>

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

  <para>
   You must own the statistics object to use <command>ALTER STATISTICS</command>.
   To change a statistics object's schema, you must also
   have <literal>CREATE</literal> privilege on the new schema.
   To alter the owner, you must be able to <literal>SET ROLE</literal> to the
   new owning role, and that role must have <literal>CREATE</literal>
   privilege on the statistics object's schema.
   (These restrictions enforce that altering
   the owner doesn't do anything you couldn't do by dropping and recreating
   the statistics object.  However, a superuser can alter ownership of any
   statistics object 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 object 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 object.
       </para>
      </listitem>
     </varlistentry>

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

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

     <varlistentry>
      <term><replaceable class="parameter">new_target</replaceable></term>
      <listitem>
       <para>
        The statistic-gathering target for this statistics object for subsequent
        <link linkend="sql-analyze"><command>ANALYZE</command></link> operations.
        The target can be set in the range 0 to 10000.  Set it to
        <literal>DEFAULT</literal> to revert to using the system default
        statistics target (<xref linkend="guc-default-statistics-target"/>).
        (Setting to a value of -1 is an obsolete way spelling to get the same
        outcome.)
        For more information on the use of statistics by the
        <productname>PostgreSQL</productname> query planner, refer to
        <xref linkend="planner-stats"/>.
       </para>
      </listitem>
     </varlistentry>

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

 <refsect1>
  <title>Compatibility</title>

  <para>
   There is 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>

Title: ALTER STATISTICS: Description, Parameters, Compatibility, and See Also
Summary
This section details the ALTER STATISTICS command, explaining how it modifies extended statistics objects. It outlines necessary privileges for various alterations, such as owning the object, having CREATE privilege on the new schema, and being able to SET ROLE to the new owner. The section defines parameters like name, new_owner, new_name, new_schema, and new_target, explaining their roles in altering the statistics object. It notes the absence of this command in the SQL standard and provides references to related commands like CREATE STATISTICS and DROP STATISTICS.