Ivan Sergio Borgonovo | 1 Jun 2008 23:05
Picon

Re: Multiple result sets

On Sun, 1 Jun 2008 15:36:14 -0500
"Adam Rich" <adam.r <at> sbcglobal.net> wrote:

> I am not familiar with the python library, but that looks correct
> to me. You can always test it by adding a sleep between your two
> queries and modifying the database from a console connection
> during the sleep.

> Note that I'm assuming your 5 queries are all read-only selects. 
> If you're modifying data during your queries, and another
> concurrent database connection modifies the same data during your
> transaction, the later modifications will fail under serializable
> isolation.

Which one will fail? the second query or the serializable
transaction.

My understanding was that the serializable transaction will fail.

-- 
Ivan Sergio Borgonovo
http://www.webthatworks.it

--

-- 
Sent via pgsql-general mailing list (pgsql-general <at> postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Adam Rich | 1 Jun 2008 23:19
Picon
Favicon

Re: Multiple result sets


> > I am not familiar with the python library, but that looks correct
> > to me. You can always test it by adding a sleep between your two
> > queries and modifying the database from a console connection
> > during the sleep.
> 
> > Note that I'm assuming your 5 queries are all read-only selects.
> > If you're modifying data during your queries, and another
> > concurrent database connection modifies the same data during your
> > transaction, the later modifications will fail under serializable
> > isolation.
> 
> Which one will fail? the second query or the serializable
> transaction.
> 
> My understanding was that the serializable transaction will fail.
> 

Yes, serializable transactions fail if they attempt to modify data
which has changed since the beginning of the transaction.  If the
OP's ajax call kicks off 5 queries in a serializable transaction,
there is the potential for failure if two ajax calls initiate 
simultaneous serializable  transactions modifying data.

--

-- 
Sent via pgsql-general mailing list (pgsql-general <at> postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

(Continue reading)


Gmane