Re: get/setReadOnly broken if default_transaction_read_only on

Поиск
Список
Период
Сортировка
От Kevin Grittner
Тема Re: get/setReadOnly broken if default_transaction_read_only on
Дата
Msg-id 4FCF7C210200002500048132@gw.wicourts.gov
обсуждение исходный текст
Ответ на get/setReadOnly broken if default_transaction_read_only on  (J Chapman Flack <jflack@math.purdue.edu>)
Список pgsql-jdbc
J Chapman Flack <jflack@math.purdue.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

В списке pgsql-jdbc по дате отправления:

Предыдущее
От: J Chapman Flack
Дата:
Сообщение: get/setReadOnly broken if default_transaction_read_only on
Следующее
От: Craig Ringer
Дата:
Сообщение: Re: get/setReadOnly broken if default_transaction_read_only on