You could create an extra table in order to record the max number of widget,the the ID should alway be 1.
On Thu, Oct 16, 2008 at 2:04 AM, Rob Wultsch <[EMAIL PROTECTED]> wrote: > 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 > [EMAIL PROTECTED] > > -- > MySQL General Mailing List > For list archives: http://lists.mysql.com/mysql > To unsubscribe: > http://lists.mysql.com/[EMAIL PROTECTED] > > -- I'm a MySQL DBA in china. More about me just visit here: http://yueliangdao0608.cublog.cn