CodeCharge Studio
search Register Login  

Visual Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> Tips & Solutions

 HOWTO: Timing Queries in MySQL

Print topic Send  topic

Author Message
DonB
Posted: 05/25/2006, 12:19 PM

I use the following modification to the query() method of db_mysql.php:

if ($this->Debug) $time_start = microtime();

$this->Query_ID = @mysql_query($Query_String,$this->Link_ID);

if ($this->Debug) printf("Debug: query = ' . (<b>%.4fs.</b>')
%s<br>\n", microtime() - $time_start, $Query_String);

This spits out the execution time for each query. I sometimes set the value
of $this-Debug() to 'true' by default, so an entire page can be evaluated at
once.

This just helped me find a query taking nearly a second to complete and once
I realized this, I was able to knock it down to 0.15. Otherwise, I probably
would never have discovered it.

--
DonB

http://www.gotodon.com/ccbth



Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.