Re: get/setReadOnly broken if default_transaction_read_only on

From: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>
To: "J Chapman Flack" <jflack(at)math(dot)purdue(dot)edu>, <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: get/setReadOnly broken if default_transaction_read_only on
Date: 2012-06-06 20:49:53
Message-ID: 4FCF7C210200002500048132@gw.wicourts.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

J Chapman Flack <jflack(at)math(dot)purdue(dot)edu> wrote:

> AbstractJdbc2Connection initializes its readOnly member to a
> hardcoded false instead of to 'show default_transaction_read_only'
> from the backend.

> An application can work around (2) by always calling
> setReadOnly(true);setReadOnly(false); if it wants to write.
> But that's a bit ugly.
>
> The driver could do that too for a quick hack, but it would
> be nice to query the correct value from the backend and use that.

+1

This may become increasingly important as Serializable Snapshot
Isolation becomes more popular. Read only transactions are
significantly more efficient than read-write transactions at the
serializable transaction isolation level in PostgreSQL version 9.1
or higher. Since our shop has about 90% read only transactions in
common workloads, we have set some servers to
default_transaction_read_only = on in the configuration file and
only turn it off for those transactions which write (or might need
to write). It would be nice to drop that workaround for the current
behavior. It should probably do something similar to what's done
for transaction isolation level on connection.

-Kevin

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Craig Ringer 2012-06-07 10:50:15 Re: get/setReadOnly broken if default_transaction_read_only on
Previous Message J Chapman Flack 2012-06-06 20:11:52 get/setReadOnly broken if default_transaction_read_only on