Skip to content

Instantly share code, notes, and snippets.

@mumubin
Last active December 10, 2019 07:08
Show Gist options
  • Save mumubin/0c1b7f5c5c7205cbf1930175eb8bc479 to your computer and use it in GitHub Desktop.
Save mumubin/0c1b7f5c5c7205cbf1930175eb8bc479 to your computer and use it in GitHub Desktop.
mysql

query table size

SELECT table_name AS `Table`, round(((data_length + index_length) / 1024 / 1024), 2) `Size (MB)` FROM information_schema.TABLES WHERE table_schema = "$your_database";

query column size

SELECT sum(char_length($your_column))/1024/1024 FROM $your_table
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment