Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Pojemność bazy danych?
bartek
post
Post #1





Grupa: Zarejestrowani
Postów: 24
Pomógł: 0
Dołączył: 20.03.2002
Skąd: Tarnów

Ostrzeżenie: (0%)
-----


Da się jakos sprawdzić pojemność bazy danych?
A moze sie da sprawdzic ile danych mam juz w bazie ?(IMG:http://forum.php.pl/style_emoticons/default/smile.gif)

Pozdrawiam,
Bartek
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 4)
castor
post
Post #2





Grupa: Zarejestrowani
Postów: 456
Pomógł: 0
Dołączył: --

Ostrzeżenie: (0%)
-----


phpMyAdmin....odpowie ci na wszelkie twe pytania :wink:

http://www.phpmyadmin.net/
Go to the top of the page
+Quote Post
bartek
post
Post #3





Grupa: Zarejestrowani
Postów: 24
Pomógł: 0
Dołączył: 20.03.2002
Skąd: Tarnów

Ostrzeżenie: (0%)
-----


nie zabardzo rozumiem :oops: ... mam phpMyAdmin v2.1.0 ... i gdzie pisze pojemność bazy, albo ile mb juz w sobie trzyma? :?:
Go to the top of the page
+Quote Post
msulik
post
Post #4





Grupa: Zarejestrowani
Postów: 83
Pomógł: 0
Dołączył: 31.03.2002
Skąd: Toruń

Ostrzeżenie: (0%)
-----


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");

?>
Go to the top of the page
+Quote Post
Mistycus
post
Post #5





Grupa: Zarejestrowani
Postów: 234
Pomógł: 0
Dołączył: 9.04.2002
Skąd: Łódź

Ostrzeżenie: (0%)
-----


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.
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 23.08.2025 - 13:26