Re: ctid access is slow

From: "Jeff Eckermann" <jeff_eckermann(at)yahoo(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: ctid access is slow
Date: 2005-08-23 23:56:10
Message-ID: degd2r$1tv1$1@news.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

""Ilja Golshtein"" <ilejn(at)yandex(dot)ru> wrote in message
news:430B2C5D(dot)000008(dot)17678(at)mfront7(dot)yandex(dot)ru(dot)(dot)(dot)
> Hello!
>
>>On Tue, Aug 23, 2005 at 09:15:42AM -0400, Robert Treat wrote:
>>> On Tuesday 23 August 2005 08:39, Ilja Golshtein wrote:
>>> >
>>> > select ctid from aaa where ctid in (select ctid from aaa limit 10);
>
>>Aside from that, ctid is of type tid, and its equality operator
>>isn't hashable.
>
> It is the piece of knowledge I failed to deduce exploring
> plans of queries ;(.
>
> So I have no better solution then creating indexed
> field of serial type, have I?
>
> The only thing I am curios is ctid good for
> anything from user point of view?

The ctid value can be useful in a multi user application, to check whether a
record has been changed by another user, before committing changes.
Whenever a record is updated the ctid value will be changed, so by storing
the ctid value when first fetching the record, that can be compared with the
current ctid value before doing the update.

>
> Thanks a lot.
>
> --
> Best regards
> Ilja Golshtein
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: explain analyze is your friend
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jim C. Nasby 2005-08-24 01:11:49 Re: ctid access is slow
Previous Message Mark Probert 2005-08-23 23:36:01 Re: [newbie] server startup