tags:

views:

1744

answers:

2

I have a couple tables in which I created an object ID as either an Int or Bigint, and in both cases, they seem to autoincrement by 10 (ie, the first insert is object ID 1, the second is object ID 11, the third is object ID 21, etc). Two questions:

  1. Why does it do that?

  2. Is that a problem?

+6  A: 

Check to see the seed value of the autoincrement isn't set to 10.

You can check by:

SELECT Auto_increment FROM information_schema.tables WHERE table_name='the_table_you_want';

As noted elsewhere you can change by using the system variable @@set_auto_increment_increment

SET @@auto_increment_increment=1;

If you want to start the values at a number other than one you can go:

ALTER TABLE tbl AUTO_INCREMENT = 100;
KiwiBastard
Oh, I found my problem- it's how auto_increment_increment is set. thanks!
HQ says no dice on changing it, and MySQL docs say it can't be altered on a per-table basis. So I guess I'll have to live with an upper limit of 1.8 quintillion IDs rather than 18.4 quintillion.
+2  A: 

The auto increment increment value is set in the MySQL system variables.

See here: http://dev.mysql.com/doc/refman/5.0/en/server-system-variables.html#option_mysqld_auto-increment-increment

Jim Fiorato