On Thu, 2011-01-13 at 17:47 +0100, Håvard Wahl Kongsgård wrote:
> Hi, I have a spatial query with multiple OR statements, for large
> tables it's very slow. Is it possible to skip the spatial lookup on
> the other conditions if first(previous) condition equal 1, and thereby
> increase the performance?
>
> SELECT vciia_main.sitrp,vciia_main.date_time from vciia_main,
> south_vietnam72, roads, rails, houses, city where
> st_within(vciia_main.geom, south_vietnam72.geom) and date_time is not
> null and (st_dwithin(vciia_main.geom, roads.geom, 500) OR
> st_dwithin(vciia_main.geom, rails.geom, 500) or
> st_dwithin(vciia_main.geom, city.geom, 800) or
> st_dwithin(vciia_main.geom, houses.the_geom, 500))
>
> --
> Håvard Wahl Kongsgård
> Peace Research Institute Oslo (PRIO)
>
>
http://havard.security-review.net/ >