Jules Jules - 3 months ago 11
MySQL Question

How can I measure mysql time, the time and / or load of an sql query in php?

I need to find some measure of how long my queries are taking and the load on the server if possible.

I doubt its possible, but I would like to gain the cpu usage too.

Any ideas?


PHP Syntax

$starttime = microtime(); 
$query = mysql_query("select * from table"); 
$endtime = microtime();

Then calculate the difference between $starttime and $endtime.