Question about OID and TCID

From: Zhipan Wang <wzhipan(at)soe(dot)ucsc(dot)edu>
To: pgsql-general(at)postgresql(dot)org
Subject: Question about OID and TCID
Date: 2010-11-27 08:52:56
Message-ID: 464718628.766821290847976572.JavaMail.root@mail-01.cse.ucsc.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

I want to access part of a table on the disk sequentially, i,e., when I get to a tuple in the table, I need to read several pages of data in the table starting from this tuple. I guess CTID could be translated to physical address on the disk to retrieve this tuple, right? If so, how do I use CTID to retrieve a particular tuple (or a page) in SQL? Can I use OID to do this equally efficiently?

Another question is: when I update a tuple in a table, this tuple will get a new CTID and it leaves a gap at the old CTID, and when I insert a new tuple, it's appended to the end of the table, so the gap is always there. Does this mean it actually inserts a new tuple and the out-dated tuple still occupies the space? How can I write the updated tuple back to its original position to utilize disk space more efficiently?

Thanks!

Responses

Browse pgsql-general by date

  From Date Subject
Next Message c k 2010-11-27 11:08:27 Re: plpyhton
Previous Message Robert Haas 2010-11-27 00:11:09 Re: [GENERAL] column-level update privs + lock table