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