CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: DBI:
Number of Queries Executed/Time

 



andy7t
User

Jun 4, 2004, 9:35 AM

Post #1 of 3 (3761 views)
Number of Queries Executed/Time Can't Post

Hi,

I want to place something at the bottom of my code which tells me how many MySQL queries where run on the script, and maybe how long it took.

I've seen this done in PHP, but i'd like to know how to do it in Perl.

I'm using the DBI module with MySQL.


davorg
Thaumaturge / Moderator

Jun 8, 2004, 12:55 AM

Post #2 of 3 (3682 views)
Re: [andy7t] Number of Queries Executed/Time [In reply to] Can't Post


Code
my $start = time; 
my $queries = 0;

# do all of your work, remembering to increment $queries
# each time you execute a query

my $elapsed = time - $start;

print "Executed $queries queries in $elapsed seconds\n";


--
Dave Cross, Perl Hacker, Trainer and Writer
http://www.dave.org.uk/
Get more help at Perl Monks


andy7t
User

Jun 8, 2004, 1:46 AM

Post #3 of 3 (3681 views)
Re: [davorg] Number of Queries Executed/Time [In reply to] Can't Post

Oh.

Is that it. Wink

I thought there may be some command to call from DBI, but that will work just as well.


Thanks

Andrew

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives