Re: New form of index "persistent reference"

Поиск
Список
Период
Сортировка
От Zeugswetter Andreas DAZ SD
Тема Re: New form of index "persistent reference"
Дата
Msg-id 46C15C39FEB2C44BA555E356FBCD6FA40184D2EC@m0114.s-mxs.net
обсуждение исходный текст
Ответ на New form of index "persistent reference"  (pgsql@mohawksoft.com)
Список 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


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

Предыдущее
От: Sibtay Abbas
Дата:
Сообщение: passing parameters by reference
Следующее
От: Oleg Bartunov
Дата:
Сообщение: any presentation, tutorial on postgresql ?