Re: Question about OID and TCID

From: Dmitriy Igrishin <dmitigr(at)gmail(dot)com>
To: Zhipan Wang <wzhipan(at)soe(dot)ucsc(dot)edu>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Question about OID and TCID
Date: 2010-11-28 08:41:06
Message-ID: AANLkTimmE-8PqUhw-OByW8R36SYkTFuxfpBaY8VdRuNM@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hey Zhipan,

2010/11/27 Zhipan Wang <wzhipan(at)soe(dot)ucsc(dot)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(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>

--
// Dmitriy.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Guillaume Lelarge 2010-11-28 08:59:46 Re: Question about OID and TCID
Previous Message Emanuel Calvo Franco 2010-11-27 18:26:24 Re: array_agg + limit