Re: Question Regarding Locks
От | Martijn van Oosterhout |
---|---|
Тема | Re: Question Regarding Locks |
Дата | |
Msg-id | 20041029093408.GA28624@svana.org обсуждение исходный текст |
Ответ на | Re: Question Regarding Locks (Karsten Hilbert <Karsten.Hilbert@gmx.net>) |
Ответы |
Re: Question Regarding Locks
|
Список | pgsql-general |
On Fri, Oct 29, 2004 at 09:22:42AM +0200, Karsten Hilbert wrote: > The docs say that XMIN is the transaction ID of the *inserting* > transaction for this row version. IOW updates will change XMIN. > Will XMIN also be changed by a *deleting* transaction ? I guess > it depends on how deletion is handled: Either the *unchanged* > row version is marked as deleted (hence XMIN would not change) > OR a new row version is created and marked deleted (which would > indeed change xmin). You need to look at it in conjunction with XMAX. A newly insert row has XMIN set and XMAX null. When a row is updated the XMAX of the old row is set and a new row is created with an XMIN. When you delete a row it just sets the XMAX. > IOW, can I also detect my row being *deleted* from under me by > another transation by way of checking XMIN ? Else I would > likely need to check XMAX, too. Easy, look for it. If you can't find it, it got deleted... -- Martijn van Oosterhout <kleptog@svana.org> http://svana.org/kleptog/ > Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a > tool for doing 5% of the work and then sitting around waiting for someone > else to do the other 95% so you can sue them.
Вложения
В списке pgsql-general по дате отправления: