From: | Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at> |
---|---|
To: | Mariel Cherkassky <mariel(dot)cherkassky(at)gmail(dot)com>, pgsql-admin(at)lists(dot)postgresql(dot)org |
Subject: | Re: unclear behavior xmax/xmin |
Date: | 2018-11-18 19:04:49 |
Message-ID: | 8981328ca8d9ad247ecd203c9f9f206fb63b9e30.camel@cybertec.at |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Andres Freund | 2018-11-18 20:23:59 | Re: unclear behavior xmax/xmin |
Previous Message | Mariel Cherkassky | 2018-11-18 17:13:28 | unclear behavior xmax/xmin |