Skip navigation links

MySQL Forums :: Newbie :: How to force auto-increment field to increase monotonically


Advanced Search

How to force auto-increment field to increase monotonically
Posted by: Austin Einter ()
Date: April 19, 2011 08:53PM

Hi All
Multiple rows are inserted to a table with single INSERT IGNORE statement.
I have one auto-increment coulmn in table.

With first insert operation in auto-increment coulmn, values are set by mysql nicely.

With second insert operation, if I try to write multiple rows (and some duplicate rows are there), then the auto-increment coulmn values are jumping by some value.

So my auto-increment coulmn, looks something as below

1
2
3
4
9
10
11
18
19
20

Most probably when INSERT operation is initiated but did not succeed because of dulicate key, that time auto-increment value is jumping.

Want to know is there any mechanism in SQL, by which I can force all values in auto-incrment coulmn should be incrementing monotonically.

Thanks
Austin

Options: ReplyQuote


Subject Written By Posted
How to force auto-increment field to increase monotonically Austin Einter 04/19/2011 08:53PM
Re: How to force auto-increment field to increase monotonically Guelphdad Lake 04/19/2011 10:54PM
Re: How to force auto-increment field to increase monotonically Austin Einter 04/20/2011 05:09AM
Re: How to force auto-increment field to increase monotonically laptop alias 04/20/2011 05:36AM
Re: How to force auto-increment field to increase monotonically Austin Einter 04/20/2011 06:19PM
Re: How to force auto-increment field to increase monotonically Rick James 04/20/2011 07:18PM
Re: How to force auto-increment field to increase monotonically Guelphdad Lake 04/20/2011 09:10PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.