Hi, ladies and gentleman!
Well, I have solved my problem, though it was not actually a problem,
I just wanted things to look cool :)
1. Download "Time::HiRes" perl module
http://search.cpan.org/CPAN/authors/id/J/JH/JHI/Time-HiRes-1.39.tar.gz
2. Install it: "perl Makefile.PL; make; make test; make install"
3. Include the module into your script:
use Time::HiRes qw( usleep ualarm gettimeofday tv_interval );
I only need the gettimeofday(); function, so my "use" line looks like this:
use Time::HiRes qw(gettimeofday);
4. In you script type:
#before the query...
$start = gettimeofday();
your SQL query here...
#and after the query is executed...
$end = gettimeofday();
printf("Your SQL query took <strong>%.6f</strong> sec.<br>\n", $end -
$start);
That's all, thanks to all who replied!
> I don't think MySQL can give you back the execution time via DBI, but
> you might be able to calculate something similar from the Perl side by
> calculating how long the script runs overall. Here's a good thread from
> perlmonks about how to do it:
>
> http://perlmonks.org/index.pl?node_id=35318
>
> -bill
>
> Vitali Malicky wrote:
> > Glad to greet you all, ladies and gentelmen!
> >
> > I have written a dynamic web page in Perl to display some kind
> > of statistical information usefull for my company.
> >
> > My question: how can I get the time which MySQL returns after the query?
> >
> > For example: MySQL returns a line like this "870 rows in set (0.91 sec)"
> > after successful query
> > How can I get the value 0.91 and save it in my Perl script, is at all
> > itpossible?
> >
> > Hope I made myself clear.
>
>
> ---------------------------------------------------------------------
> Before posting, please check:
> http://www.mysql.com/manual.php (the manual)
> http://lists.mysql.com/ (the list archive)
>
> To request this thread, e-mail <mysql-thread128119@stripped>
> To unsubscribe, e-mail
<mysql-unsubscribe-vitali=altron.kharkov.ua@stripped>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
>
>
>
>