MySQL Forums
Forum List  »  InnoDB

Re: Data file size --- Global solution - query for db size
Posted by: Mayur P Vegad
Date: June 09, 2010 01:31AM

hi

Find your db size query ;

SELECT s.schema_name,
CONCAT(IFNULL(ROUND((SUM(t.data_length)+SUM(t.index_length)) /1024/1024,2),0.00)) total_size_in_MB,
CONCAT(IFNULL(ROUND(((SUM(t.data_length)+SUM(t.index_length))-SUM(t.data_free))/1024/1024,2),0.00)) data_used_IN_MB,
CONCAT(IFNULL(ROUND(SUM(data_free)/1024/1024,2),0.00)) data_free_IN_MB,
IFNULL(ROUND((((SUM(t.data_length)+SUM(t.index_length))-SUM(t.data_free))/((SUM(t.data_length)+SUM(t.index_length)))*100),2),0) pct_used,
COUNT(table_name) total_tables
FROM INFORMATION_SCHEMA.SCHEMATA s
LEFT JOIN INFORMATION_SCHEMA.TABLES t ON s.schema_name = t.table_schema
WHERE s.schema_name = 'abc' -- give your schema name
GROUP BY s.schema_name
ORDER BY pct_used DESC;

Options: ReplyQuote


Subject
Views
Written By
Posted
6144
June 02, 2010 07:24AM
1960
June 03, 2010 09:54AM
1638
June 04, 2010 05:37AM
Re: Data file size --- Global solution - query for db size
3076
June 09, 2010 01:31AM
2062
June 07, 2010 04:59AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.