From: | "Zeugswetter Andreas DAZ SD" <ZeugswetterA(at)spardat(dot)at> |
---|---|
To: | <pgsql(at)mohawksoft(dot)com>, <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: New form of index "persistent reference" |
Date: | 2005-02-11 11:44:09 |
Message-ID: | 46C15C39FEB2C44BA555E356FBCD6FA40184D2EC@m0114.s-mxs.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
> I asked the question how do you get a record without going through an
> index, the answer was CTID, which unfortunately changes when the row is
> updated.
The ctid is a physical location of the row. On update a new tuple is written
in a new location, that is why the ctid changes. The old tuple has a system field
t_ctid which is then a forward pointer to the new tuple.
Thus you can follow that chain until the visible tuple is found.
The current tid = tid does not do that (I think because the ODBC driver
which was the first to use it (for result set modification) needed to notice when the
tuple was updated underneath).
But you can use:
select * from atab where ctid = currtid2('atab', '(0,1)'); -- '(0,1)' is the old ctid
Of course the old ctid is only valid until (auto)vacuum marks it free.
Without vacuum you are currently safe to use the currtid functions.
Andreas
From | Date | Subject | |
---|---|---|---|
Next Message | Oleg Bartunov | 2005-02-11 14:09:50 | any presentation, tutorial on postgresql ? |
Previous Message | Sibtay Abbas | 2005-02-11 11:24:59 | passing parameters by reference |