{"Entry":{"collection":"sql","key":"alter-statistics","name":"ALTER STATISTICS","aliases":["alterstatistics"],"metadata":{"aliases":["alterstatistics"],"changed_in":["13","14","17"],"changes":[{"from":"9.6","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":[],"removed":[]},"status":"added","synopsis":null,"to":"10"},{"from":"12","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":["parameters"],"removed":[]},"status":"changed","synopsis":{"added":["ALTER STATISTICS name SET STATISTICS new_target"],"removed":[]},"to":"13"},{"from":"13","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":[],"removed":[]},"status":"changed","synopsis":{"added":["ALTER STATISTICS name OWNER TO { new_owner | CURRENT_ROLE | CURRENT_USER | SESSION_USER }"],"removed":[]},"to":"14"},{"from":"15","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":["description"],"removed":[]},"status":"changed","synopsis":null,"to":"16"},{"from":"16","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":["parameters"],"removed":[]},"status":"changed","synopsis":{"added":["ALTER STATISTICS name SET STATISTICS { new_target | DEFAULT }"],"removed":[]},"to":"17"}],"content_hash":"0c04843ded31cbdaaada4d1ad467554da26bf830768544d3bd169ccc10199aa1","derived_content_hash":"0d33d14dbe75a4b12a4caa36eab26da2a20be5bf7a856367221a4b6c139e647f","editorial":{},"first_version":"10","group":"index","imported_at":"2026-09-30T17:43:36.951554+08:00","last_version":"20","name":"ALTER STATISTICS","object":"STATISTICS","position":1005,"present_in":["10","11","12","13","14","15","16","17","18","19","20"],"purpose":"change the definition of an extended statistics object","purpose_zh":"","related":["create-statistics","drop-statistics"],"repair_provenance":{"original_source_revision":"a709ab85","receipt_sha256":"68bc820e93c3d56e783b550e0c9557c5fd22aa16a365656a7c3eba6a61bd5b63","repair":"wiki-repair-20261023"},"slug":"alter-statistics","source_rev":"wiki-repair-20261023:86a6fb97f75caf571a80293d6c0aa14cba01ed49e90c55611e8275202aab54e2","synopsis":"ALTER STATISTICS name OWNER TO { new_owner | CURRENT_ROLE | CURRENT_USER | SESSION_USER }\nALTER STATISTICS name RENAME TO new_name\nALTER STATISTICS name SET SCHEMA new_schema\nALTER STATISTICS name SET STATISTICS { new_target | DEFAULT }","verb":"ALTER"}},"Definition":{"Collection":"sql","Key":"alter-statistics","SourceDatabase":"center","Version":"18","SourceTable":"sqlcmd","SourceKey":"alter-statistics","SourceRevision":"wiki-repair-20261023:86a6fb97f75caf571a80293d6c0aa14cba01ed49e90c55611e8275202aab54e2","Facts":{"anchor":"SQL-ALTERSTATISTICS","description_zh":"更改扩展统计对象的定义","description_zh_html":"\u003cpre\u003eALTER STATISTICS name OWNER TO { new_owner | CURRENT_ROLE | CURRENT_USER | SESSION_USER }\nALTER STATISTICS name RENAME TO new_name\nALTER STATISTICS name SET SCHEMA new_schema\nALTER STATISTICS name SET STATISTICS { new_target | DEFAULT }\u003c/pre\u003e\u003csection\u003e\u003ch2\u003e描述\u003c/h2\u003e\u003cp\u003e\n\u003ccode class=\"command\"\u003eALTER STATISTICS\u003c/code\u003e 修改现有扩展统计对象的参数。凡未在 \u003ccode class=\"command\"\u003eALTER STATISTICS\u003c/code\u003e 命令中明确设置的参数，都会保留其原有设置。\n  \u003c/p\u003e\u003cp\u003e\n   要使用 \u003ccode class=\"command\"\u003eALTER STATISTICS\u003c/code\u003e，你必须拥有该统计对象。要更改统计对象的模式，你还必须在新模式上具有 \u003ccode class=\"literal\"\u003eCREATE\u003c/code\u003e 权限。要更改所有者，你必须能够对新的所有者角色执行 \u003ccode class=\"literal\"\u003eSET ROLE\u003c/code\u003e，并且该角色必须在统计对象所在的模式上具有 \u003ccode class=\"literal\"\u003eCREATE\u003c/code\u003e 权限。（这些限制确保更改所有者不会做出任何你无法通过删除并重新创建该统计对象来完成的事情。不过，超级用户无论如何都可以更改任何统计对象的所有权。）\n  \u003c/p\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003e参数\u003c/h2\u003e\u003cp\u003e\n\u003c/p\u003e\u003cdiv class=\"variablelist\"\u003e\u003cdl class=\"variablelist\"\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        要修改的统计对象的名称（可以用模式限定）。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003enew_owner\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        统计对象的新所有者的用户名。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003enew_name\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        统计对象的新名称。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003enew_schema\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        统计对象的新模式。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003enew_target\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        该统计对象在后续 \u003ca class=\"link\" href=\"/zh/docs/18/sql-analyze.html\" title=\"ANALYZE\"\u003e\u003ccode class=\"command\"\u003eANALYZE\u003c/code\u003e\u003c/a\u003e\n        操作中的统计信息收集目标。目标值可设置在 0 到 10000 的范围内。将其设置为 \u003ccode class=\"literal\"\u003eDEFAULT\u003c/code\u003e 可恢复为使用系统默认统计目标（\u003ca class=\"xref\" href=\"/zh/docs/18/runtime-config-query.html#GUC-DEFAULT-STATISTICS-TARGET\"\u003edefault_statistics_target\u003c/a\u003e）。将其设置为 -1 是得到相同结果的一种过时写法。有关 \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e 查询规划器如何使用统计信息的更多内容，请参见\u003ca class=\"xref\" href=\"/zh/docs/18/planner-stats.html\" title=\"14.2. 规划器使用的统计信息\"\u003e第 14.2 节\u003c/a\u003e。\n       \u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003cp\u003e\n\u003c/p\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003e兼容性\u003c/h2\u003e\u003cp\u003e\n   SQL 标准中没有 \u003ccode class=\"command\"\u003eALTER STATISTICS\u003c/code\u003e 命令。\n  \u003c/p\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003e另见\u003c/h2\u003e\u003cspan class=\"simplelist\"\u003e\u003ca class=\"xref\" href=\"/zh/docs/18/sql-createstatistics.html\" title=\"CREATE STATISTICS\"\u003e\u003cspan class=\"refentrytitle\"\u003eCREATE STATISTICS\u003c/span\u003e\u003c/a\u003e, \u003ca class=\"xref\" href=\"/zh/docs/18/sql-dropstatistics.html\" title=\"DROP STATISTICS\"\u003e\u003cspan class=\"refentrytitle\"\u003eDROP STATISTICS\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e\u003c/section\u003e","file":"sql-alterstatistics.html","lang":"en","name":"ALTER STATISTICS","purpose":"change the definition of an extended statistics object","purpose_zh":"更改扩展统计对象的定义","related":["create-statistics","drop-statistics"],"sections":[{"html":"\u003cp\u003e\u003ccode class=\"command\"\u003eALTER STATISTICS\u003c/code\u003e changes the parameters of an existing extended statistics object. Any parameters not specifically set in the \u003ccode class=\"command\"\u003eALTER STATISTICS\u003c/code\u003e command retain their prior settings.\u003c/p\u003e\u003cp\u003eYou must own the statistics object to use \u003ccode class=\"command\"\u003eALTER STATISTICS\u003c/code\u003e. To change a statistics object's schema, you must also have \u003ccode class=\"literal\"\u003eCREATE\u003c/code\u003e privilege on the new schema. To alter the owner, you must be able to \u003ccode class=\"literal\"\u003eSET ROLE\u003c/code\u003e to the new owning role, and that role must have \u003ccode class=\"literal\"\u003eCREATE\u003c/code\u003e 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.)\u003c/p\u003e","key":"description","title":"Description"},{"html":"\u003cdiv class=\"variablelist\"\u003e\u003cdl class=\"variablelist\"\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eThe name (optionally schema-qualified) of the statistics object to be altered.\u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003enew_owner\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eThe user name of the new owner of the statistics object.\u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003enew_name\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eThe new name for the statistics object.\u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003enew_schema\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eThe new schema for the statistics object.\u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003enew_target\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eThe statistic-gathering target for this statistics object for subsequent \u003ca href=\"/docs/18/sql-analyze.html\" title=\"ANALYZE\"\u003e\u003ccode class=\"command\"\u003eANALYZE\u003c/code\u003e\u003c/a\u003e operations. The target can be set in the range 0 to 10000. Set it to \u003ccode class=\"literal\"\u003eDEFAULT\u003c/code\u003e to revert to using the system default statistics target (\u003ca href=\"/docs/18/runtime-config-query.html#GUC-DEFAULT-STATISTICS-TARGET\"\u003edefault_statistics_target\u003c/a\u003e). (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 \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e query planner, refer to \u003ca href=\"/docs/18/planner-stats.html\" title=\"14.2. Statistics Used by the Planner\"\u003eSection 14.2\u003c/a\u003e.\u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e","key":"parameters","title":"Parameters"},{"html":"\u003cp\u003eThere is no \u003ccode class=\"command\"\u003eALTER STATISTICS\u003c/code\u003e command in the SQL standard.\u003c/p\u003e","key":"compatibility","title":"Compatibility"},{"html":"\u003cspan class=\"simplelist\"\u003e\u003ca href=\"/wiki/sql/create-statistics/?v=18\" title=\"CREATE STATISTICS\"\u003e\u003cspan class=\"refentrytitle\"\u003eCREATE STATISTICS\u003c/span\u003e\u003c/a\u003e, \u003ca href=\"/wiki/sql/drop-statistics/?v=18\" title=\"DROP STATISTICS\"\u003e\u003cspan class=\"refentrytitle\"\u003eDROP STATISTICS\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e","key":"see_also","title":"See Also"}],"sections_same_as":"","slug":"18","synopsis_html":"ALTER STATISTICS \u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e OWNER TO { \u003cem class=\"replaceable\"\u003e\u003ccode\u003enew_owner\u003c/code\u003e\u003c/em\u003e | CURRENT_ROLE | CURRENT_USER | SESSION_USER }\nALTER STATISTICS \u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e RENAME TO \u003cem class=\"replaceable\"\u003e\u003ccode\u003enew_name\u003c/code\u003e\u003c/em\u003e\nALTER STATISTICS \u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e SET SCHEMA \u003cem class=\"replaceable\"\u003e\u003ccode\u003enew_schema\u003c/code\u003e\u003c/em\u003e\nALTER STATISTICS \u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e SET STATISTICS { \u003cem class=\"replaceable\"\u003e\u003ccode\u003enew_target\u003c/code\u003e\u003c/em\u003e | DEFAULT }","synopsis_text":"ALTER STATISTICS name OWNER TO { new_owner | CURRENT_ROLE | CURRENT_USER | SESSION_USER }\nALTER STATISTICS name RENAME TO new_name\nALTER STATISTICS name SET SCHEMA new_schema\nALTER STATISTICS name SET STATISTICS { new_target | DEFAULT }","translation_provenance":{"inputs":[{"kind":"current-pgdoc-translation","path":"/Users/vonng/pgsty/pgdoc/zh/18/html/sql-alterstatistics.html","sha256":"34363ab7e4975f29b4394844cc62080f90c5d2deebf3eda54f4adfbb728f31ab"}],"kind":"same-version-pgdoc","locale":"zh-Hans","source_revision":"b1b500221dbe5437cfca004d6b04d3f6e422765d","version":"18"},"zh_from":"same-version-pgdoc"},"ManualEvidence":{},"MeasuredEvidence":{}},"Text":{"Collection":"sql","Key":"alter-statistics","SourceDatabase":"center","Version":"18","Locale":"en","Title":"ALTER STATISTICS","Summary":"change the definition of an extended statistics object","BodyHTML":"\u003cpre\u003eALTER STATISTICS name OWNER TO { new_owner | CURRENT_ROLE | CURRENT_USER | SESSION_USER }\nALTER STATISTICS name RENAME TO new_name\nALTER STATISTICS name SET SCHEMA new_schema\nALTER STATISTICS name SET STATISTICS { new_target | DEFAULT }\u003c/pre\u003e\u003csection\u003e\u003ch2\u003eDescription\u003c/h2\u003e\u003cp\u003e\u003ccode\u003eALTER STATISTICS\u003c/code\u003e changes the parameters of an existing extended statistics object. Any parameters not specifically set in the \u003ccode\u003eALTER STATISTICS\u003c/code\u003e command retain their prior settings.\u003c/p\u003e\u003cp\u003eYou must own the statistics object to use \u003ccode\u003eALTER STATISTICS\u003c/code\u003e. To change a statistics object\u0026#39;s schema, you must also have \u003ccode\u003eCREATE\u003c/code\u003e privilege on the new schema. To alter the owner, you must be able to \u003ccode\u003eSET ROLE\u003c/code\u003e to the new owning role, and that role must have \u003ccode\u003eCREATE\u003c/code\u003e privilege on the statistics object\u0026#39;s schema. (These restrictions enforce that altering the owner doesn\u0026#39;t do anything you couldn\u0026#39;t do by dropping and recreating the statistics object. However, a superuser can alter ownership of any statistics object anyway.)\u003c/p\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003eParameters\u003c/h2\u003e\u003cdiv\u003e\u003cdl\u003e\u003cdt\u003e\u003cspan\u003e\u003cem\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eThe name (optionally schema-qualified) of the statistics object to be altered.\u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan\u003e\u003cem\u003e\u003ccode\u003enew_owner\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eThe user name of the new owner of the statistics object.\u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan\u003e\u003cem\u003e\u003ccode\u003enew_name\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eThe new name for the statistics object.\u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan\u003e\u003cem\u003e\u003ccode\u003enew_schema\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eThe new schema for the statistics object.\u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan\u003e\u003cem\u003e\u003ccode\u003enew_target\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eThe statistic-gathering target for this statistics object for subsequent \u003ca href=\"/docs/18/sql-analyze.html\" title=\"ANALYZE\" rel=\"nofollow\"\u003e\u003ccode\u003eANALYZE\u003c/code\u003e\u003c/a\u003e operations. The target can be set in the range 0 to 10000. Set it to \u003ccode\u003eDEFAULT\u003c/code\u003e to revert to using the system default statistics target (\u003ca href=\"/docs/18/runtime-config-query.html#GUC-DEFAULT-STATISTICS-TARGET\" rel=\"nofollow\"\u003edefault_statistics_target\u003c/a\u003e). (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 \u003cspan\u003ePostgreSQL\u003c/span\u003e query planner, refer to \u003ca href=\"/docs/18/planner-stats.html\" rel=\"nofollow\"\u003eSection 14.2\u003c/a\u003e.\u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003eCompatibility\u003c/h2\u003e\u003cp\u003eThere is no \u003ccode\u003eALTER STATISTICS\u003c/code\u003e command in the SQL standard.\u003c/p\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003eSee Also\u003c/h2\u003e\u003cspan\u003e\u003ca href=\"/wiki/sql/create-statistics/?v=18\" title=\"CREATE STATISTICS\" rel=\"nofollow\"\u003e\u003cspan\u003eCREATE STATISTICS\u003c/span\u003e\u003c/a\u003e, \u003ca href=\"/wiki/sql/drop-statistics/?v=18\" title=\"DROP STATISTICS\" rel=\"nofollow\"\u003e\u003cspan\u003eDROP STATISTICS\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e\u003c/section\u003e","SourceRevision":"wiki-repair-20261023:86a6fb97f75caf571a80293d6c0aa14cba01ed49e90c55611e8275202aab54e2","ContentHash":"4b04135e3e9e2e52aee0569c543c5d7f301cdb20601c21dd02de6b9aa57a5a97","Payload":{"related":["create-statistics","drop-statistics"],"sections":[{"html":"\u003cp\u003e\u003ccode class=\"command\"\u003eALTER STATISTICS\u003c/code\u003e changes the parameters of an existing extended statistics object. Any parameters not specifically set in the \u003ccode class=\"command\"\u003eALTER STATISTICS\u003c/code\u003e command retain their prior settings.\u003c/p\u003e\u003cp\u003eYou must own the statistics object to use \u003ccode class=\"command\"\u003eALTER STATISTICS\u003c/code\u003e. To change a statistics object's schema, you must also have \u003ccode class=\"literal\"\u003eCREATE\u003c/code\u003e privilege on the new schema. To alter the owner, you must be able to \u003ccode class=\"literal\"\u003eSET ROLE\u003c/code\u003e to the new owning role, and that role must have \u003ccode class=\"literal\"\u003eCREATE\u003c/code\u003e 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.)\u003c/p\u003e","key":"description","title":"Description"},{"html":"\u003cdiv class=\"variablelist\"\u003e\u003cdl class=\"variablelist\"\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eThe name (optionally schema-qualified) of the statistics object to be altered.\u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003enew_owner\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eThe user name of the new owner of the statistics object.\u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003enew_name\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eThe new name for the statistics object.\u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003enew_schema\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eThe new schema for the statistics object.\u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003enew_target\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eThe statistic-gathering target for this statistics object for subsequent \u003ca href=\"/docs/18/sql-analyze.html\" title=\"ANALYZE\"\u003e\u003ccode class=\"command\"\u003eANALYZE\u003c/code\u003e\u003c/a\u003e operations. The target can be set in the range 0 to 10000. Set it to \u003ccode class=\"literal\"\u003eDEFAULT\u003c/code\u003e to revert to using the system default statistics target (\u003ca href=\"/docs/18/runtime-config-query.html#GUC-DEFAULT-STATISTICS-TARGET\"\u003edefault_statistics_target\u003c/a\u003e). (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 \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e query planner, refer to \u003ca href=\"/docs/18/planner-stats.html\" title=\"14.2. Statistics Used by the Planner\"\u003eSection 14.2\u003c/a\u003e.\u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e","key":"parameters","title":"Parameters"},{"html":"\u003cp\u003eThere is no \u003ccode class=\"command\"\u003eALTER STATISTICS\u003c/code\u003e command in the SQL standard.\u003c/p\u003e","key":"compatibility","title":"Compatibility"},{"html":"\u003cspan class=\"simplelist\"\u003e\u003ca href=\"/wiki/sql/create-statistics/?v=18\" title=\"CREATE STATISTICS\"\u003e\u003cspan class=\"refentrytitle\"\u003eCREATE STATISTICS\u003c/span\u003e\u003c/a\u003e, \u003ca href=\"/wiki/sql/drop-statistics/?v=18\" title=\"DROP STATISTICS\"\u003e\u003cspan class=\"refentrytitle\"\u003eDROP STATISTICS\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e","key":"see_also","title":"See Also"}],"sections_same_as":"","synopsis_html":"ALTER STATISTICS \u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e OWNER TO { \u003cem class=\"replaceable\"\u003e\u003ccode\u003enew_owner\u003c/code\u003e\u003c/em\u003e | CURRENT_ROLE | CURRENT_USER | SESSION_USER }\nALTER STATISTICS \u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e RENAME TO \u003cem class=\"replaceable\"\u003e\u003ccode\u003enew_name\u003c/code\u003e\u003c/em\u003e\nALTER STATISTICS \u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e SET SCHEMA \u003cem class=\"replaceable\"\u003e\u003ccode\u003enew_schema\u003c/code\u003e\u003c/em\u003e\nALTER STATISTICS \u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e SET STATISTICS { \u003cem class=\"replaceable\"\u003e\u003ccode\u003enew_target\u003c/code\u003e\u003c/em\u003e | DEFAULT }","synopsis_text":"ALTER STATISTICS name OWNER TO { new_owner | CURRENT_ROLE | CURRENT_USER | SESSION_USER }\nALTER STATISTICS name RENAME TO new_name\nALTER STATISTICS name SET SCHEMA new_schema\nALTER STATISTICS name SET STATISTICS { new_target | DEFAULT }"}},"RequestedLocale":"en","Fallback":false,"Versions":["10","11","12","13","14","15","16","17","18","19","20"],"Locales":["en","zh-Hans"],"Signatures":null,"Spellings":null,"SQLState":null,"Evidence":null}
