zoukankan      html  css  js  c++  java
  • 查找数据库大小和表大小

    #查看每个数据库占用的空间 :
    SELECT table_schema "Database Name", sum( data_length + index_length ) / 1024 / 1024 "Database Size in MB" FROM information_schema.TABLES GROUP BY table_schema;


    #查看数据库下每个表和索引占用的空间:


    SELECT table_name AS "Tables",round(((data_length + index_length) / 1024 / 1024), 2) "Size in MB"
    FROM information_schema.TABLES
    WHERE table_schema = "mysql"
    ORDER BY (data_length + index_length) DESC;

    #查看排名前10的表 占用的空间:

    SELECT CONCAT(table_schema, '.', table_name),
    CONCAT(ROUND(table_rows / 1000000, 2), 'M') table_rows,
    CONCAT(ROUND(data_length / ( 1024 * 1024 * 1024 ), 2), 'G') data_size,
    CONCAT(ROUND(index_length / ( 1024 * 1024 * 1024 ), 2), 'G') idx_size,
    CONCAT(ROUND(( data_length + index_length ) / ( 1024 * 1024 * 1024 ), 2), 'G') total_size,
    concat(ROUND(index_length / data_length, 2) * 100,"%") idx_data_percent
    FROM information_schema.TABLES
    ORDER BY data_length + index_length DESC
    LIMIT 10;

  • 相关阅读:
    CSS同时选择器
    create-react-app之proxy
    mysql limit语句
    给tbody加垂直滚动条的具体思路
    MySql数据类型范围
    block、inline、inline-block
    javascript sourcemap
    session of express
    React中innerHTML的坑
    box-sizing
  • 原文地址:https://www.cnblogs.com/mao3714/p/8868464.html
Copyright © 2011-2022 走看看