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