Re: Transaction control overhauling

From: Magnus Hagander <magnus(at)hagander(dot)net>
To: Daniele Varrazzo <daniele(dot)varrazzo(at)gmail(dot)com>
Cc: psycopg(at)postgresql(dot)org
Subject: Re: Transaction control overhauling
Date: 2011-05-12 11:57:02
Message-ID: BANLkTikpovCyq=nMQ2QCW2r2ErfGp9KJeA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: psycopg

On Thu, May 12, 2011 at 00:43, Daniele Varrazzo
<daniele(dot)varrazzo(at)gmail(dot)com> wrote:
> Hello,

A couple of quick notes (don't know enough to answer the implementation details)

> 2. when starting a transaction, it executes "begin; set isolation
> level LEVEL" after what received in 1.

You are aware this can be done in one query, right? just "BEGIN
ISOLATION LEVEL SERIALIZABLE".. That should be marginally more
efficient.

> I. don't issue any query at startup and, by default, don't pass any
> isolation level together with BEGIN:

That seems very reasonable, particularly the first one :-)

> II. add a method conn.set_transaction(isolation_level=None,
> read_only=None, deferrable=None) allowing to change one or more of the
> transaction settings. Calling the method would terminate the current
> transaction and put the new settings in place. Note that there are
> several ways for implementing this:

Ugh. Big -1 on the "terminate current transaction". First of all, I
*assume* you mean ROLLBACK and not COMMIT. But even so, I think it's a
much better idea to raise a local exception when trying to change it
while inside a transaction.

> VI. don't write so many lists in a single email anymore: I'm out of alphabets.

Nah, just switch alphabet!

--
 Magnus Hagander
 Me: http://www.hagander.net/
 Work: http://www.redpill-linpro.com/

In response to

Responses

Browse psycopg by date

  From Date Subject
Next Message Federico Di Gregorio 2011-05-12 12:13:09 Re: Transaction control overhauling
Previous Message Daniele Varrazzo 2011-05-12 10:36:42 Re: Transaction control overhauling