I agree with Tom. This is making the difference. I ran into this scenario several times in the past.
But whole database is becoming slow when the dump is happening .
Thanks,
Sarwar
From: Tom Lane <tgl@xxxxxxxxxxxxx>
Sent: Thursday, December 7, 2023 1:52 PM To: Holger Jakobs <holger@xxxxxxxxxx> Cc: pgsql-admin@xxxxxxxxxxxxxxxxxxxx <pgsql-admin@xxxxxxxxxxxxxxxxxxxx>; rajeshkumar.dba09@xxxxxxxxx <rajeshkumar.dba09@xxxxxxxxx> Subject: Re: Pg_dump Holger Jakobs <holger@xxxxxxxxxx> 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://na01.safelinks.protection.outlook.com/?url=""> 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 |