| From: | Bo Lorentsen <bl(at)netgroup(dot)dk> |
|---|---|
| To: | Martijn van Oosterhout <kleptog(at)svana(dot)org> |
| Cc: | shridhar_daithankar(at)persistent(dot)co(dot)in, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>, pgsql-hackers(at)postgresql(dot)org |
| Subject: | Re: Using oids |
| Date: | 2003-09-03 16:23:21 |
| Message-ID: | 1062606201.7851.151.camel@localhost |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general pgsql-hackers |
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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Greg Stark | 2003-09-03 16:24:35 | Re: Using oids |
| Previous Message | Adam Kavan | 2003-09-03 16:22:51 | Re: pg_autovacuum |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Greg Stark | 2003-09-03 16:24:35 | Re: Using oids |
| Previous Message | Doug McNaught | 2003-09-03 16:09:00 | Re: Using oids |