Log in

View Full Version : Resolved detecting query speed using php



james438
03-12-2010, 05:37 AM
How can I check the speed of a query using php? I ran a query that I thought would take some time to complete that involved a bunch of PCRE to format about 150 fields and it took very little time. I am about to do the same with another 600 fields.

Schmoopy
03-12-2010, 04:23 PM
This should do:



<?php
$time_start = microtime(true);

// Code here

$time_end = microtime(true);
$time = $time_end - $time_start;


echo "Executed in $time seconds\n";
?>



Taken from: http://uk.php.net/manual/en/function.microtime.php

james438
03-12-2010, 05:50 PM
Awesome, thanks :)