in reply to Size of mysql database/tables with perl
The DBI *_hashref methods are the slowest way to fetch. Here's a shorter and faster version for you. (The columns you named are returned 6th and 8th {0-indexed}, respectively)
sub sizeOfDB { my $db = shift; my $size = 0; # No placeholders needed, so let selectall_* do the annoying stuff my $result = $db->selectall_arrayref('show table status'); # Assume that the call succeeded, either check error or use {RaiseE +rror=>1} foreach (@$result) { $size += $_->[6] + $_->[8] } return $size; }
|
|---|