2 .\" Title: ALTER STATISTICS
3 .\" Author: The PostgreSQL Global Development Group
4 .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
6 .\" Manual: PostgreSQL 18.0 Documentation
7 .\" Source: PostgreSQL 18.0
10 .TH "ALTER STATISTICS" "7" "2025" "PostgreSQL 18.0" "PostgreSQL 18.0 Documentation"
11 .\" -----------------------------------------------------------------
12 .\" * Define some portability stuff
13 .\" -----------------------------------------------------------------
14 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15 .\" http://bugs.debian.org/507673
16 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
17 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
20 .\" -----------------------------------------------------------------
21 .\" * set default formatting
22 .\" -----------------------------------------------------------------
23 .\" disable hyphenation
25 .\" disable justification (adjust text to left margin only)
27 .\" -----------------------------------------------------------------
28 .\" * MAIN CONTENT STARTS HERE *
29 .\" -----------------------------------------------------------------
31 ALTER_STATISTICS \- change the definition of an extended statistics object
35 ALTER STATISTICS \fIname\fR OWNER TO { \fInew_owner\fR | CURRENT_ROLE | CURRENT_USER | SESSION_USER }
36 ALTER STATISTICS \fIname\fR RENAME TO \fInew_name\fR
37 ALTER STATISTICS \fIname\fR SET SCHEMA \fInew_schema\fR
38 ALTER STATISTICS \fIname\fR SET STATISTICS { \fInew_target\fR | DEFAULT }
42 \fBALTER STATISTICS\fR
43 changes the parameters of an existing extended statistics object\&. Any parameters not specifically set in the
44 \fBALTER STATISTICS\fR
45 command retain their prior settings\&.
47 You must own the statistics object to use
48 \fBALTER STATISTICS\fR\&. To change a statistics object\*(Aqs schema, you must also have
50 privilege on the new schema\&. To alter the owner, you must be able to
52 to the new owning role, and that role must have
54 privilege on the statistics object\*(Aqs schema\&. (These restrictions enforce that altering the owner doesn\*(Aqt do anything you couldn\*(Aqt do by dropping and recreating the statistics object\&. However, a superuser can alter ownership of any statistics object anyway\&.)
60 The name (optionally schema\-qualified) of the statistics object to be altered\&.
65 The user name of the new owner of the statistics object\&.
70 The new name for the statistics object\&.
75 The new schema for the statistics object\&.
80 The statistic\-gathering target for this statistics object for subsequent
82 operations\&. The target can be set in the range 0 to 10000\&. Set it to
84 to revert to using the system default statistics target (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
86 query planner, refer to
92 \fBALTER STATISTICS\fR
93 command in the SQL standard\&.
95 CREATE STATISTICS (\fBCREATE_STATISTICS\fR(7)), DROP STATISTICS (\fBDROP_STATISTICS\fR(7))