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    |
    +--------------------+-----------+
  • 相关阅读:
    【Jest】笔记二:Matchers匹配器
    【爬虫】如何用python+selenium网页爬虫
    【mysql-server】遇到的坑
    【puppeteer】前端自动化初探(一)
    强制360谷歌使用谷歌内核
    实时获取input输入框中的值
    什么是单页面
    如何更改Apache的根目录指向
    iphone上点击div会出现半透明灰色背景以及margin失效
    event.currentTarget和event.target的区别
  • 原文地址:https://www.cnblogs.com/zhouwanchun/p/12911330.html
Copyright © 2011-2022 走看看