zoukankan      html  css  js  c++  java
  • Mysql使用information.shema.tables查询数据库表大小

    简介:

    information_schema数据库中的表都是只读的,不能进行更新、删除和插入等操作,也不能加触发器,因为它们实际只是一个视图,不是基本表,没有关联的文件。
    元数据描述数据的数据,用于描述数据属性信息。

    常用字段:

    table_schema: 记录数据库名;
    table_name: 记录数据表名;
    engine : 存储引擎;
    table_rows: 关于表的粗略行估计;
    data_length : 记录表的大小(单位字节);
    index_length : 记录表的索引的大小;
    row_format: 可以查看数据表是否压缩过;

    查询test数据库中所有表格的大小:

    select  table_name as 'tables',round(((data_length + index_length) / 1024 / 1024), 2) as MB from information_schema.tables where table_schema='test';
    

    查询所有数据库的的大小:

    >select table_schema as 'db',count(round(((data_length + index_length) / 1024 / 1024), 2)) as MB from  information_schema.tables group by table_schema;
    
  • 相关阅读:
    layui 相关知识
    ideal debug 启动不起来
    删除命令 rm -rf maven-project-jxcg.zip 解压 unzip maven-project-jxcg.zip
    vsb 配置
    cmd dos
    switch
    Element UI 框架搭建
    mysql 远程连接设置
    YApi可视化接口管理平台 接口
    报403错误
  • 原文地址:https://www.cnblogs.com/ww11/p/9056310.html
Copyright © 2011-2022 走看看