[postgis-users] Overlaps query
Flavio Perri
FPERRI at it.ibm.com
Fri May 25 00:54:42 PDT 2007
postgis-users-bounces at postgis.refractions.net wrote on 25/05/2007 09.41.05:
> Hi,
> I want to query a geometry column using the PostGIS function
> 'overlaps'. The query shoult return the number of overlapping
> geometries in a table.
> Here is the query I tried:
> SELECT COUNT(a.id) FROM tbl1 a, tbl1 b WHERE OVERLAPS(a.geom, b.
> geom) AND a.id <> b.id
> When I run the query, it takes a long time (96528ms) until PostGIS
> returns the result although my table only contains 10 rows. Is there
> a possibility to increase the performance of this query?
> Regards,
> Thorsten
Hi! I think you should use the && operator (a.the_geom && b.the_geom)
instead of the overlaps function (it doesn't use the GIST index, don't know
why) . I had the same problem, and the query went faster!
Bye,
Flavio
More information about the postgis-users
mailing list