Re: BEGIN WORK READ ONLY; - Mailing list pgsql-general

From Ron Johnson
Subject Re: BEGIN WORK READ ONLY;
Date
Msg-id 453146C7.60902@cox.net
Whole thread Raw
In response to Re: BEGIN WORK READ ONLY;  (Michael Fuhr <mike@fuhr.org>)
List pgsql-general
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 10/14/06 14:35, Michael Fuhr wrote:
> On Sat, Oct 14, 2006 at 11:35:12AM -0700, Joshua D. Drake wrote:
>> What is the use case for a READ ONLY transaction?
>
> I use read-only transactions as a safety net for interactive sessions
> when I want to avoid modifying anything accidentally.  Here's an
> example:
>
> CREATE ROLE foo LOGIN PASSWORD 'password';
> CREATE ROLE foo_ro LOGIN PASSWORD 'password';
> ALTER ROLE foo_ro SET default_transaction_read_only TO on;
> GRANT foo TO foo_ro;
>
> The foo_ro role now has the same privileges as foo but it can't
> modify anything because its transactions are read-only by default.

Another benefit (with ISOLATION LEVEL SERIALIZABLE) is that you are
guaranteed to have unchanging source data, no matter how many ways
you aggregate, join and WHERE it.

As Tom notes, other RDBMSs do pre-query optimizations.  SET TRANS
READ ONLY tells the engine that these statements won't have to take
out concurrent write locks, and can thus take a different, faster
code path.

- --
Ron Johnson, Jr.
Jefferson LA  USA

Is "common sense" really valid?
For example, it is "common sense" to white-power racists that
whites are superior to blacks, and that those with brown skins
are mud people.
However, that "common sense" is obviously wrong.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)

iD8DBQFFMUbHS9HxQb37XmcRAu1FAJ9jBwddmyS5V0IQgbeZYS8Jv85W/wCgpeAf
j3jNyYxx7RWT74ed5YrfNLA=
=rLJe
-----END PGP SIGNATURE-----

pgsql-general by date:

Previous
From: "A. Kretschmer"
Date:
Subject: Re: BEGIN WORK READ ONLY;
Next
From: "Merlin Moncure"
Date:
Subject: Re: more anti-postgresql FUD