MySQL script to delete data in chunks until everything lower then id has been deleted
- by Chriswede
I need an MySQL Skript which does the following:
delete chunks of the database until it has deleted all link_id's greater then 10000
exmaple:
x = 10000
DELETE FROM pligg_links WHERE link_id > x and link_id < x+10000
x = x + 10000
...
So it would delete
DELETE FROM pligg_links WHERE link_id > 10000 and link_id < 20000
then
DELETE FROM pligg_links WHERE link_id > 20000 and link_id < 30000
until all id's less then 10000 have been removed
I need this because the database is very very big (more then a gig)
thank in advance