Re: SQL Query time?
| From: | Steve Lawson | Date: | Wed, 25 Apr 2001 21:55:14 +0000 |
| Subject: | Re: SQL Query time? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-50373@lists.php.net to get a copy of this message | ||
Sup,
Adding "explain" before the select query will show you how long it will
take, along with some other info, but it won't actually give you the
results.
I use a the function microtime (http://php.net/microtime) to figure
execution time. When called, microtime will return a string with
miliiseconds then seconds seperated by a space. So you have to do something
like this...
function sn_Msecs()
{
$mt = microtime();
$mt = explode(" " , $mt);
return ($mt[1] + $mt[0]);
}
That will return seconds.milliseconds or something like 13123141.1231, it is
not in proper math form.
Just call it before a block of code or query, then call it after and
subtract the second one from the first.
SL.
----- Original Message -----
From: "James, Yz" <liljim@btconnect.com>
To: <php-general@lists.php.net>
Sent: Wednesday, April 25, 2001 2:17 PM
Subject: [PHP] SQL Query time?
> Hi all,
>
> I have seen a few pages that echo the time it's taken to execute an SQL
> query, like "The results in the database were returned in 0.3 seconds."
> Anyone know if there's a built in function to display this, and if there
is,
> what it is? My more-than-useless-ISP seems to have taken an aversion to
> allowing me to surf tonight without disconnecting me.
>
> Thanks.
> James.
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>