public inbox for [email protected]  
help / color / mirror / Atom feed
From: Tom Lane <[email protected]>
To: Holger Jakobs <[email protected]>
Cc: [email protected]
Cc: [email protected]
Subject: Re: Pg_dump
Date: Thu, 07 Dec 2023 13:52:49 -0500
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <CAJk5AtZX23PBG4rfrVt6cp3z_pYGtEE5JvvCRG6Lj3F7=1+C2Q@mail.gmail.com>
	<[email protected]>

Holger Jakobs <[email protected]> writes:
> Am 07.12.23 um 19:11 schrieb Rajesh Kumar:
>> Will pg_dump cause blocking queries? If so how to take dump without 
>> blocking?

> Readers don't block writers, writers don't block readers in PostgreSQL.
> pg_dump is a reader.

To enlarge on that a bit: pg_dump takes AccessShareLock on every
table it intends to dump.  This does not conflict with ordinary
DML updates.  It *will* conflict with anything that wants
AccessExclusiveLock, which typically is schema-altering DDL.
See

https://www.postgresql.org/docs/current/explicit-locking.html#LOCKING-TABLES

So the answer to your question is "don't try to alter the
database schema while pg_dump is running".  You can alter
database content freely, though.

			regards, tom lane





view thread (18+ messages)  latest in thread

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 using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected]
  Subject: Re: Pg_dump
  In-Reply-To: <[email protected]>

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

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