Re: Patch to return last tid - Mailing list pgsql-patches

From Arturo Josè Montes Sinning
Subject Re: Patch to return last tid
Date
Msg-id 3D84BB3F.7040902@colomsat.net.co
Whole thread Raw
In response to Re: string not marked for translation  (Peter Eisentraut <peter_e@gmx.net>)
Responses Re: Patch to return last tid  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-patches
Hi

Tom Lane wrote:

> "Arturo =?ISO-8859-15?Q?Jos=E8?= Montes Sinning" <mitosys@colomsat.net.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


pgsql-patches by date:

Previous
From: Tom Lane
Date:
Subject: Re: contrib/cube & contrib/seg regression fixes
Next
From: Tom Lane
Date:
Subject: Re: Patch to return last tid