zoukankan      html  css  js  c++  java
  • 常见select查询总结

    常见select查询总结
    周万春
    
    查看单个数据库数据大小
    [root@db01 ~]# mysql.dba -e "select table_name,concat(round((data_length + index_length + data_free)/1024/1024,2),'MB') from information_schema.tables where table_schema='world';"
    +-----------------+--------------------------------------------------------------------------+
    | table_name      | concat(round((data_length + index_length + data_free)/1024/1024,2),'MB') |
    +-----------------+--------------------------------------------------------------------------+
    | city            | 0.52MB                                                                   |
    | country         | 0.09MB                                                                   |
    | countrylanguage | 0.16MB                                                                   |
    +-----------------+--------------------------------------------------------------------------+
    
    
    查看单张表数据大小
    [root@db01 ~]# mysql.dba -e "select table_name,concat(round((data_length + index_length + data_free)/1024/1024,2),'MB') from information_schema.tables where table_schema='world' and table_name='city';"
    +------------+--------------------------------------------------------------------------+
    | table_name | concat(round((data_length + index_length + data_free)/1024/1024,2),'MB') |
    +------------+--------------------------------------------------------------------------+
    | city       | 0.52MB                                                                   |
    +------------+--------------------------------------------------------------------------+
    
    
    查看所有数据库的大小
    [root@db01 ~]# mysql.dba -e "select table_schema,concat(round(sum((data_length + index_length + data_free)/1024/1024),2),'MB') as data_size from information_schema.tables group by table_schema;"
    +--------------------+-----------+
    | table_schema       | data_size |
    +--------------------+-----------+
    | app01              | 0.02MB    |
    | information_schema | 80.16MB   |
    | mysql              | 6.51MB    |
    | performance_schema | 0.00MB    |
    | sakila             | 14.45MB   |
    | student            | 0.06MB    |
    | sys                | 0.02MB    |
    | world              | 0.77MB    |
    +--------------------+-----------+
  • 相关阅读:
    Source InSight context 窗口丢失的解决办法
    [EffectiveC++]item41:了解隐式接口和编译器多态
    [EffectiveC++]item04:Make sure the objects are initialized before they're used
    [EffectiveC++]item3:尽可能使用const
    linux man指令问题
    解读ARM成功秘诀:薄利多销推广产品
    source insight设置问题 [问题点数:20分,结帖人leecapacity]
    totalcommander
    firefox
    处理SecureCRT中使用vim出现中文乱码问题
  • 原文地址:https://www.cnblogs.com/zhouwanchun/p/12911330.html
Copyright © 2011-2022 走看看