OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
Re: How to build sub-sequence ... AUTO_INCREMENT on a sub-key starting with a specific offset?

From: Rob Wultsch (wultschgmail.com)
Date: Wed Oct 15 2008 - 13:04:06 CDT


I would do a muli key PK with a after insert trigger to that would
change widget_number 1 to 1000. Just my HO...

> I would use this combo as the primary key, but I hate doing joins with
> multiple primary keys, so I'll also keep the widget_id for the purpose of
> making joins easier.

Why? Both of these fields are ints, so the key length would rather small.

> I don't think the 'MAX' is optimized, though and maybe there is a better,
> more robust way to do this which is already built into MySQL that I don't
> know about.

MAX should be fast, assuming the field is indexed.

--
Rob Wultsch
wultschgmail.com

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql