Posted By

level09 on 02/24/10


Tagged


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

dantreacy
virendrakryadav


Splitting Big mysql queries in PHP


 / Published in: MySQL
 

  1. while (1) {
  2. mysql_query("DELETE FROM logs WHERE log_date <= '2009-10-01' LIMIT 10000");
  3. if (mysql_affected_rows() == 0) {
  4. // done deleting
  5. break;
  6. }
  7. // you can even pause a BIT
  8. usleep(50000);
  9. }

Report this snippet  

You need to login to post a comment.