Find large MySQL tables
To identify the large tables, connect to the database as described in the Connect to the database article, and run the following command, where project_id
is your Cloud project ID:
SELECT TABLE_NAME AS `Table`,
ROUND((DATA_LENGTH + INDEX_LENGTH) / 1024 / 1024) AS `Size (MB)`
FROM information_schema.TABLES
WHERE TABLE_SCHEMA = "<project_id>"
ORDER BY (DATA_LENGTH + INDEX_LENGTH) DESC;
This would display the complete list of tables and their size. You can go through the list and identify which tables require attention because of the big size.
recommendation-more-help
8bd06ef0-b3d5-4137-b74e-d7b00485808a