[OSM-dev] Alternative PostgreSQL Schema

Tom Hughes tom at compton.nu
Wed Oct 24 15:31:24 BST 2007


In message <471F5573.6060005 at bretth.com>
        Brett Henderson <brett at bretth.com> wrote:

> Tom Hughes wrote:
>
>> There's also a question of how to handle version number allocation - we
>> currently rely on an obscure feature of MyISAM tables to do it...
>>  
> That's something else I was curious about.  I had assumed that this was 
> being done in code.  In other words using a sequence to allocate the 
> main id then incrementing in code with any concurrent edits resulting in 
> a key violation.

Nope - the version number is an auto increment column. See:

  http://dev.mysql.com/doc/refman/5.1/en/example-auto-increment.html

In particular the bit about MyISAM and auto increment fields which
are secondary index columns:

  "For MyISAM tables you can specify AUTO_INCREMENT on a secondary
   column in a multiple-column index. In this case, the generated
   value for the AUTO_INCREMENT column is calculated as
   MAX(auto_increment_column) + 1 WHERE prefix=given-prefix. This is
   useful when you want to put data into ordered groups.

Tom

-- 
Tom Hughes (tom at compton.nu)
http://www.compton.nu/




More information about the dev mailing list