|
Posted by "Richard Lynch" on 10/19/08 11:31
On Tue, November 8, 2005 7:37 am, Rahul S. Johari wrote:
> Is there a way to fix ID sequence in a MySQL table using PHP?
> Basically I have some tables with a lot of records, 1000 to 5000.
> ID¹ is
> the Primary Key column in these tables, and at the time the code was
> originally written, there weren¹t much verification of data being
> input
> going on. Thus a lot of junk records were being let in, which had to
> be
> deleted at some point or another. Now the ID sequence is all screwed
> up.
> It¹s not in sequence anymore.
>
> Is there a way to fix this?
Don't.
Your IDs should not have to be in sequence, nor consecutive, nor even
in order.
If any portion of you application relies on the IDs being any
particular values, your application is broken in the first place.
You've got 2 BILLION available ID numbers. (4 billion if it's unsigned).
The fact that MySQL uses consecutive integers should be considered
more of a fluke of nature than a fact of life.
--
Like Music?
http://l-i-e.com/artists.htm
Navigation:
[Reply to this message]
|