> I was looking thru the mysql functions, and there doesn't seem to be one 
> that gives you the amount of time a query takes.  Is there anyway to get 
> this information (since it gives it to you when you type queries 
> directly into the mysql shell client)?  A script of mine is starting to 
> get fairly slow (2-3 seconds for page to process) and I want to be able 
> to log the query speeds so I can see if there's a database bottleneck or 
> if my code is just kludgy.

I don't know if there's an actual function for it (although I wouldn't be
surprised, knowing PHP :-), but you could definitely do something like:

$start = mktime();
$sql = "SELECT foo FROM bar ORDER BY xyzzy";
$result = mysql_query ($sql);
// do something with the result if you want that timed as well
$end = mktime();
$total = $end - $start;
echo $total; // could format this using date() if you fancy


PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to