Jump to content

Need guidance Using mysql_query() in loops, and usleep() function


Rohan Shenoy

Recommended Posts

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

Link to comment
Share on other sites

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 :)

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.