Re: Learning to hack Postgres - Keeping track of ctids

From: Craig Ringer <craig(at)2ndquadrant(dot)com>
To: Emrul <emrul(at)emrul(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Learning to hack Postgres - Keeping track of ctids
Date: 2016-09-30 01:09:59
Message-ID: CAMsr+YFfxU7GO_YfuGTa-fsp-pXTZQUv4u6KPRM2nqF0uEY_YA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 30 September 2016 at 04:15, Emrul <emrul(at)emrul(dot)com> wrote:
> Hi,
>
> I'm working on an idea to implement a graph database in Postgres. At the
> moment its just a learning exercise.
>
> What I'd like to do is store a reference to all the links from one record
> using an array type that stores links to all related tables.
>
> At first, I've succeeded in doing this using primary key Ids and this works
> fine. However, I'd like to be able to bypass the index lookup altogether by
> storing the ctids in my array instead of the primary key ids.
>
> Trouble of course is that ctids can get changed (like for instance
> vacuuming). So my question is: how can I keep my ctid references up to date
> - is there any way to detect when a ctid is changed?

I expect that you'd have to teach the heapam code, vacuum, etc to do
the required housekeeping.

--
Craig Ringer http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2016-09-30 01:11:56 Re: Hash Indexes
Previous Message Robert Haas 2016-09-30 00:54:15 Re: Hash Indexes