DROP_STATISTICS(7pg14)
π DROP STATISTICS π
okay so bestie, welcome to the DROP STATISTICS page β that's the 7pg14 manual, straight out of the PostgreSQL 14.24 docs. yes, we're doing extended statistics today. it's giving cleanup era β¨
πΈ NAME πΈ
DROP_STATISTICS β remove extended statistics π§Ήπ
β¨ SYNOPSIS β¨
DROP STATISTICS [ IF EXISTS ] name [, ...] [ CASCADE | RESTRICT ]
like look at her. she's so simple. she's so clean. no cap π
π¦ DESCRIPTION π¦
DROP STATISTICS removes statistics object(s) from the database. that's it, that's the whole vibe β you point at your statistics objects and they're gone π¨
but okay, permission check, because of course: only the statistics object's owner, the schema owner, or a superuser can drop a statistics object. so if you're not one of those three, bestie, this is not your main character moment π
π PARAMETERS π
IF EXISTSβ do not throw an error if the statistics object does not exist. instead a notice is issued in this case. so like, no drama, no screaming, just a lil heads up π«Άnameβ the name of the statistics object to drop, optionally schema-qualified. yes you can do theschema.thingthing, slay β¨CASCADE/RESTRICTβ okay so these key words literally do not have any effect, since there are no dependencies on statistics. iconic of them to be there anyway tbh. they're just vibing π
π₯ EXAMPLES π₯
the assignment: destroy two statistics objects in different schemas, without failing if they don't exist. and she ate:
DROP STATISTICS IF EXISTS
accounting.users_uid_creation,
public.grants_user_role;
see how we used IF EXISTS? that's the "no crying if it's not there" energy π
π COMPATIBILITY π
there is no DROP STATISTICS command in the SQL standard. so like, this is a PostgreSQL exclusive. iykyk π
β SEE ALSO β
ALTER STATISTICS(ALTER_STATISTICS(7))CREATE STATISTICS(CREATE_STATISTICS(7))
go read those too, bestie, they're the prequel and the sequel fr fr π¦
lowkey a warning for you: only the owner, the schema owner, or a superuser can drop these β don't come for me if it errors, you were warned π
kisses and clean schemas, bestie π this has been the DROP STATISTICS(7) page from PostgreSQL 14.24 Documentation, dated 2026. periodt. πβ¨
π¦ where this page comes from
- opensuse-leap 16.0: postgresql14 14.24-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql14 14.24-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql14 14.24-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql14 14.24-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