Unix Technical Forum

Lock table, Select for update and Serialization error

This is a discussion on Lock table, Select for update and Serialization error within the Pgsql General forums, part of the PostgreSQL category; --> One last comment: sudhir wrote: > T1# BEGIN -- snapshot taken > T1# Set transaction isolation level serializable; > ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > Pgsql General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #11 (permalink)  
Old 04-09-2008, 06:23 PM
Albe Laurenz
 
Posts: n/a
Default Re: Lock table, Select for update and Serialization error

One last comment:

sudhir wrote:
> T1# BEGIN -- snapshot taken
> T1# Set transaction isolation level serializable;
> T2# BEGIN -- snapshot taken
> T2# Set transaction isolation level serializable;
> T1# Update account set bal=bal-100 where accno=129;


The 'snapshot taken' are misplaced.

The snapshots are actually taken when the first 'real'
statement in the transaction is executed.

In the case of T1, this would be at
Update account set bal=bal-100 where accno=129;

This is, as Tom Lane has pointed out, the reason why
locking the table as first statement in a transaction
will prevent serialization errors.

Tom said, 'the first DML statement', but as far as I know
a SELECT statement will also cause the snapshot to be taken.

Yours,
Laurenz Albe

---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

http://archives.postgresql.org/

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 09:07 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com