[postgis] Geographic Indexing
Paul Ramsey
pramsey at refractions.net
Thu Jun 7 12:43:37 PDT 2001
I have created a GiST spatial index on the 'geom' DRA table using the
following command:
create index geom_geoidx on geom using gist ( lineargeometry
gist_geometry_ops ) with (islossy);
You can do a spatial query on a bounding box with commands like this:
enable_seqscan = off;
select * from geom where lineargeometry && 'BOX3D(-147.1 50,-147
50.1)'::box3d;
The '&&' operator is the 'overlaps' operator. It will return any feature
which has a bounding box which overlaps the specified bounding box.
The 'enable_seqscan = off' commands forces the planner to use the index.
You'll want to be judicious about using this in your day-to-day work,
because there are cases where a sequence scan is a more efficient thing
to do than an index scan (on small tables, for example, or when the
return set is going to be quite large).
(For the list, this is a usage example.)
--
__
/
| Paul Ramsey
| Refractions Research
| Email: pramsey at refractions.net
| Phone: (250) 885-0632
\_
To unsubscribe from this group, send an email to:
postgis-unsubscribe at yahoogroups.com
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
More information about the postgis-users
mailing list