Re: ctid access is slow - Mailing list pgsql-general

From Jeff Eckermann
Subject Re: ctid access is slow
Date
Msg-id degd2r$1tv1$1@news.hub.org
Whole thread Raw
In response to ctid access is slow  ("Ilja Golshtein" <ilejn@yandex.ru>)
Responses Re: ctid access is slow  ("Jim C. Nasby" <jnasby@pervasive.com>)
List pgsql-general
""Ilja Golshtein"" <ilejn@yandex.ru> wrote in message
news:430B2C5D.000008.17678@mfront7.yandex.ru...
> 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
>



pgsql-general by date:

Previous
From: Robert Treat
Date:
Subject: Re: ctid access is slow
Next
From: Mark Probert
Date:
Subject: Re: [newbie] server startup