Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tIMAF-00DpyL-3y for pgsql-general@arkaria.postgresql.org; Tue, 03 Dec 2024 06:13:39 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1tIMAC-007GLe-KC for pgsql-general@arkaria.postgresql.org; Tue, 03 Dec 2024 06:13:37 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tIMAB-007GIo-R6 for pgsql-general@lists.postgresql.org; Tue, 03 Dec 2024 06:13:37 +0000 Received: from mail-yb1-xb35.google.com ([2607:f8b0:4864:20::b35]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1tIMA9-000mRO-N8 for pgsql-general@lists.postgresql.org; Tue, 03 Dec 2024 06:13:36 +0000 Received: by mail-yb1-xb35.google.com with SMTP id 3f1490d57ef6-e38938a55e7so4245527276.2 for ; Mon, 02 Dec 2024 22:13:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lelarge-info.20230601.gappssmtp.com; s=20230601; t=1733206411; x=1733811211; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=d5rHq8ujnKpUnZwaK6pL4eeA1UxpLcovZndnjtxJeA8=; b=GFaLJR3PybVAzLv2g/bdEKXQae2a7e1TFFuhrAWmd1pwAKCVbOssZoNO7QDNxyIzvn Chk4Vyd/upsq/KLJGEojnBo4edaRefdYCvoS5s9KL1My/OMoMopJIozzdnBUvpdRTZjt vH5/HSQgDsch+MicewqPhvWKWN1rMbp8Sg8YZ4SnsJYfAwz89vmwmlfcXUmqZ+JtR4+8 uj4jbGs908oXrUoHxDf74WZVOPlmL8D99MEjd/F6Tb8BufIM0RgFex3TuHaWZAuQSyk3 ZKVSKcskL/nG1WrSY+O/0slyr9aRxISLlMKypLRWXL6PxlOtD4OueLigVhrLxkyH5TKr 7dIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733206411; x=1733811211; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=d5rHq8ujnKpUnZwaK6pL4eeA1UxpLcovZndnjtxJeA8=; b=jVVrG1eMRH+pUrri3xmfc1Qq8RHZ9YFABVcOcDIB46nipYQdKK4ndwtRNA9nZz3Nqs uL4sYoIi/qwupcTjpovvF00uhn2/RTY1lwvZnqFJUOqVeIGLUFkC1Y6MFbO/849XIZri lYAwmQDHA4ieUhJBHu1niDfsYgiqsghTxdxa6bL2AK4f+V6GCrQpkO6mBzZkGNremTEV 1ZhGZNCgVfX5RAIDwMLkFTmPoUIl/tlb/rggxUukEZhuGxLxMf7M8udYDJTVO2BKXok/ G+FvgaoEWZeuiX2RrpMWy0jWDlOCho6oaxjQtXgD2rap/V4+T6WNNH43lFmGOrAq3Q49 xLAQ== X-Gm-Message-State: AOJu0YyhEb4El/WSyktdDLhJJs/kn8mQEBhIDh3DrPaBKXvXkkGrgTTv 9rHvdQh0Y3lL0F4qkp4pfUJ4GNM+RKvu6LoTgXhiwhI9DTVtwKCggqagPRscFAqlN2vBNhJFy62 NtWJeEnXgj1TsXJA3foMlOUl+HC4xaIPpzsIJIb6lZJaj560X X-Gm-Gg: ASbGnctAyItOmfvHr0SER/8v5Fzbx6MKRTlVk/StMKocVN+vhW6x+zqumiOcm0x/maX 8GoueHrvALsomd3aI+awUfoK0uA/WV6Lm X-Google-Smtp-Source: AGHT+IEIr4ZrTinvp44co+dgjKNzBf9Rj+xoBYZ7sCt5WHSmo/+H8KAvtmKT8mSlRU+SwbEc0MXYHhGsu4KoNaCHWsk= X-Received: by 2002:a05:6902:70f:b0:e38:901b:602d with SMTP id 3f1490d57ef6-e39d39ee5b4mr1221224276.9.1733206411283; Mon, 02 Dec 2024 22:13:31 -0800 (PST) MIME-Version: 1.0 References: <0d11ad5e-5903-49ce-8fff-4650919f4b44@app.fastmail.com> In-Reply-To: <0d11ad5e-5903-49ce-8fff-4650919f4b44@app.fastmail.com> From: Guillaume Lelarge Date: Tue, 3 Dec 2024 07:13:20 +0100 Message-ID: Subject: Re: VACUUM FULL, power failure results in unrecoverable space To: Pierre Barre Cc: "pgsql-generallists.postgresql.org" Content-Type: multipart/alternative; boundary="00000000000077ac4b0628579031" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --00000000000077ac4b0628579031 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi, Le mar. 3 d=C3=A9c. 2024, 01:02, Pierre Barre a =C3=A9cri= t : > Hello, > > I encountered an issue while attempting to reclaim space from a heavily > bloated table: > > Initial analysis using > https://github.com/ioguix/pgsql-bloat-estimation/blob/master/table/table_= bloat.sql indicated > approximately 600GB of bloat in the table. > > I initiated a VACUUM FULL operation to reclaim this space, but during > execution, the server experienced a power failure. > > > After server recovery: > > 1. The database came back online successfully > 2. The space used by the in-progress table reconstruction was not freed > Because doesn't know it's here. 3. The newly wasted space (bloat + partial VACUUM FULL) is not shown using > the above query, only the initial bloat. > Because it's not the same kind of bloat. Vacuum full builds another set of files for the table, and these files aren't yet connected to the table, since vacuum full didn't finish. You've got some orphaned files you'll have to delete. > > Is there a way to reclaim this space without resorting to a full pg_dump > and pg_restore cycle? > You can dump and restore (which will drop all bloat of this database), but will probably take too long to finish. You can also see pg_orphaned to know which files to delete (https://github.com/bdrouvot/pg_orphaned). Regards. --=20 Guillaume. --00000000000077ac4b0628579031 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi,


Le mar. 3 d=C3=A9c. 2024, 01:02, Pierre = Barre <pierre@barre.sh> a =C3= =A9crit=C2=A0:
Hel= lo,

I encountered an issue while attempting to= reclaim space from a heavily bloated table:

In= itial analysis using=C2=A0https://github.com/ioguix/pgsql-bloat-estimation/blob/master/table/= table_bloat.sql=C2=A0indicated approximately 600GB of bloat in the tabl= e.

I initiated a VACUUM FULL operation to recl= aim this space, but during execution, the server experienced a power failur= e.


After server recovery:

1. The database= came back online successfully
2. The space used by the in-progress table reconstruction was not fr= eed
=

Because doesn't kno= w it's here.

3. = The newly wasted space (bloat + partial VACUUM FULL) is not shown using the= above query, only the initial bloat.

Because it's not the same kind of bloat. Vacuum f= ull builds another set of files for the table, and these files aren't y= et connected to the table, since vacuum full didn't finish. You've = got some orphaned files you'll have to delete.=C2=A0



Is there a way to re= claim this space without resorting to a full pg_dump and pg_restore cycle?= =C2=A0

You can dump and restore (which will drop all = bloat of this database), but will probably take too long to finish. You can= also see pg_orphaned to know which files to delete (https://github.com/bdrouvot/pg_orphaned).=

Regards.


--=C2=A0<= /div>
Guillaume.
--00000000000077ac4b0628579031--