square-activity-64562
08/13/2021, 5:28 AMcount(*) that is fired takes time and is not practical for large tables. For large tables it might be much better to use metadata tables when possible.square-activity-64562
08/13/2021, 5:28 AMSELECT
table_name, TABLE_ROWS
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_SCHEMA = 'SCHMEA_NAME'
order by TABLE_ROWS desc;
and this is going to be much faster compared to what is being done right nowsquare-activity-64562
08/13/2021, 5:29 AMsquare-activity-64562
08/13/2021, 5:30 AMSELECT
table_schema as `Database`,
table_name AS `Table`,
round(((data_length + index_length) / 1024 / 1024 /1024), 0) `Size in GB`
FROM information_schema.TABLES
ORDER BY (data_length + index_length) DESC;mammoth-bear-12532
mammoth-bear-12532
mammoth-bear-12532
square-activity-64562
08/13/2021, 5:37 AM