pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Eduard Rozenberg <edrozenberg@gmail.com>
Cc: pgsql-general@postgresql.org
Subject: Re: vacuumdb --jobs deadlock: how to avoid pg_catalog ?
Date: Thu, 14 May 2020 11:46:18 -0700
Message-ID: <20790094-993c-a00b-3246-25a9f04539a6@aklaver.com> (raw)
In-Reply-To: <3E4B3E2A-CBBE-472A-8FDE-C1A9538F2DF0@gmail.com>
References: <4C3B3D43-F3BE-4BE7-A812-E3FB4E43236A@gmail.com>
	<b4d783b6-845f-f728-6124-943e6007ce01@aklaver.com>
	<3E4B3E2A-CBBE-472A-8FDE-C1A9538F2DF0@gmail.com>

On 5/14/20 11:27 AM, Eduard Rozenberg wrote:
> @Adrian thanks.
> 
> I did a test vacuum full the "normal" non-parallel way (VACUUM FULL sql) 
> previously on a test db copy and saw the DB size (postgres 9.6) shrink 
> from 6.8 TB to 4.4 TB of actual, real disk space usage ($ df -d 1).
> 
> I don't know the reason so much space was "locked up" (other than there 
> is a lot of data "churn" from daily updates). But I definitely do need 
> to do the vac full on the production db to get down to the smaller size 
> - cannot afford the 2.4 TB of "wasted" space on an ongoing basis.

It may not be wasted space. A regular VACUUM marks space within a table 
available for reuse(and not returned to OS) when it removes unneeded 
tuples. It then fills that space up with new tuples, roughly speaking. 
So if the vacuuming is working properly you will reach a steady state 
where space is reused and the database on disk size grows slowly as 
reusable space is occupied. I would monitor the database size on a 
regular basis. My guess is that the VACUUM FULL is dropping the OS used 
space and then it fills up again as the database does those updates.

> 
> Based on your email it sounds like the vacuuming of those pg_catalog.* 
> tables is done regardless, as a normal part of doing vac full on my own 
> database.
> 
> Unfortunately I still don't see an ideal way to run vacuum full in 
> parallel via vacuumdb without running into the expected and documented 
> deadlock. Only method I'm aware of is to list each table individually 
> with "-t table1 -t table2..." to "vacuum db --jobs" which is not 
> pleasant and not exceedingly beautiful.
> 
> Thanks.
> 


-- 
Adrian Klaver
adrian.klaver@aklaver.com





view thread (8+ messages)  latest in thread

Message-ID: <20790094-993c-a00b-3246-25a9f04539a6@aklaver.com>
Permalink:  ../20790094-993c-a00b-3246-25a9f04539a6@aklaver.com/
Also on:    postgresql.org/message-id/20790094-993c-a00b-3246-25a9f04539a6@aklaver.com

 · 

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: adrian.klaver@aklaver.com, edrozenberg@gmail.com
  Subject: Re: vacuumdb --jobs deadlock: how to avoid pg_catalog ?
  In-Reply-To: <20790094-993c-a00b-3246-25a9f04539a6@aklaver.com>
  References: <4C3B3D43-F3BE-4BE7-A812-E3FB4E43236A@gmail.com> <b4d783b6-845f-f728-6124-943e6007ce01@aklaver.com> <3E4B3E2A-CBBE-472A-8FDE-C1A9538F2DF0@gmail.com> <20790094-993c-a00b-3246-25a9f04539a6@aklaver.com>

* 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