Re: ctid & updates

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Joshua b(dot) Jore" <josh(at)greentechnologist(dot)org>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: ctid & updates
Date: 2002-06-04 00:05:17
Message-ID: 13244.1023149117@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Joshua b. Jore" <josh(at)greentechnologist(dot)org> writes:
> I noticed that ctid changes on update (as expected since it's really a new
> row). Is there anyway to get the new ctid from the update so later
> updates to the row can continue to use ctid to zero in on the row
> location?

There's a function called something like currtid that takes the
CTID of the possibly-obsoleted row and returns the CTID of its latest
updated version. I believe this is exported because the ODBC driver
uses it, so it's unlikely to go away, even though AFAIR it's not
documented anywhere. A risk of using it is that CTID of an updated
row cannot be trusted for very long --- once VACUUM has come by,
you might find that CTID reassigned to some other row entirely.

> Can anything interesting be done with the empty space? Is there any
> way to find the maximum ctid and look for quantities of empty space?

I don't think CTID gives you any useful hint about the amount of free
space available on a page.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Joshua b. Jore 2002-06-04 01:32:12 Re: ctid & updates (or speedy updates/deletes)
Previous Message Tom Lane 2002-06-03 23:48:19 Re: strangeness in pg_dump