[postgis-users] Query help
Stephen Crawford
src176 at psu.edu
Wed Apr 18 10:14:24 PDT 2007
Hello All,
I have a query that gets the name and id of all the features from table Y
that intersect a feature fro table X:
SELECT DISTINCT(m.mlra_name) AS name,m.mlra_reg_s as id FROM mlra AS m,
mo_org AS o
WHERE m.the_geom && o.the_geom
AND intersects(m.the_geom,o.the_geom)
AND o.mo = 1;
Is this an efficient way to write this query? I have a gist index on the
mlra table, so I included the line:
WHERE m.the_geom && o.the_geom
In hope that it would speed things up, because it should use the gist index.
Am I correct? It doesn't seem to make a difference. I run vacuum analyze.
How can I check the geometry stats, and how can I tell if the index is being
used?
Thanks,
Steve
Stephen Crawford
Center for Environmental Informatics
GeoVISTA Center
The Pennsylvania State University
814.865.9905
src176 at psu.edu
More information about the postgis-users
mailing list