Jules Jules - 1 year ago 81
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?

Answer Source

PHP Syntax

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

Then calculate the difference between $starttime and $endtime.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download