Koliko prostora zauzima baza, koliko je slobodno…?
Friday, 03.11.2006 – DejanEvo jedan SQL upit, pomocu kojeg mozete saznati neke informacije o zauzecu vasih baza, broju tabela u bazi i sl.
SELECT s.schema_name naziv_baze, CONCAT( IFNULL( ROUND( (SUM(t.data_length)+SUM(t.index_length))/1024/1024 ,3) ,0.00) ,' MB') as ukupna_velicina_baze, CONCAT( IFNULL( ROUND( ( (SUM(t.data_length)+SUM(t.index_length)) - SUM(t.data_free) )/1024/1024 , 3) , 0.00) ,' MB') as iskoristeno_MB, CONCAT( IFNULL( ROUND(SUM(data_free)/1024/1024,3) ,0.00) ,' MB') as slobodno_MB, CONCAT( IFNULL( ROUND( ( ( (SUM(t.data_length)+SUM(t.index_length)) -SUM(t.data_free) ) / ((SUM(t.data_length)+SUM(t.index_length)))*100) ,3) ,0) ,' %') as iskoristeno_procenata, COUNT(table_name) as broj_tabela FROM information_schema.schemata s LEFT JOIN information_schema.tables t ON s.schema_name = t.table_schema WHERE s.schema_name != 'information_schema' GROUP BY s.schema_name ORDER BY 1;
3 Responses to “Koliko prostora zauzima baza, koliko je slobodno…?”
Hahaha…. ovo je najluđi query koji sam video do sada 🙂
Šta reći? Kako te nije mrzelo? 🙂
By Goran Pilipovic on Jan 30, 2007
Kad te nesto zanima, onda nista nije tesko. 🙂
By dejan on Jan 30, 2007
hehehe, ovo je extra stvar, pitanje, da li postoji query koji bi mi izbacio recimo spore querije za odredjenu bazu? 🙂
By Boban Karišik on Oct 29, 2007