SQL Commands / Indexes & Statistics
DROP STATISTICS
Read the PG 18 manualremove extended statistics
Reading PG 18current·documented in 11 of 30 versions, 10 to 20
Syntax
DROP STATISTICS [ IF EXISTS ] name [, ...] [ CASCADE | RESTRICT ]
Syntax diagrams
Read left to right. Branches are choices, bypasses are optional, loops repeat. Select an underlined parameter to open its rule.
Description
DROP STATISTICS removes statistics object(s) from the database. Only the statistics object's owner, the schema owner, or a superuser can drop a statistics object.
Parameters
IF EXISTSDo not throw an error if the statistics object does not exist. A notice is issued in this case.
nameThe name (optionally schema-qualified) of the statistics object to drop.
CASCADERESTRICTThese key words do not have any effect, since there are no dependencies on statistics.
Examples
To destroy two statistics objects in different schemas, without failing if they don't exist:
DROP STATISTICS IF EXISTS
accounting.users_uid_creation,
public.grants_user_role;
Compatibility
There is no DROP STATISTICS command in the SQL standard.
See Also
ALTER STATISTICS, CREATE STATISTICSVersion history 1
- 9.6 → 10 added
Related entries
Definition snapshot: b7bd9cda · English manual source