newbtophp Posted February 19, 2010 Share Posted February 19, 2010 I created a function which i can use instead of mysql_query, which would query aswell as check the time taken for the queries execution, but now was wondering if i could do some sort of if statement to determine if the execution time is higher than the average - than email it. function time_query($query){ $s = microtime(true); $results = mysql_query($query); $e = microtime(true); //not sure whats average... if(round($e - $s, 3) > IS HIGHER THEN AVERAGE){ mail(....); } return $results; } Quote Link to comment https://forums.phpfreaks.com/topic/192681-time-a-sql-query/ Share on other sites More sharing options...
Alex Posted February 19, 2010 Share Posted February 19, 2010 You have the basic idea down. You would just need to store the average time taken in some way. Quote Link to comment https://forums.phpfreaks.com/topic/192681-time-a-sql-query/#findComment-1015032 Share on other sites More sharing options...
waynew Posted February 19, 2010 Share Posted February 19, 2010 There are tools out there that can do all of this for you, just so you know. Quote Link to comment https://forums.phpfreaks.com/topic/192681-time-a-sql-query/#findComment-1015060 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.