pg_dump transaction's read-only mode

From: Pavan Deolasee <pavan(dot)deolasee(at)gmail(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: pg_dump transaction's read-only mode
Date: 2012-09-07 04:52:46
Message-ID: CABOikdMUwdhR6nbFqMdAuhacNJ-mRS7=++DCmO5O_LfvSZTZow@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I'm looking at the following code in pg_dump.c

/*
* Start transaction-snapshot mode transaction to dump consistent data.
*/
ExecuteSqlStatement(fout, "BEGIN");
if (fout->remoteVersion >= 90100)
{
if (serializable_deferrable)
ExecuteSqlStatement(fout,
"SET TRANSACTION ISOLATION LEVEL "
"SERIALIZABLE, READ ONLY, DEFERRABLE");
else
ExecuteSqlStatement(fout,
"SET TRANSACTION ISOLATION LEVEL "
"REPEATABLE READ");
}
else
ExecuteSqlStatement(fout,
"SET TRANSACTION ISOLATION LEVEL SERIALIZABLE");

Is there a reason why we do not the RR transaction as READ ONLY above
? I understand that unlike in the case of SERIALIZABLE transaction, it
may not have any performance impact. But isn't it a good practice
anyways to guard against any unintended database modification while
taking a dump or a safe guard against any future optimizations for
read-only transactions ? More so because RR seems to the default for
pg_dump

Thanks,
Pavan

Browse pgsql-hackers by date

  From Date Subject
Next Message Gezeala M. Bacuño II 2012-09-07 06:45:18 Re: BUG #7521: Cannot disable WAL log while using pg_dump
Previous Message Pavan Deolasee 2012-09-07 03:48:57 Re: BUG #7521: Cannot disable WAL log while using pg_dump