Re: Pg_dump

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Holger Jakobs <holger(at)jakobs(dot)com>
Cc: pgsql-admin(at)lists(dot)postgresql(dot)org, rajeshkumar(dot)dba09(at)gmail(dot)com
Subject: Re: Pg_dump
Date: 2023-12-07 18:52:49
Message-ID: 1300348.1701975169@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Holger Jakobs <holger(at)jakobs(dot)com> 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

In response to

  • Re: Pg_dump at 2023-12-07 18:13:40 from Holger Jakobs

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message M Sarwar 2023-12-07 19:00:24 Re: Pg_dump
Previous Message jason cable 2023-12-07 18:39:29 Re: Pg_dump