Re: MySQL auto_increment fields Server version: 5.1.32-community-log

From: Date: Sun, 09 Aug 2009 23:17:21 +0000
Subject: Re: MySQL auto_increment fields Server version: 5.1.32-community-log
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-296529@lists.php.net to get a copy of this message
I should mention that I use MyISAM as storage engine what makes it even more wiered. "Nisse Engström" <news.NOSPAM.0ixbtqKe@luden.se> wrote in message news:91.F7.55947.DC74F7A4@pb1.pair.com... > On Sun, 9 Aug 2009 20:17:15 +0200, "Ralph Deffke" wrote: > > > I'm facing the fact that it seems that auto_increment fields in a table not > > start at 1 like it was in earlier versions even if I install mySQL brand new > > creating all tables new. it seems to me that auto_increments handling has > > changed to older version. is somebody out there who can give me a quick > > background about auto_increment and how and if I can control the behavior of > > mySQL about them. > > Did you Google for it? I found the following page that > might be relevant: > > <http://dev.mysql.com/doc/refman/5.1/en/innodb-auto-increment-handling.html> > > "Beginning with MySQL 5.1.22, InnoDB provides a locking > strategy that significantly improves scalability and > performance of SQL statements that add rows to tables > with AUTO_INCREMENT columns. > ... > InnoDB uses the following algorithm to initialize the > auto-increment counter for a table t that contains an > AUTO_INCREMENT column named ai_col: After a server > startup, for the first insert into a table t, InnoDB > executes the equivalent of this statement: > > SELECT MAX(ai_col) FROM t FOR UPDATE; > > InnoDB increments by one the value retrieved by the > statement and assigns it to the column and to the > auto-increment counter for the table." > > > /Nisse

« previous php.general (#296529) next »