Re: unclear behavior xmax/xmin

Поиск
Список
Период
Сортировка
От Laurenz Albe
Тема Re: unclear behavior xmax/xmin
Дата
Msg-id 8981328ca8d9ad247ecd203c9f9f206fb63b9e30.camel@cybertec.at
обсуждение исходный текст
Ответ на unclear behavior xmax/xmin  (Mariel Cherkassky <mariel.cherkassky@gmail.com>)
Список pgsql-admin
Mariel Cherkassky wrote:
> - I started transaction A and deleted one row but I didnt commit.
>   Afterwards I rolledback the transaction but the xmax of the row was set
>   to the txid of transaction A. I opened a new session and run VACUUM on the table.
>   However, that record wasnt deleted but the xmax was still set to
>   transaction`s A txid. Is that a bug ? the vacuum process shouldnt delete
>   that row because it has an old xmax (there arent any younger transactions).
>   In addition, I'm still capable of seeing the record (because of the rollback..)
>   but my txid is bigger then the xmax of the record. ? Is that a bug ?

I wrote about that a whil ago, see
https://www.cybertec-postgresql.com/en/whats-in-an-xmax/

> -When I run an update basically its just like running an  insert and delete
>  (the xmax of the old row is changed to the transaction`s txid and the new row
>  contains xmin same as txid of the current transaction and xmax is set to 0).
>  However, when I query the table (didnt commit yet) I dont see the old record.
>  Is there a way to see it ? Why is that ? I thought that I should see the table
>  with a non zero value in the xmax col.

In the transaction that ran the UPDATE, you will of course see the updated
row.  Everything else would be inconsistent.

You have to start a second database session if you want to see the previous
row version.

Yours,
Laurenz Albe
-- 
Cybertec | https://www.cybertec-postgresql.com



В списке pgsql-admin по дате отправления:

Предыдущее
От: Mariel Cherkassky
Дата:
Сообщение: unclear behavior xmax/xmin
Следующее
От: Andres Freund
Дата:
Сообщение: Re: unclear behavior xmax/xmin