[postgis-users] Invoking GIST index on 2 disjoints within a query
nw
nw at hydaspes.if.org
Thu Apr 3 15:01:43 PDT 2008
On Apr 3, 2008, at 16:12, Dylan Lorimer wrote:
> What I want is to find out which polygons in table A
> are disjoint from all polygons in tables B and C.
> Here's the (slightly generalized) query I think I should be using:
>
> SELECT <some stuff> FROM A, B, C WHERE disjoint(A.the_geom,
> B.the_geom) AND disjoint(A.the_geom, C.the_geom) AND <some other
> attribute filters> AND A.the_geom && B.the_geom AND A.the_geom &&
> C.the_geom;
>
> I've not seen this query complete successfully as it takes so long,
> but I think something is wrong with it as running it against only A
> and B is really quick and there aren't too many geometries in the
> tables.
>
> Thoughts?
Use a union.
select <some stuff> from <working a vs b query>
union
select <some compatible stuff> from <working a vs c query>
;
--
nw
nw at hydaspes.if.org
More information about the postgis-users
mailing list