Page 1 of 1

to auto increment or not to

Posted: Fri Aug 18, 2006 10:19 am
by GeXus
For the ID column of a table, is there any reason not to auto increment? I know for replication it could be a problem, having to disable it on the replicated servers... but other than that is there any other problem with auto incrementing ids?

Posted: Fri Aug 18, 2006 10:25 am
by feyd
It's largely dependant on how your system needs to work. Generally speaking, I use auto_increment on the primary ID column nearly always. Whether a table has such a column or not depends on the function of the table. Cross linking tables rarely, if ever, need such a column for instance. Ancillary user tables will often have the user_id as primary key, since it's foreign, it's not auto-incremented.

Posted: Fri Aug 18, 2006 10:29 am
by GeXus
Perfect.. thanks!