I use Perl and DBI to manage my MySQL tables, querys, etc. How can I show the running time of a query?
If I do a SELECT in the console, the result will be like this:
+-----+-------------+
| id | name |
+-----+--------------
| 1 | Jack |
| 2 | Joe |
| 3 | Mary |
+-----+-------------+
3 rows in set (0.17 sec)
I need to show 0.17 sec
. There is any way in DBI to show the running time in Perl, something like this?
my $dbh = $db->prepare("SELECT id, name FROM names ORDER BY id;");
$dbh->execute;
print $dbh->runnin_time; # ???