Re: default_transaction_isolation

Поиск
Список
Период
Сортировка
От Michael Fuhr
Тема Re: default_transaction_isolation
Дата
Msg-id 20070323102607.GA44256@winnie.fuhr.org
обсуждение исходный текст
Ответ на default_transaction_isolation  (Richard Broersma Jr <rabroersma@yahoo.com>)
Ответы Re: default_transaction_isolation  (Richard Broersma Jr <rabroersma@yahoo.com>)
Список pgsql-novice
On Thu, Mar 22, 2007 at 10:21:27PM -0700, Richard Broersma Jr wrote:
> I am wondering why is 'read commited' chosen over any of the other
> isolation levels such as SERIALIZABLE?

If you use SERIALIZABLE then some transactions will need extra logic
to handle SQLSTATE 40001 SERIALIZATION FAILURE ("could not serialize
access due to concurrent update").  The documentation suggests why
SERIALIZABLE isn't the default:

http://www.postgresql.org/docs/8.2/interactive/transaction-iso.html#XACT-SERIALIZABLE

"Since the cost of redoing complex transactions may be significant,
this mode is recommended only when updating transactions contain
logic sufficiently complex that they may give wrong answers in Read
Committed mode."

> A more generalized question would be, are there any application/RDBMS
> design considerations to help determine the best default isolation level?

In addition to the above:

"Most commonly, Serializable mode is necessary when a transaction
executes several successive commands that must see identical views
of the database."

I leave READ COMMITTED as the default and use SERIALIZABLE only in
transactions that need it, such as in reporting applications that
must see consistent results across multiple queries.

--
Michael Fuhr

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

Предыдущее
От: Richard Broersma Jr
Дата:
Сообщение: default_transaction_isolation
Следующее
От: Richard Broersma Jr
Дата:
Сообщение: Re: default_transaction_isolation