$DB = DB->connect(...); my $size = sizeOfDB($DB); sub sizeOfDB { my $db = shift; my $size = 0; my $st = $db->prepare('show table status'); $st->execute; while (my $h = $st->fetchrow_hashref) { # other fields in %$h could be used, for example, # to limit the count to just certain tables. $size += $h->{Data_length} + $h->{Index_length}; } $st->finish; return $size; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Size of mysql database/tables with perl
by rnahi (Curate) on Feb 04, 2006 at 16:51 UTC | |
|
Re: Size of mysql database/tables with perl
by radiantmatrix (Parson) on Feb 07, 2006 at 17:21 UTC |