Don't miss

Check The Exact Capacity of Your Database


By on 3:52 PM

If you want to know the exact capacity of your database. Check this!
Image from: findicons.com

1. SQL script
Sum up the data_length + index_length is equal to the total table size.
  1. data_length – store the real data.
  2. index_length – store the table index.
Here’s the SQL script to list out the entire databases size
SELECT table_schema "Data Base Name", SUM( data_length + index_length) / 1024 / 1024 
"Data Base Size in MB" FROM information_schema.TABLES GROUP BY table_schema ;
Another SQL script to list out one database size, and each tables size in detail
SELECT TABLE_NAME, table_rows, data_length, index_length, 
round(((data_length + index_length) / 1024 / 1024),2) "Size in MB"
FROM information_schema.TABLES WHERE table_schema = "schema_name";
2. Locate the MySQL stored data
Access this article to find out where does MySQL database saved the data.
Windows
Locate the MySQL ibdata1 file, right click on the file and click the properties, see the size? :)
Linux
Locate the MySQL ibdata1 file
mkyong@myserver:/var/lib/mysql$ ls -lh
total 1.5G
drwx------ 2 mysql mysql 4.0K 2009-08-26 13:36 mydatabase
-rw-r--r-- 1 root  root     0 2009-08-19 09:39 debian-5.0.flag
-rw-rw---- 1 mysql mysql 1.5G 2009-08-27 17:32 ibdata1
-rw-rw---- 1 mysql mysql 5.0M 2009-08-27 17:32 ib_logfile0
-rw-rw---- 1 mysql mysql 5.0M 2009-08-27 17:32 ib_logfile1
drwxr-xr-x 2 mysql root  4.0K 2009-08-19 11:19 mysql
-rw------- 1 root  root     6 2009-08-19 09:39 mysql_upgrade_info
Sources from: mykyong.com

About The Karl and Dijae

The Administrators in the same project intended to post their notes on a Facebook page that suddenly found it cool and interesting. Many had liked it and spread the word. Now they try to enter the Blogging World.

0 comments:

Post a Comment