ALTER_STATISTICS(7pg15)
ALTER_STATISTICS (7pg15) π β¨
okay bestie, welcome to the PostgreSQL 15.19 Documentation page for ALTER_STATISTICS β it's giving βlet me tweak my extended statistics objectβ energy. no cap.
π NAME π
ALTER_STATISTICS β change the definition of an extended statistics object. periodt.
β¨ 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 πΈ
so ALTER STATISTICS changes the parameters of an existing extended statistics object. any parameters you don't specifically set in the ALTER STATISTICS command? they retain their prior settings. lowkey convenient π
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 also be a direct or indirect member of 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. iykyk.new_ownerβ the user name of the new owner of the statistics object. handing over the keys π«Ά.new_nameβ the new name for the statistics object. rebrand era β¨.new_schemaβ the new schema for the statistics object. moving neighborhoods π‘.new_targetβ the statistic-gathering target for this statistics object for subsequentANALYZEoperations. the target can be set in the range0to10000; alternatively, set it to-1to 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 π
there is no ALTER STATISTICS command in the SQL standard. not a thing there, bestie. π
π¦ SEE ALSO π¦
CREATE STATISTICS(CREATE_STATISTICS(7))DROP STATISTICS(DROP_STATISTICS(7))
xoxo, bestie β this was PostgreSQL 15.19 Documentation, dated 2026, page ALTER STATISTICS(7). go off, statistician icon ππ
π¦ where this page comes from
- opensuse-leap 16.0: postgresql15 15.19-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql15 15.19-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql15 15.19-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql15 15.19-160000.1.1 Β· PostgreSQL
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms