Rohan Shenoy Posted May 30, 2008 Share Posted May 30, 2008 Hi guyz, I remember reading somewhere that performing mysql_query() in loops can be damaging to the database. Is it possible to avoid that damage by using usleep() function? Something like: for($i=0; $i<100; $i++) { mysql_query($sql); usleep(10); } If it is possible to do so, what should be the value of usleep seconds? Will 10 microseconds be enough or any other value you recommend? I will be performing about 200 queries in the loop. Thank you. -Rohan Quote Link to comment https://forums.phpfreaks.com/topic/107969-need-guidance-using-mysql_query-in-loops-and-usleep-function/ Share on other sites More sharing options...
phpzone Posted May 30, 2008 Share Posted May 30, 2008 Why do you need to do 100 separate queries in one go? Are you sure what you are trying to do is not possible in a different way? More details may help someone establish whether what you are doing is the best way or if you can re-write your query. This is more a MySQL question rather than PHP however Quote Link to comment https://forums.phpfreaks.com/topic/107969-need-guidance-using-mysql_query-in-loops-and-usleep-function/#findComment-553359 Share on other sites More sharing options...
Rohan Shenoy Posted May 30, 2008 Author Share Posted May 30, 2008 ^There is no other way it can be done. offtopic: I have reported this topic to be moved to MySQL forum. Quote Link to comment https://forums.phpfreaks.com/topic/107969-need-guidance-using-mysql_query-in-loops-and-usleep-function/#findComment-553365 Share on other sites More sharing options...
fenway Posted May 30, 2008 Share Posted May 30, 2008 ^There is no other way it can be done. hard to believe.... Quote Link to comment https://forums.phpfreaks.com/topic/107969-need-guidance-using-mysql_query-in-loops-and-usleep-function/#findComment-553714 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.