[Cialug] phpmysql ?

David Champion cialug@cialug.org
Mon, 14 Feb 2005 15:53:07 -0600


They're meant to be used as system key fields... and not to be user read 
/ written. They will get all out of sequence any time records are added 
/ deleted.

If you need a "natural key" field like "firstname + lastname" then 
that's a different story.

So, short answer is - don't worry about it.

-dc

albus wrote:
> 
> 
> I'm working at setting up a RADIUS server using MySql to hold the user 
> name and password info.
> As it goes with churn I can see already that as time goes on it will get 
> totally out of sequence. Which
> I guess isn't a big deal, I hope anyways.
> 
> But I thought in time I might want to reindex it after it's out of 
> sequence.
> 
> Maybe I don't need to worry about it at all
> Mostly it was for easy readability for the other half, not the better half.
> Cause I can already hear it, "Why aren't these damned things in 
> numerical order"
> 
> That's the why.
> 
> But if it doesn't make a difference to MySql then I'm not going to worry 
> about it.
> 
> Joel
> 
> ----- Original Message ----- From: "Nathan C. Smith" <smith@ipmvs.com>
> To: <cialug@cialug.org>
> Sent: Monday, February 14, 2005 1:57 PM
> Subject: RE: [Cialug] phpmysql ?
> 
> 
>> You mean you want the id column to be consecutive starting at a certain
>> number?
>>
>> In most cases it isn't a good idea to mess with id columns, especially if
>> they are a foreign key in use in another table.
>>
>> Assuming it is your table and you made it and the id column does not 
>> appear
>> in another table, why not copy the table into a new, temporary table, 
>> delete
>> and then recreate the original table?
>>
>> If what you are after is an always consecutively numbered column 
>> (why?) you
>> could just add a new column and renumber it consecutively in whatever 
>> order
>> you like whenever you feel like it.
>>
>> Alternatively, you could tell us what you are actually trying to 
>> accomplish
>> and maybe we could deliver some ideas on how to achieve that.
>>
>> -Nate
>>
>> -----Original Message-----
>> From: albus [mailto:albus@iowaconnect.com]
>> Sent: Monday, February 14, 2005 1:46 PM
>> To: Central Iowa Linux Group
>> Subject: [Cialug] phpmysql ?
>>
>>
>>
>> Is there no way to reindex the id column in phpmysql for a mysql database
>> table?
>>
>> I've tried about every thing to reindex them.
>>
>> Next step, delete the table and redo it in a text editor. There has to 
>> be a
>> better way.
>>
>> Joel