bartek
17.06.2002, 20:39:44
Da się jakos sprawdzić pojemność bazy danych?
A moze sie da sprawdzic ile danych mam juz w bazie ?
Pozdrawiam,
Bartek
castor
17.06.2002, 20:42:47
phpMyAdmin....odpowie ci na wszelkie twe pytania :wink:
http://www.phpmyadmin.net/
bartek
17.06.2002, 22:48:35
nie zabardzo rozumiem :oops: ... mam phpMyAdmin v2.1.0 ... i gdzie pisze pojemność bazy, albo ile mb juz w sobie trzyma? :?:
msulik
17.06.2002, 23:27:30
Kod
<?
// Przerobiony kod z phpMyAdmin 2.2.5-rc1
$db = "nazwa_bazy";
$total_array[0] = 0; // number of tables
$total_array[1] = 0; // total data size
$total_array[2] = 0; // total index size
$total_array[3] = 0; // big total size
$tables = @mysql_list_tables($db);
// Number of tables
$dbs_array[$db][0] = @mysql_numrows($tables);
mysql_free_result($tables);
$total_array[0] += $dbs_array[$db][0];
// Size of data and indexes
$dbs_array[$db][1] = 0; // data size column
$dbs_array[$db][2] = 0; // index size column
$dbs_array[$db][3] = 0; // full size column
// MySQL 3.23.03+
$local_query = 'SHOW TABLE STATUS FROM ' . $db;
$result = @mysql_query($local_query);
// needs the "@" below otherwise, warnings in case of special DB names
if (@mysql_num_rows($result)) {
while ($row = mysql_fetch_array($result)) {
$dbs_array[$db][1] += $row['Data_length'];
$dbs_array[$db][2] += $row['Index_length'];
}
$dbs_array[$db][3] = $dbs_array[$db][1] + $dbs_array[$db][2];
$total_array[1] += $dbs_array[$db][1];
$total_array[2] += $dbs_array[$db][2];
$total_array[3] += $dbs_array[$db][3];
} // end if
mysql_free_result($result);
echo ("rozmiary w bajtach:<br><br>n");
echo ("number of tables: ".$total_array[0]."<br>n");
echo ("total data size: ".$total_array[1]."<br>n");
echo ("total index size: ".$total_array[2]."<br>n");
echo ("big total size: ".$total_array[3]."<br>n");
?>
Mistycus
21.06.2002, 06:33:29
Nie wiem jak to jest w Linuxie, ale jeśli masz Windowsa, to wejdź do katalogu, gdzie zainstalowałeś bazę, a potem sprawdź wielkość folderu Data. Dzięki temu uzyskasz informacje o rozmiarze wszystkich baz. Jeśli chcesz znać wielkość pojedyńczej bazy lub nawet tabeli, to nie ma problemu, bo każda baza przechowywana jest w oddzielnym folderze, a tabele w plikach danego folderu.