| 1 |
<!-- |
| 2 |
doc/src/sgml/ref/alter_statistics.sgml |
| 3 |
PostgreSQL documentation |
| 4 |
--> |
| 5 |
|
| 6 |
<refentry id="sql-alterstatistics"> |
| 7 |
<indexterm zone="sql-alterstatistics"> |
| 8 |
<primary>ALTER STATISTICS</primary> |
| 9 |
</indexterm> |
| 10 |
|
| 11 |
<refmeta> |
| 12 |
<refentrytitle>ALTER STATISTICS</refentrytitle> |
| 13 |
<manvolnum>7</manvolnum> |
| 14 |
<refmiscinfo>SQL - Language Statements</refmiscinfo> |
| 15 |
</refmeta> |
| 16 |
|
| 17 |
<refnamediv> |
| 18 |
<refname>ALTER STATISTICS</refname> |
| 19 |
<refpurpose> |
| 20 |
change the definition of an extended statistics object |
| 21 |
</refpurpose> |
| 22 |
</refnamediv> |
| 23 |
|
| 24 |
<refsynopsisdiv> |
| 25 |
<synopsis> |
| 26 |
ALTER STATISTICS <replaceable class="parameter">name</replaceable> OWNER TO { <replaceable class="parameter">new_owner</replaceable> | CURRENT_ROLE | CURRENT_USER | SESSION_USER } |
| 27 |
ALTER STATISTICS <replaceable class="parameter">name</replaceable> RENAME TO <replaceable class="parameter">new_name</replaceable> |
| 28 |
ALTER STATISTICS <replaceable class="parameter">name</replaceable> SET SCHEMA <replaceable class="parameter">new_schema</replaceable> |
| 29 |
ALTER STATISTICS <replaceable class="parameter">name</replaceable> SET STATISTICS { <replaceable class="parameter">new_target</replaceable> | DEFAULT } |
| 30 |
</synopsis> |
| 31 |
</refsynopsisdiv> |
| 32 |
|
| 33 |
<refsect1> |
| 34 |
<title>Description</title> |
| 35 |
|
| 36 |
<para> |
| 37 |
<command>ALTER STATISTICS</command> changes the parameters of an existing |
| 38 |
extended statistics object. Any parameters not specifically set in the |
| 39 |
<command>ALTER STATISTICS</command> command retain their prior settings. |
| 40 |
</para> |
| 41 |
|
| 42 |
<para> |
| 43 |
You must own the statistics object to use <command>ALTER STATISTICS</command>. |
| 44 |
To change a statistics object's schema, you must also |
| 45 |
have <literal>CREATE</literal> privilege on the new schema. |
| 46 |
To alter the owner, you must be able to <literal>SET ROLE</literal> to the |
| 47 |
new owning role, and that role must have <literal>CREATE</literal> |
| 48 |
privilege on the statistics object's schema. |
| 49 |
(These restrictions enforce that altering |
| 50 |
the owner doesn't do anything you couldn't do by dropping and recreating |
| 51 |
the statistics object. However, a superuser can alter ownership of any |
| 52 |
statistics object anyway.) |
| 53 |
</para> |
| 54 |
</refsect1> |
| 55 |
|
| 56 |
<refsect1> |
| 57 |
<title>Parameters</title> |
| 58 |
|
| 59 |
<para> |
| 60 |
<variablelist> |
| 61 |
<varlistentry> |
| 62 |
<term><replaceable class="parameter">name</replaceable></term> |
| 63 |
<listitem> |
| 64 |
<para> |
| 65 |
The name (optionally schema-qualified) of the statistics object to be |
| 66 |
altered. |
| 67 |
</para> |
| 68 |
</listitem> |
| 69 |
</varlistentry> |
| 70 |
|
| 71 |
<varlistentry> |
| 72 |
<term><replaceable class="parameter">new_owner</replaceable></term> |
| 73 |
<listitem> |
| 74 |
<para> |
| 75 |
The user name of the new owner of the statistics object. |
| 76 |
</para> |
| 77 |
</listitem> |
| 78 |
</varlistentry> |
| 79 |
|
| 80 |
<varlistentry> |
| 81 |
<term><replaceable class="parameter">new_name</replaceable></term> |
| 82 |
<listitem> |
| 83 |
<para> |
| 84 |
The new name for the statistics object. |
| 85 |
</para> |
| 86 |
</listitem> |
| 87 |
</varlistentry> |
| 88 |
|
| 89 |
<varlistentry> |
| 90 |
<term><replaceable class="parameter">new_schema</replaceable></term> |
| 91 |
<listitem> |
| 92 |
<para> |
| 93 |
The new schema for the statistics object. |
| 94 |
</para> |
| 95 |
</listitem> |
| 96 |
</varlistentry> |
| 97 |
|
| 98 |
<varlistentry> |
| 99 |
<term><replaceable class="parameter">new_target</replaceable></term> |
| 100 |
<listitem> |
| 101 |
<para> |
| 102 |
The statistic-gathering target for this statistics object for subsequent |
| 103 |
<link linkend="sql-analyze"><command>ANALYZE</command></link> operations. |
| 104 |
The target can be set in the range 0 to 10000. Set it to |
| 105 |
<literal>DEFAULT</literal> to revert to using the system default |
| 106 |
statistics target (<xref linkend="guc-default-statistics-target"/>). |
| 107 |
(Setting to a value of -1 is an obsolete way spelling to get the same |
| 108 |
outcome.) |
| 109 |
For more information on the use of statistics by the |
| 110 |
<productname>PostgreSQL</productname> query planner, refer to |
| 111 |
<xref linkend="planner-stats"/>. |
| 112 |
</para> |
| 113 |
</listitem> |
| 114 |
</varlistentry> |
| 115 |
|
| 116 |
</variablelist> |
| 117 |
</para> |
| 118 |
</refsect1> |
| 119 |
|
| 120 |
<refsect1> |
| 121 |
<title>Compatibility</title> |
| 122 |
|
| 123 |
<para> |
| 124 |
There is no <command>ALTER STATISTICS</command> command in the SQL standard. |
| 125 |
</para> |
| 126 |
</refsect1> |
| 127 |
|
| 128 |
<refsect1> |
| 129 |
<title>See Also</title> |
| 130 |
|
| 131 |
<simplelist type="inline"> |
| 132 |
<member><xref linkend="sql-createstatistics"/></member> |
| 133 |
<member><xref linkend="sql-dropstatistics"/></member> |
| 134 |
</simplelist> |
| 135 |
</refsect1> |
| 136 |
|
| 137 |
</refentry> |