Re: About backups

From: PetSerAl <petseral(at)gmail(dot)com>
To: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: About backups
Date: 2026-01-29 19:04:25
Message-ID: CAKygsHQutckTNjVaxhOKmP3x8C-dG6C-RiR8XapEo8Ozng1nhg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Jan 29, 2026 at 9:37 PM Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com> wrote:
> The window for this sort of thing isn't very large,

That window can be arbitrary large. It includes time waiting for locks
to be released from tables of interest.

--to reduce deadlocks take strongest lock first
--TRUNCATE requare ACCESS EXCLUSIVE
LOCK tablename;
--large amount of work
SELECT pg_sleep(10);
TRUNCATE tablename;

Now you have +10 seconds for the window for tablename and all
following tables in lock order.
IMHO, hidden data loss from TRUNCATE is much more sinister, than error
from ALTER TABLE.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message stevej@stevej.name 2026-01-29 20:29:46 What happens if the socket lock file is deleted?
Previous Message Adrian Klaver 2026-01-29 18:37:31 Re: About backups