pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Laurenz Albe <laurenz.albe@cybertec.at>
To: Riivo Kolka <riivo.kolka@gmail.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: Orphan table files at data/base/
Date: Wed, 28 Feb 2024 15:30:01 +0100
Message-ID: <008cc1eb83288debc430eec346fd05f61aff0966.camel@cybertec.at> (raw)
In-Reply-To: <CAOZzBDgfO599erZrQsR6cXo4DbnSALDoAmEBVXDXcOFx_1E1og@mail.gmail.com>
References: <CAOZzBDgfO599erZrQsR6cXo4DbnSALDoAmEBVXDXcOFx_1E1og@mail.gmail.com>

On Wed, 2024-02-28 at 15:44 +0200, Riivo Kolka wrote:
> I was an unfortunate sequence of commands (all in single transaction)
> 
> DROP TABLE huge;
> CREATE TABLE huge AS... (huge PostGIS ST_Union operation);
> CREATE INDEX ON huge USING GIST (geometry);
> 
> by a well-meaning user, that caused a crash+recovery:
> 
> server process (PID 92411) was terminated by signal 9: Killed
> terminating any other active server processes
> all server processes terminated; reinitializing
> database system was not properly shut down; automatic recovery in progress
> 
> And that left behind 280GB of files (of TABLE huge):
> data/base/16384/2403959
> ...
> data/base/16384/2403959.282
> 
> 
> SELECT pg_filenode_relation(0,2403959);
> -- returns NULL
> 
> may I do
> sudo rm data/base/2403959*
> ?

If you *know* these files belong to the table created with
CREATE TABLE huge AS SELECT ...
then you can do that.

If you are not 100% certain, go the safe way and use dump/restore
to a new database.  Then DROP DATABASE on the old database, and
all orphaned files will be gone.

Yours,
Laurenz Albe





view thread (4+ messages)  latest in thread

Message-ID: <008cc1eb83288debc430eec346fd05f61aff0966.camel@cybertec.at>
Permalink:  ../008cc1eb83288debc430eec346fd05f61aff0966.camel@cybertec.at/
Also on:    postgresql.org/message-id/008cc1eb83288debc430eec346fd05f61aff0966.camel@cybertec.at

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: laurenz.albe@cybertec.at, riivo.kolka@gmail.com
  Subject: Re: Orphan table files at data/base/
  In-Reply-To: <008cc1eb83288debc430eec346fd05f61aff0966.camel@cybertec.at>
  References: <CAOZzBDgfO599erZrQsR6cXo4DbnSALDoAmEBVXDXcOFx_1E1og@mail.gmail.com> <008cc1eb83288debc430eec346fd05f61aff0966.camel@cybertec.at>

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

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