MyBB Community Forums

Full Version: MySQL max row limit?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have a script that uploads logs to mysql database constantly. However these logs are viewed for about 10 seconds then they are pushed away. Is there anyway I can set a max number of rows for a table in MySQL? This would allow old ones to be automatically deleted as new ones push them out?

If not possible, how would I use a cron job to do this?

Basically I just don't want the tables to get more than 500 rows.
Not that I know of. You could just have the script get the number of rows, and delete the first X rows if it's over 500
just alter the script to delete the old logs when new ones are added.
You could set the table to be memory based then truncate it just before every new load.

Or just set some code so that you delete the old records every 5 minutes. Easy enough.
I just went with a cron job. Was easy and did the trick.
(2013-03-15, 05:13 PM)vEconomy Wrote: [ -> ]I just went with a cron job. Was easy and did the trick.

This is what I was going to suggest; however, if you would like to keep them all, perhaps look into partitioning. You can partition by year or even month.