Thread: R-tree index

R-tree index

From
Michel Nadeau
Date:
Hi,

We created a database with some boxes in it. We make spatail queries on
the boxes. like:
SELECT openMapIndex
FROM tableName
WHERE BBOX::box && '((-73,45),(-74,46))';

The query is working fine. We indexed the field BBOX.  It takes about 17
seconds when doing a sequential search and 0.5 second when doing an
indexed scan. Here is our problem. Postgresql does not by default use
the index, which is strange given the benefits of it. When we do the
EXPLAIN command, it says that it will do a sequential search. The only
way we found for it to use the index is to set the "ENABLE_SEQSCAN"
variable to "OFF". But that just work for one session. We are connecting
remotely to the database throught JDBC and we do not find a way to force
the indexed scan.

Anybody has an idea of what we are doing wrong?

Thanks
--
_______________________________________

Michel Nadeau  /  mn@korem.com
Programmeur-Analyste

Le Groupe KOREM inc.
Connaître et gérer son territoire / La géomatique
au service des technologies de l'information.

680, boulevard Charest Est, 1er étage
Québec (Québec)    G1K 3J4
tél. : (418) 647-1555  fax  : (418) 647-1666
http : //www.korem.com
_________________________________________