Re: Patch to return last tid

From: "Arturo Josè Montes Sinning" <mitosys(at)colomsat(dot)net(dot)co>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: Patch to return last tid
Date: 2002-09-15 16:54:23
Message-ID: 3D84BB3F.7040902@colomsat.net.co
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

Hi

Tom Lane wrote:

> "Arturo =?ISO-8859-15?Q?Jos=E8?= Montes Sinning" <mitosys(at)colomsat(dot)net(dot)co> writes:
>
>> How would be a patch to return last tid?
>
>
> TID is completely unstable; I would not recommend any client use it to
> identify rows, and I would certainly not hold still for a protocol
> modification to encourage such usage.

OK, I understand the point, however i am experimenting a serios
performance penalty using rowid to identify rows, because the
oid is a serial and not implement a index method on it.

I am talking about select <select-list> from <table> where oid=<oid>
When the table has thousands records this query is executed by Postgres
as sequential scan. The other problems come from insert. We are paying
an extra cost when insert a row because oid sequence computation.

Then, we decide to use ctid pseudo column, however this value is not
returned by libpq, only the oid, still when the table was created without
oids. I don't want break code, of course, however when the table has not
oid the oid returned is 0 in PQoidvalue and PQcmdStatus (I guess PQoidvalue
fill this value from PQcmdStatus), and then my proposol is send the tid
in a packet integer form instead of oid (0 value). For example, the integer
would be (blocknum<<8)|(recordno). Where blocknum is the number of block
where tuple reside and recordno is the index inside the block.

Thanks

Arturo


> regards, tom lane

In response to

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2002-09-15 17:33:52 Re: Patch to return last tid
Previous Message Tom Lane 2002-09-15 14:28:39 Re: contrib/cube & contrib/seg regression fixes