RE: [PHP-DB] PHP/MySQL: Auto Increment

From: Date: Thu, 17 Aug 2000 04:21:30 +0000
Subject: RE: [PHP-DB] PHP/MySQL: Auto Increment
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-2110@lists.php.net to get a copy of this message
If I understand you right (if not, forget the email) you are afraid that the numbers get to big so that they don't fit into the provided space? You want something like reuse of deleted numbers? Am I right? If this is your problem then follow the simple calculation below and do be afraid anymore: Integers in MySQL are (probably) at least 32 bit => you can save numbers form 0 up t 2^(32)-1 => 2^(32) > 4,000,000,000 Assume you add 1 course information every second. This are 3600 per day. Then you have to live 4,000,000,000 / 3600 days (around 1,000,000 days) That are around 3000 years. Unfortunately computer science isn't so historical resistance. And probably in 5000 a.C. your database will not be used anymore. In case it is used 5000 a.C. I think they have enough knowledge to get around the problem ;-) Chears Gerhard -- Gerhard Schneider <gs@czy.de> http://www.czy.de -----Original Message----- From: Beau Hartshorne [mailto:beauh@home.com] Sent: Thursday, August 17, 2000 3:57 AM To: PHP Subject: [PHP-DB] PHP/MySQL: Auto Increment Hi, I am creating a simple database to store course information. Each course is to have a unique primary key. I generate this key using the auto increment feature in MySQL. When I create a table, and add a bunch of rows, I get something like this: ID -- 1 2 3 4 Once I delete a few rows, the database might look like this. ID -- 1 4 And after I add a few more, it may look like this: ID -- 1 4 5 6 So, after a while the ID field has numbers that go all over the place. To get around this problem, I run a php routine that resets all of the primary key ids from 1 to whatever. I am worried that if there is more than one user accessing the database, the data could get mixed up. Is there a better way to keep this organized? Thank you, Beau -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net For additional commands, e-mail: php-db-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.db (#2110) next »