public inbox for [email protected]  
help / color / mirror / Atom feed
From: Isaac Morland <[email protected]>
To: PostgreSQL Hackers <[email protected]>
Subject: Disk space not released after schema deletion
Date: Wed, 7 Jun 2023 11:48:32 -0400
Message-ID: <CAMsGm5f47KVmYZBVKjOKYxtu2iWG9NUOQQFXjS2G1JY6xruiJA@mail.gmail.com> (raw)

The usual question is “why did DELETE not release disk space?”, and I
understand why that is and something about how to get the space back
(VACUUM).

I have a database which hosts multiple applications in various schemas and
I’m trying to make test/sample data files by starting with a restored copy
of production and then dropping all schemas except for the ones I need for
a particular application.

The total size of all relations after the drop operations is just a few MB:

odyssey=# select sum (pg_total_relation_size (oid)) from pg_class;
   sum
----------
 13877248
(1 row)

Yet the database size is still large (although much smaller than in the
original database):

odyssey=# select datname, pg_database_size (oid) from pg_database;
  datname  | pg_database_size
-----------+------------------
 postgres  |          8930083
 _repmgr   |        654934531
 template0 |          8643075
 template1 |          8864547
 odyssey   |      14375453475
(5 rows)

The only change made after starting from a basebackup of production was to
set all the passwords to NULL in pg_authid, and to delete most of the
schemas. In particular, I wouldn’t expect VACUUM to do anything.

Does anybody know what could be holding all that space?


view thread (2+ messages)

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected]
  Subject: Re: Disk space not released after schema deletion
  In-Reply-To: <CAMsGm5f47KVmYZBVKjOKYxtu2iWG9NUOQQFXjS2G1JY6xruiJA@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox