Jump to content

Time a sql query


newbtophp

Recommended Posts

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;
}

Link to comment
https://forums.phpfreaks.com/topic/192681-time-a-sql-query/
Share on other sites

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.