Re: Using oids - Mailing list pgsql-general

From Bo Lorentsen
Subject Re: Using oids
Date
Msg-id 1062606201.7851.151.camel@localhost
Whole thread Raw
In response to Re: Using oids  (Martijn van Oosterhout <kleptog@svana.org>)
List pgsql-general
On Wed, 2003-09-03 at 17:28, Martijn van Oosterhout wrote:

> If you know the OID of a row, PostgreSQL doesn't have a special lookup table
> to find it. That's also why they're not unique; the backend would have to
> scan through every table to find out if the next one is available.
Ahh, thats not nice, hav'nt checked that, yet.

> So, unless you specifically add an index to the table, looking up by OID
> will always trigger a sequential scan.
I thought it was much more easy for PG to find these, but I quess ctid
are the one that is fast to find.

> That said, there is no reason why someone couldn't create a last_sequence()
> function so you could say SELECT currval( last_sequence() ). Ofcourse, if
> your table has no SERIAL field, you're stuffed either way.
Not as nice as oid's.

/BL


pgsql-general by date:

Previous
From: Josué Maldonado
Date:
Subject: Access to an element of array NEW in TCL
Next
From: Ron Johnson
Date:
Subject: Re: What is the good equivalent for ENUM ?