Re: effects of nullifying bytea column on storage

From: Hugh Ranalli <hugh(at)whtc(dot)ca>
To: David Gauthier <dfgpostgres(at)gmail(dot)com>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: effects of nullifying bytea column on storage
Date: 2022-05-12 15:03:48
Message-ID: CAAhbUMOpnwZGGEB36Toc7ugge=N3JUi5FbDgUyWNefo9v24V5Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, 11 May 2022 at 20:02, David Gauthier <dfgpostgres(at)gmail(dot)com> wrote:
> I have a table with a bytea column which, of course, contains binary data. After 60 days, I no longer need the binary data but want to retain the rest of the record. Of course it's easy to just update the bytea column to null for the older records. But I can almost imagine this record on disk with a big "hole" in the middle where the bytea data used to be. Is there a PG daemon (the vacuum ?) that will "heal the hole" in time?

We have a similar situation, and run a weekly task that backs up the
table, sets the outdated records to NULL, truncates the original
table, then copies the records back in. With this approach the disk
space is reclaimed immediately. The table is only written to by
automated processes, so we have a weekly maintenance window where
these aren't running. This might be a possible approach.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2022-05-12 15:24:22 Re: Restricting user to see schema structure
Previous Message Nick Cleaton 2022-05-12 14:53:22 Re: AW: [Extern] Re: consistent postgresql snapshot