At 16:12, 19990722, Denis Voitenko wrote:
>id int(2) auto_increment
>I want to keep only 25 records in the table all the time
If you're just keeping the id in order to know which rows to
keep, then it's not an id, it's a "position" or "relevance".
Instead of using an auto_increment key, you'd be better off
using a timestamp. Then it's simple to keep only the most
If, on the other hand, you're using the id as an id, then you
definitely DON'T want the behaviour you're requesting. After
you delete some messages and "rearrange" your ids, then you've
lost all the information that the ID held. That is, if you have
another table that references your Messages table by the id, then
once you rearrange ids, those references are bad.
Either way, I think your design is broken in a fundamental way. If
you need more help, give us the complete picture of what you're
trying to do.