Re: Doubts about oid

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: Doubts about oid
Дата
Msg-id 20100219134754.GB5735@alvh.no-ip.org
обсуждение исходный текст
Ответ на Re: Doubts about oid  (Jayadevan M <Jayadevan.Maymala@ibsplc.com>)
Список pgsql-general
Jayadevan M escribió:

> I am an Oracle guy who is learning PostgreSQL. oid sounded a lot like
> rowid in Oracle. In Oracle, access by rowid is expected to be the fastest
> way of accessing a record, faster than even an index access followed by
> table access using the primary key. That was why I have this doubt about
> usage of oid being deprecated. Even if we use a sequence as PK (which is
> there in Oracle too), it is not as fast as access by rowid (I don't know
> if this applies to PostgreSQL's oid too). This is important when we use a
> cursors in an Oracle procedure (function in PostgreSQL) and loop through
> it and update specific records, when some conditions are met. Of course,
> that approach has its drawbacks -as in the case when row movement is
> enabled some maintenance activity moves the row to another location.

I suppose you could use a cursor and then

UPDATE ... WHERE CURRENT OF <the cursor>

> Another scenario is when we want to delete duplicate records in a table.

You can use the ctid system column for this.  This column represents the
physical position of the row in the table, so it changes in many
situations, for example during an UPDATE.

--
Alvaro Herrera                                http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

В списке pgsql-general по дате отправления:

Предыдущее
От: Jignesh Shah
Дата:
Сообщение: Re: How to get the users name from users group?
Следующее
От: Chris Barnes
Дата:
Сообщение: Re: Setting a table to be ignored by autovacuum