[OSM-dev] Potlatch update
frederik at remote.org
Tue May 8 20:50:52 BST 2007
>> Pray that the SQL engine is smart enough to apply the bounding box
>> constraint first and not pair up all the nodes in the world ;-)
> Unfortunately it isn't. :(
> The query takes many, many minutes to complete. It runs at an almost
> passable speed if you just use one half of the 'ON', i.e. ON
Someone once told me that Mysql is too dumb to use an index inside an OR
condition and that one would therefore be better off with UNIONs. So,
SELECT column1 FROM table WHERE column1="x" OR column2="x"
SELECT column1 FROM table WHERE column1="x" UNION SELECT column1 FROM
table WHERE column2="x"
I do not know if this may be the problem here (and what Mysql version
the guy was talking about), and if it is, I have no idea how to
translate the UNION solution into something you could use.
LEFT OUTER JOIN current_segments cs1
LEFT OUTER JOIN current_segments cs2
WHERE (latitude BETWEEN 51.7047726979662 AND 51.8310050584275)
AND (longitude BETWEEN -1.37151000827839 AND -1.11118408054402)
AND cs1.id IS NULL
AND cs2.id IS NULL
That might work?
Frederik Ramm ## eMail frederik at remote.org ## N49°00.09' E008°23.33'
More information about the dev