[OSM-dev] Slow Osmosis

Brett Henderson brett at bretth.com
Mon Dec 1 21:41:07 GMT 2008

Andreas Kalsch wrote:
> Brett Henderson schrieb:
>> Whenever I have seen that error in the past it has been because I 
>> have data in the tables already.  Changing table types shouldn't have 
>> any effect on duplicate key checks.  It'd be worth double checking to 
>> make absolutely sure you have no data in the tables already.
> I am very sure. I added an exit ...
>> Andreas Kalsch wrote:
>>> Yes I drop the database completely - part of my shell script:
>>> echo 'Create database, create tables ..'
>>> mysql -u $mysql_user -p$mysql_pw -e "DROP DATABASE IF EXISTS 
>>> utf8_general_ci;"
>>> date
>>> mysql -u $mysql_user -D $db_name -p$mysql_pw < 
>>> jobs/osm_schema_latest_optimized0.sql
> ... here and checked the database: All tables are existing and empty.
In that case I'm stumped.
>>> echo 'Write to database ..'
>>> osmosis/bin/osmosis --read-xml file=$uncompressedFile --write-mysql 
>>> host=localhost database=$db_name user=$mysql_user password=$mysql_pw 
>>> validateSchemaVersion=no
>>> mysql -u $mysql_user -D $db_name -p$mysql_pw < 
>>> jobs/osm_schema_latest_optimized1.sql
>>> date 
> So, probably these constructs (I don't know what thy do), cause trouble:
> /*!40000 ALTER TABLE `sessions` DISABLE KEYS */;
A DISABLE KEYS statement disables (most but not all) indexes for MyISAM 
tables.  Osmosis doesn't touch the sessions table though so that 
particular statement should have no effect.

It appears that you're only getting the error when importing relations 
as indicated by this part of the stack trace.


Relations are the very last bit to be written so you must have written 
nodes and ways successfully.  This statement here:

Duplicate entry '1' for key 1

seems to indicate that you're trying to write a relation with id "1" 
twice.  Can you check your osm file to see how many relations (if any) 
have an id of 1?


More information about the dev mailing list