DROP_STATISTICS(7pg16)

πŸ“¦ version 16.15, in opensuse-leap 16.0

✨ 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 πŸ¦‹


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