[OSM-dev] Rantings about API 0.6

Brett Henderson brett at bretth.com
Wed Feb 11 01:56:17 GMT 2009

Iván Sánchez Ortega wrote:
> El Miércoles, 11 de Febrero de 2009, Brett Henderson escribió:
>>> I'm importing brand new data, so populating the history tables is no big
>>> deal.
>> Perhaps I've misunderstood you but populating the history tables is very
>> important.
> I'm afraid we have a little misunderstanding here :-)
> For *new* nodes/ways/relations, the only thing an importer has to do is insert 
> one record in the {node|way|relation} table, and the *same* record in the 
> current_{node|way|relation} table. And ensure that the version number is "1" 
> in both records.
> Inserting two entries per object and setting the version (AKA "populating the 
> history tables") is, as you can see, no big deal. It got coded in a jiffy.
Cool :-)
> (I fail to see why we have to duplicate data here, anyway - I don't know 
> whether it would be performance-wise to just store the historic information, 
> and make the API fetch only the last version; or do as now, but not keeping 
> the last version in the historic tables)
Not keeping the last version in the history tables would make 
replication far more difficult.  Being able to rely on data never 
changing once it is written (which doesn't happen in current tables) 
makes the implementation fairly simple.  If I had to check current 
tables as well I'd have to start locking tables for consistency which 
would open up all kinds of cans of worms.

As for whether the current tables could be eliminated (or perhaps scaled 
back to a pointer record), that is another question entirely.  It would 
complicate queries somewhat which might have a detrimental impact on 
performance but would have advantages in terms of avoiding data 
duplication and potential inconsistencies.


More information about the dev mailing list