From: | sudhir <sudhirj(at)cse(dot)iitb(dot)ac(dot)in> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Albe Laurenz <all(at)adv(dot)magwien(dot)gv(dot)at>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: Lock table, Select for update and Serialization error |
Date: | 2007-05-22 17:27:59 |
Message-ID: | 4653281F.7030908@cse.iitb.ac.in |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
It is not necessary that LOCK TABLE will be the first statement.
(assuming serializable isolation level is snapshot isolation in postgres)
For serializable transaction, snapshot should be taken when the 'BEGIN'
statement is executed, and not when LOCK TABLE succeeds.
Hence, uncommitted changes should be invisible to serializable transaction.
> The critical point here is that LOCK TABLE commands at the start of a
> serializable transaction are performed *before* taking the transaction's
> snapshot (the snap happens at the first regular DML command). They not
> only protect against post-snap changes as shown by Albe's example, but
> against uncommitted changes that were made before transaction start
> (by making the serializable xact wait until those changes are committed
> or aborted before it takes its snap).
>
>
From | Date | Subject | |
---|---|---|---|
Next Message | Ron Johnson | 2007-05-22 17:40:50 | Re: swap storm created by 8.2.3 |
Previous Message | Steve Crawford | 2007-05-22 17:26:07 | Re: Rounding datetimes |