You are not logged in.

#1 2020-11-09 10:07:41

Alexey Murz Korepov
Member
Registered: 2020-11-05
Posts: 5

Overpass-API: Does order of conditions affect performance of query?

For example, I need to get all cities of some country, so I built this query:

[out:json][timeout:180];
area["name:en"="Russia"]["boundary"="administrative"]->.myarea;
node(area.myarea)[place="city"];
out qt;

It executes not so quickly, because, seems, Overpass at first lookup all nodes, matched to `myarea`, and after this - filter them via `place="city"`, yes?

So if I modify the query to this:

[out:json][timeout:180];
area["name:en"="Russia"]["boundary"="administrative"]->.myarea;
node[place="city"](area.myarea);
out qt;

Overpass will do first filter of nodes via `place="city"`, that must execute much quicker because of direct match, than area match query, and in second iteration - filter only little part of nodes by `myarea` area.

Is my guess right, or Overpass have some query optimizer, that will do this for all queries?

Last edited by Alexey Murz Korepov (2020-11-09 10:08:17)

Offline

Board footer

Powered by FluxBB