MySQL : vérifier l’occupation disque des tables & index

Boris HUISGEN November 14, 2012

administration base de données mysql

SELECT CONCAT(table_schema, '.', table_name) db_table,
       CONCAT(ROUND(table_rows/1000000, 2), 'M') rows,
       CONCAT(ROUND((data_length+index_length)/(1024*1024), 1), 'M') size,
       CONCAT(ROUND(data_length/(1024*1024), 1), 'M') data,
       CONCAT(ROUND(index_length/(1024*1024), 1), 'M') indx,
       ROUND(index_length/data_length, 2) ratio 
FROM   information_schema.TABLES 
ORDER  BY data_length + index_length DESC;

See also

MySQL : script de sauvegarde par snapshot LVM
Read more
MySQL : script de sauvegarde par snapshot ZFS
Read more
MySQL : limiter le nombre de connexions simultanées de chaque utilisateur
Read more