<div dir="ltr"><div class="gmail_quote">On Thu, Oct 9, 2008 at 1:44 PM, Ian Dees <span dir="ltr"><<a href="mailto:ian.dees@gmail.com">ian.dees@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div dir="ltr"><div class="Ih2E3d">On Wed, Oct 8, 2008 at 9:35 PM, Stefan de Konink <span dir="ltr"><<a href="mailto:stefan@konink.de" target="_blank">stefan@konink.de</a>></span> wrote:<br></div><div class="gmail_quote">
<div class="Ih2E3d"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br><div><br>
</div>No way! The database[1] uses indexing under the hood automatically. So<br>
every created_by k or JOSM v is automatically indexed. This gives a<br>
significant space reduction plus fast lookup.<br>
<br>
Next to that it is very easy now to do lookups like done in OSMXAPI,<br>
which I wrote my own implementation for.<br>
<br>
</blockquote></div><div><br>So you do want to use tag lookups. Ok, just add an extra numeric value to your primary key of {wayid,k} so that it looks like {wayid,k,number}. When you insert, look for duplicate tag keys and change the "number" when you find a duplicate. </div>
</div></div></blockquote></div><br>I had the same issue with the osmosis pgsql schema.  To get around the problem I didn't create a public key for the table.  Instead I created a non-unique index on the way_id column to allow efficient retrieval of tags for a way.<br>
<br>The table definition (PostgreSQL) looks like this:<br>CREATE TABLE way_tags<br>(<br>  way_id bigint NOT NULL,<br>  k text NOT NULL,<br>  v text<br>);<br>CREATE INDEX idx_way_tags_way_id<br>  ON way_tags<br>  USING btree<br>
  (way_id);<br><br></div>