Query below returns top 10 largest tables (largest by bytes accessed by a scan of the table) in a database with space they use.
Query
select table_schema,
table_name,
round(bytes/1024/1024, 2) as table_size
from information_schema.tables
where table_type = 'BASE TABLE'
order by table_size desc
limit 10;
Columns
- table_schema - name of table schema
- table_name - name of table
- table_size - space used by table in MB
Rows
- One row represents one table in a database
- Scope of rows: top 10 tables in a database by data size
- Ordered by table used size from largest to smallest