Script to delete rows in mysql using cron?

Discussion in 'MySQL' started by maineyak, May 19, 2008.

  1. #1
    I have a table for a tag cloud, but I get lots of cpu exceeded messages when I get over 10,000 rows. Is there a script or something I can run using cron that would keep the rows to around 10,000?
     
    maineyak, May 19, 2008 IP
  2. parad0x

    parad0x Active Member

    Messages:
    510
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    70
    #2
    they should all have id's in table (i guess)
    write a php page which gets the number of rows and then randomly deletes rows till it reachs 10.000 rows.

    Just google for "random number using php" and "delete row from mysql using php" and you'll be able to do it.
     
    parad0x, May 20, 2008 IP