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

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

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.