Postgresql 中文操作指南

ALTER STATISTICS

ALTER STATISTICS — 更改扩展统计信息对象定义

ALTER STATISTICS — change the definition of an extended statistics object

Synopsis

ALTER STATISTICS name OWNER TO { new_owner | CURRENT_ROLE | 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 更改现有扩展统计信息对象的诸多参数。在 ALTER STATISTICS 命令中未特别设置的所有参数将保留其之前的设置。

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

您必须拥有该统计对象,才能使用 ALTER STATISTICS 。若要更改统计对象的架构,您还必须在新架构上具有 CREATE 权限。若要更改所有者,您必须能够 SET ROLE 到新拥有者角色,并且该角色必须在新架构上具有 CREATE 权限。(这些限制强制确定更改所有者不会做任何事情,您不能通过删除和重新创建统计对象来实现更改所有者的目的。但是,超级用户无论如何都可以更改任何统计对象的所有权。)

You must own the statistics object to use ALTER STATISTICS. To change a statistics object’s schema, you must also have CREATE privilege on the new schema. To alter the owner, you must be able to SET ROLE to the new owning role, and that role must have CREATE 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.)

Parameters

  • name

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

  • new_owner

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

  • new_name

    • The new name for the statistics object.

  • new_schema

    • The new schema for the statistics object.

  • new_target

    • The statistic-gathering target for this statistics object for 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 target of the referenced columns, if set, or the system default statistics target (default_statistics_target). For more information on the use of statistics by the PostgreSQL query planner, refer to Section 14.2.

Compatibility

SQL 标准中没有 ALTER STATISTICS 命令。

There is no ALTER STATISTICS command in the SQL standard.