Skip to content

Instantly share code, notes, and snippets.

Created July 24, 2015 08:07
Show Gist options
  • Save anonymous/fb6dbc30662008a4525d to your computer and use it in GitHub Desktop.
Save anonymous/fb6dbc30662008a4525d to your computer and use it in GitHub Desktop.
$results3 = client.query("SELECT table_schema AS 'Database name', SUM(data_length + index_length) / 1024 / 1024 AS 'Size (MB)' FROM information_schema.TABLES GROUP BY table_schema")
$results3.each do |row3|
puts "#{row3['Database name']} #{row3['Size (MB)']}"
end
------
Output
information_schema 0.878906E-2
monitoring 0.174296875E3
notification 0.140625E0
-----
If I run it in mysql I get this
mysql> SELECT table_schema AS 'Database name', SUM(data_length + index_length) / 1024 / 1024 AS 'Size (MB)' FROM information_schema.TABLES GROUP BY table_schema;
+--------------------+--------------+
| Database name | Size (MB) |
+--------------------+--------------+
| information_schema | 0.00878906 |
| monitoring | 174.29687500 |
| notification | 0.14062500 |
+--------------------+--------------+
--------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment