Javier Muniz wrote:
Neither auto-increment nor sequences allow you to do what you're asking for
though, which is like database garbage collection.  If you really need
something like this you should implement it in a cron job that runs during
non-peak hours as it will be quite an expensive operation on a large table
(the best way I can think of would be to iterate over all table rows and
look for "gaps" in the table, and for each gap take the record with the
highest ID and change the ID to fill the gap, then update all replys to
match the new ID, after everything is finished reset the sequence to the
highest id in the modified table and you're done).

I would not care about removing old posts. Good archive is always good :)


I don't know what you mean that your database could get huge, in my understanding that means millions of post per week.


Note from the MySQL manual for you auto_increment fans out there:


Posted by Jim Martin on Tuesday October 1 2002, @11:57am

Just in case there's any question, the
AUTO_INCREMENT field /DOES NOT WRAP/. Once you
hit the limit for the field size, INSERTs generate
an error. (As per Jeremy Cole)

That is I will be able to insert only 4294967295 rows if the auto_increment is UNSIGNED INT. :( I guess I'll start to use UNSIGNED BIGINT, that will give me 18446744073709551615 rows, that ought to be enough for anybody. ;)


Marek


-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to