Performance on multiple OR conditions inside ()

Поиск
Список
Период
Сортировка
От Håvard Wahl Kongsgård
Тема Performance on multiple OR conditions inside ()
Дата
Msg-id AANLkTingN4dwbSubov7_zbZ8+hxZTOsLGtci236yHbVV@mail.gmail.com
обсуждение исходный текст
Список pgsql-general
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/

В списке pgsql-general по дате отправления:

Предыдущее
От: Pavel Stehule
Дата:
Сообщение: Re: Record with a field consisting of table rows
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Record with a field consisting of table rows