[OSM-dev] C++ implementation of the API

Tom Hughes tom at compton.nu
Fri May 30 13:54:53 BST 2008

In message <483FE715.6090806 at student.utwente.nl>
        Steven te Brinke <s.tebrinke at student.utwente.nl> wrote:

> The second query uses a join only to select the correct values, not 
> because you really want to join the tables. I think that you can achieve 
> the same by a query like this:
> FROM current_war_tags
> WHERE id IN (
>     SELECT *
>     FROM current_ways
>     WHERE tile IN (...)
>        AND latitude BETWEEN ... AND ...
>        AND longitude BETWEEN ... AND ...
> )
> ORDER BY id;
> However, I do not know how the db handles subqueries. Thus, I am not 
> sure if the performance of this query is better.

MySQL is rubbish at that kind of subquery - it will table scan
the current_ways table and check each one with a lookup in the
external. That's why I wrote it as a join ;-)

My selection criteria were nonsense of course, as this is ways
not nodes...


Tom Hughes (tom at compton.nu)

More information about the dev mailing list