标签归档:information_schema

通过SQL语句查看MySQL数据库的表空间状态

1. 查看数据库的索引空间大小

在MySQL Workbench中运行以下SQL语句:

  1. -- GB为单位
  2. SELECT
  3. CONCAT(ROUND(SUM(index_length)/(1024*1024*1024), 6), ' GB') AS 'Total Index Size'
  4. FROM
  5. information_schema.TABLES
  6. WHERE
  7. table_schema LIKE 'database';
  8. -- MB为单位
  9. SELECT
  10. CONCAT(ROUND(SUM(index_length)/(1024*1024), 6), ' MB') AS 'Total Index Size'
  11. FROM
  12. information_schema.TABLES
  13. WHERE
  14. table_schema LIKE 'database';

继续阅读通过SQL语句查看MySQL数据库的表空间状态