Using oids for fast read-only access? - Mailing list pgsql-general

From Christopher Zach
Subject Using oids for fast read-only access?
Date
Msg-id 01081017094801.21947@fcggpc47.icg.tu-graz.ac.at
Whole thread Raw
Responses Re: Using oids for fast read-only access?  (Peter Eisentraut <peter_e@gmx.net>)
List pgsql-general
I've implemented r-trees on top of PostgreSQL (since I need more control over
the r-tree than you can have with the r-tree index that comes with
PostgreSQL) and I would like to know whether there is an efficient way to
dereference the data in the leaves.

Currently the geometry database looks like this:

            Table "geometry"
 Attribute |       Type       | Modifier
-----------+------------------+----------
 id        | integer          |
 x1        | double precision |
 y1        | double precision |
 z1        | double precision |
 x2        | double precision |
 y2        | double precision |
 z2        | double precision |
Indices: geometry_index (on id)

The leaves in the corresponding rtree store id's.
After inserting the geometry, the data is read only, therefore I would like
to replace the id's in the rtree with oids (or anything that has a constant
time access).

The problem is that a "select * from geometry where oid=xxx" is a lot slower
than selecting objects by their id (since the former does a seq scan and the
later an index scan).

The PostgreSQL documentation doesn't say much about oids and their use,
therefore I need al little help...

best wishes,

Christopher Zach

pgsql-general by date:

Previous
From: Travis Bauer
Date:
Subject: PL/Perl on Solaris
Next
From: Tom Lane
Date:
Subject: Re: Re: Bug#108286: case sensitivity in column names