Re: Question about OID and TCID - Mailing list pgsql-general

From Dmitriy Igrishin
Subject Re: Question about OID and TCID
Date
Msg-id AANLkTimmE-8PqUhw-OByW8R36SYkTFuxfpBaY8VdRuNM@mail.gmail.com
Whole thread Raw
In response to Question about OID and TCID  (Zhipan Wang <wzhipan@soe.ucsc.edu>)
List pgsql-general
Hey Zhipan,

2010/11/27 Zhipan Wang <wzhipan@soe.ucsc.edu>
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?
Consider to use cursors to read sequentially by FETCH.
http://www.postgresql.org/docs/9.0/static/sql-fetch.html

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?
I believe that VACUUM works well on it.
http://www.postgresql.org/docs/9.0/static/sql-vacuum.html

Thanks!

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



--
// Dmitriy.


pgsql-general by date:

Previous
From: Dave Page
Date:
Subject: [ANNOUNCE] Just 2 days left to register for PGDay.EU 2010
Next
From: Guillaume Lelarge
Date:
Subject: Re: Question about OID and TCID