Skip to main content
Version: 1.0.16

ALTER STATISTICS

ALTER STATISTICS — Change the Definition of an Extended Statistics Object

Synopsis

ALTER STATISTICS name OWNER TO { new_owner | CURRENT_USER | SESSION_USER }

ALTER STATISTICS name RENAME TO new_name

ALTER STATISTICS name SET SCHEMA new_schema

ALTER STATISTICS name SET STATISTICS new_target

Description

ALTER STATISTICS changes the parameters of an existing extended statistics object. Any parameters not explicitly set in the ALTER STATISTICS command retain their previous settings.

You must own the statistics object to use ALTER STATISTICS. To change the schema of the statistics object, you must also have CREATE privilege on the new schema. To change the owner, you must also be a direct or indirect member of the new owner role, and that role must have CREATE privilege on the statistics object's schema. (These restrictions enforce that changing the owner by dropping and recreating the statistics object cannot do anything you couldn't do otherwise. However, a superuser can change ownership of any statistics object.)

Parameters

name

The name (optionally schema-qualified) of the statistics object to be modified.

new_owner

The user name of the new owner of the statistics object.

new_name

The new name of the statistics object.

new_schema

The new schema for the statistics object.

new_target

The statistics collection target for this statistics object, for use in subsequent ANALYZE operations. The target can be set in the range 0 to 10000. Alternatively, set it to -1 to revert to using the maximum of the statistics targets of the referenced columns (if set) or the system default statistics target (default_statistics_target).

See Also

CREATE STATISTICS, DROP STATISTICS