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

Tom Hughes tom at compton.nu
Fri May 30 09:43:03 BST 2008

In message <44d06e000805300136g56758eefq1063ec0077f5a3c3 at mail.gmail.com>
        Alex Wilson <alex_wilson at pobox.com> wrote:

> Ah. good point - a sensible third way. Apologies for missing it, I'm a
> relative SQL novice. However, if you fetch the tags along with the ways
> using a join, given that there are potentially many tags per way - couldn't
> you end up with considerable duplication of the way data in the query
> result? I suppose one would have to profile both the join method and my
> local storage method to see which had better memory and time performance.

You will get some duplication, yes. How much that matters will be
down to profiling as you say.

The other option is to run two queries in parallel:

  FROM current_ways
  WHERE tile IN (...)
    AND latitude BETWEEN ... AND ... 
    AND longitude BETWEEN ... AND ... 
  ORDER BY id;


  SELECT cwt.*
  FROM current_way_tags cwt
  INNER JOIN current_ways cw ON cwt.id = cw.id
  WHERE cw.tile IN (...)
    AND cw.latitude BETWEEN ... AND ... 
    AND cw.longitude BETWEEN ... AND ... 
  ORDER BY cwt.id

then read both result sets at the same time and match them up.


Tom Hughes (tom at compton.nu)

More information about the dev mailing list