You might find that using "distinct" is causing part of your problem.
If you can avoid it by using an "in" clause, it might be worth doing.
Without knowing your data, I can't be sure whether this will work, but
if the duplication that you're trying to avoid is ONLY due to multiple
nodes for each way or tag, you could try writing this query like this.

select ways_tags.way_id, tag_keys.key, tags.value
from ways_tags
  join tags on ways_tags.tag_id = tags.tag_id
  join tag_keys on tags.key_id = tag_keys.key_id
where ways_tags.way_id in (
    select way_nodes.way_id
    from way_nodes
      join nodes on way_nodes.node_id = nodes.node_id
    where nodes.latitude between 49.00 and 49.22
      and nodes.longitude between 14.88 and 15.10 )

Of course, if the problem is the sheer volume of data, this might not
help you much.  Worth a try, before you change to using a completely
different product.

Good luck,
David.

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en.

Reply via email to