DROP_STATISTICS(7pg16)
β¨ NAME β¨
DROP_STATISTICS β remove extended statistics. also hi bestie, this is the pg16 manual (PostgreSQL 16), and the page header is literally DROP STATISTICS(7). okay so we're removing extended statistics objects, and yes that's the whole vibe.
π«Ά SYNOPSIS π«Ά
DROP STATISTICS [ IF EXISTS ] name [, ...] [ CASCADE | RESTRICT ]
π 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. that's the whole permission list, bestie β owner, schema owner, superuser. no cap.
πΈ PARAMETERS πΈ
IF EXISTSβ do not throw an error if the statistics object does not exist. a notice is issued in this case. so it's a soft landing, not a whole crash-out.nameβ the name (optionally schema-qualified) of the statistics object to drop. literally the thing you're yeeting.CASCADEβ these key words do not have any effect, since there are no dependencies on statistics. fr fr, nothing happens.RESTRICTβ same energy: no effect, since there are no dependencies on statistics. it's giving decorative.
π EXAMPLES π
okay bestie, say you want to destroy two statistics objects in different schemas, without failing if they don't exist. the move is:
DROP STATISTICS IF EXISTS
accounting.users_uid_creation,
public.grants_user_role;
π COMPATIBILITY π
there is no DROP STATISTICS command in the SQL standard. none. zero. not a one. periodt.
π¦ SEE ALSO π¦
ALTER STATISTICS(ALTER_STATISTICS(7)) β go alter it instead, bestie.CREATE STATISTICS(CREATE_STATISTICS(7)) β or create one in the first place.
okay that's the page π source/version: PostgreSQL 16.15, date: 2026, and the footer vibes are all DROP STATISTICS(7). mwah π
π¦ where this page comes from
- opensuse-leap 16.0: postgresql16 16.15-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql16 16.15-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql16 16.15-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql16 16.15-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