• 数据库索引以及表容量查看


    SELECT
    a.TABLE_SCHEMA,
    a.TABLE_NAME,
    a.index_name,
    GROUP_CONCAT(
    column_name
    ORDER BY
    seq_in_index
    ) AS `Columns`
    FROM
    information_schema.statistics a
    GROUP BY
    a.TABLE_SCHEMA,
    a.TABLE_NAME,
    a.index_name;

    SELECT
    a.TABLE_SCHEMA,
    a.TABLE_NAME,
    a.index_name,
    GROUP_CONCAT(
    column_name
    ORDER BY
    seq_in_index
    ) AS `Columns`
    FROM
    information_schema.statistics a
    GROUP BY
    a.TABLE_SCHEMA,
    a.TABLE_NAME,
    a.index_name;

    SELECT
    TABLE_NAME,
    INDEX_NAME,
    GROUP_CONCAT(COLUMN_NAME) AS INDEX_COLUMN
    FROM
    information_schema.statistics
    GROUP BY
    TABLE_NAME,
    INDEX_NAME;

    select
    table_schema as '数据库',
    sum(table_rows) as '记录数',
    sum(truncate(data_length/1024/1024, 2)) as '数据容量(MB)',
    sum(truncate(index_length/1024/1024, 2)) as '索引容量(MB)'
    from information_schema.tables
    group by table_schema
    order by sum(data_length) desc, sum(index_length) desc;

  • 相关阅读:
    git
    composer
    laravel saas
    算法模板-01背包
    GMP-C/C++(大数库)使用方法
    算法模板-容斥原理
    算法模板-欧拉函数
    算法模板-素数判断/素数筛法
    算法模板-质因数分解
    算法模板-快速幂取模
  • 原文地址:https://www.cnblogs.com/sunny-miss/p/14962888.html
Copyright © 2020-2023  润新知