How to create a solid sequence?
Hello.
I have a field (int) which is autoincremented.
I need to make the sequence consistent, without holes.
For example, if we run:
INSERT INTO test(foo) VALUES
("bar"), -- 1
("baz"), -- 2
("qux"); -- 3
DELETE FROM test WHERE id = 2;
INSERT INTO test SET foo="quux";
I need last insert have id 2, not 4.
I.e. mysql should somehow search for free values "between" and use it.
Is it possible with auto_increment?
If not, any suggestion how to SELECT first free value?
Subject
Written By
Posted
How to create a solid sequence?
June 24, 2011 08:49AM
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.