From: | "Albe Laurenz" <all(at)adv(dot)magwien(dot)gv(dot)at> |
---|---|
To: | <sudhirj(at)cse(dot)iitb(dot)ac(dot)in> |
Cc: | <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Lock table, Select for update and Serialization error |
Date: | 2007-05-23 07:12:47 |
Message-ID: | AFCCBB403D7E7A4581E48F20AF3E5DB202CF7E68@EXADV1.host.magwien.gv.at |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
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
From | Date | Subject | |
---|---|---|---|
Next Message | Hannes Dorbath | 2007-05-23 08:13:08 | Re: partial word matching |
Previous Message | PFC | 2007-05-23 06:22:24 | Re: Using a trigger with an object-relational manager |