Last active
August 29, 2015 14:06
-
-
Save phagedorn/65d9367dca63a5232e40 to your computer and use it in GitHub Desktop.
top_5_largest_tables.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Query to list top 5 largest tables in the database | |
# http://www.thegeekstuff.com/2008/11/overview-of-mysql-information_schema-database-with-practical-examples/ | |
# This examples gives the top 5 largest space occupying tables in the database along with it’s size in MB. | |
SELECT concat(table_schema,'.',table_name) table_name, | |
concat(round(data_length/(1024*1024),2),'M') data_length | |
FROM information_schema.TABLES | |
ORDER BY data_length DESC LIMIT 5 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment