Re: Patch to return last tid

Поиск
Список
Период
Сортировка
От Arturo Josè Montes Sinning
Тема Re: Patch to return last tid
Дата
Msg-id 3D84BB3F.7040902@colomsat.net.co
обсуждение исходный текст
Ответ на Re: string not marked for translation  (Peter Eisentraut <peter_e@gmx.net>)
Ответы Re: Patch to return last tid  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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 по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: contrib/cube & contrib/seg regression fixes
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Patch to return last tid