mysql 查询碎片的方法

mysql> select table_schema,concat('alter table ',table_name, ' engine=Innodb ;'),(data_length+index_length)/1024/1024 length,engine,data_free,table_rows from information_schema.tables where table_schema not in ('information_schema','mysql','performance_schema')      and data_free !=0 group by table_name order by table_rows asc;
+---------------------+------------------------------------------------------------------+---------------+--------+-----------+------------+
| table_schema | concat('alter table ',table_name, ' engine=Innodb ;') | length | engine | data_free | table_rows |
+---------------------+------------------------------------------------------------------+---------------+--------+-----------+------------+
| testdbs_students001 | alter table student_period_history_201705 engine=Innodb ; | 2.03125000 | InnoDB | 4194304 | 7407 |
| testdbs_students001 | alter table student_period_history_201706 engine=Innodb ; | 1.51562500 | InnoDB | 4194304 | 7815 |
| testdbs_students001 | alter table transfer_order_record engine=Innodb ; | 1.82812500 | InnoDB | 4194304 | 8001 |
| testdbs_students001 | alter table teacher_account engine=Innodb ; | 2.40625000 | InnoDB | 4194304 | 8221 |
| testdbs_students001 | alter table period_appeal_log engine=Innodb ; | 1.51562500 | InnoDB | 4194304 | 9412 |
| testdbs_students001 | alter table student_period_history_201704 engine=Innodb ; | 2.23437500 | InnoDB | 4194304 | 9996 |
| testdbs_students001 | alter table student_period_history_201709 engine=Innodb ; | 1.51562500 | InnoDB | 4194304 | 12011 |
| testdbs_students001 | alter table failed_jobs engine=Innodb ; | 8.51562500 | InnoDB | 4194304 | 12595 |
| testdbs_students001 | alter table student_period_history_201707 engine=Innodb ; | 2.51562500 | InnoDB | 4194304 | 16019 |
| testdbs_students001 | alter table student_course_repair_log engine=Innodb ; | 50.90625000 | InnoDB | 7340032 | 16955 |
| testdbs_students001 | alter table order_period_warning engine=Innodb ; | 3.84375000 | InnoDB | 4194304 | 17711 |
| testdbs_students001 | alter table send_msg_log engine=Innodb ; | 3.40625000 | InnoDB | 4194304 | 19140 |
| testdbs_students001 | alter table back_period_log engine=Innodb ; | 2.51562500 | InnoDB | 4194304 | 22785 |
| testdbs_students001 | alter table teacher_finance engine=Innodb ; | 2.50000000 | InnoDB | 4194304 | 23018 |
| testdbs_students001 | alter table student_period_history_201711 engine=Innodb ; | 2.51562500 | InnoDB | 4194304 | 23263 |
| testdbs_students001 | alter table student_period_history_201710 engine=Innodb ; | 2.51562500 | InnoDB | 4194304 | 24336 |
| testdbs_students001 | alter table student_period_cancel_request engine=Innodb ; | 5.03125000 | InnoDB | 4194304 | 25585 |
| testdbs_students001 | alter table student_period_history_201708 engine=Innodb ; | 3.51562500 | InnoDB | 4194304 | 29830 |
| testdbs_students001 | alter table student_course_error_log engine=Innodb ; | 22.06250000 | InnoDB | 4194304 | 31661 |
| testdbs_students001 | alter table order_paymenttype_changed_logs engine=Innodb ; | 5.50000000 | InnoDB | 4194304 | 33330 |
| testdbs_students001 | alter table student_period_history_201801 engine=Innodb ; | 4.51562500 | InnoDB | 4194304 | 40481 |
| testdbs_students001 | alter table student_period_history_201712 engine=Innodb ; | 4.51562500 | InnoDB | 4194304 | 41839 |
| testdbs_students001 | alter table teacher_teaching_award_list engine=Innodb ; | 6.54687500 | InnoDB | 4194304 | 45883 |
| testdbs_students001 | alter table teacher_base_finance_log engine=Innodb ; | 13.57812500 | InnoDB | 4194304 | 56640 |
| testdbs_students001 | alter table student_period_history_201802 engine=Innodb ; | 6.51562500 | InnoDB | 4194304 | 59748 |
| testdbs_students001 | alter table withdraw engine=Innodb ; | 23.54687500 | InnoDB | 4194304 | 61167 |
| testdbs_students001 | alter table student_period_history_201803 engine=Innodb ; | 7.51562500 | InnoDB | 3145728 | 69367 |
| testdbs_students001 | alter table teacher_student_period engine=Innodb ; | 8.03125000 | InnoDB | 4194304 | 74849 |
| testdbs_students001 | alter table student_period_history_201804 engine=Innodb ; | 8.51562500 | InnoDB | 4194304 | 80023 |
| testdbs_students001 | alter table student_period_history_201805 engine=Innodb ; | 8.51562500 | InnoDB | 4194304 | 83745 |
| testdbs_students001 | alter table student_course engine=Innodb ; | 11.03125000 | InnoDB | 4194304 | 90741 |
| testdbs_students001 | alter table student_period_history_201809 engine=Innodb ; | 9.51562500 | InnoDB | 4194304 | 92332 |
| testdbs_students001 | alter table student_period_history_201806 engine=Innodb ; | 9.51562500 | InnoDB | 4194304 | 94333 |
| testdbs_students001 | alter table order_credit_info engine=Innodb ; | 45.07812500 | InnoDB | 7340032 | 97368 |
| testdbs_students001 | alter table student_period_history_201810 engine=Innodb ; | 15.51562500 | InnoDB | 4194304 | 155869 |
| testdbs_students001 | alter table student_period_history_201807 engine=Innodb ; | 15.51562500 | InnoDB | 4194304 | 156100 |
| testdbs_students001 | alter table student_period_history_201811 engine=Innodb ; | 16.51562500 | InnoDB | 4194304 | 159868 |
| testdbs_students001 | alter table student_period_history_201905 engine=Innodb ; | 17.51562500 | InnoDB | 4194304 | 170079 |
| testdbs_students001 | alter table student_period_history_201902 engine=Innodb ; | 17.51562500 | InnoDB | 4194304 | 175909 |
| testdbs_students001 | alter table order_period_warning_info engine=Innodb ; | 24.54687500 | InnoDB | 6291456 | 178991 |
| testdbs_students001 | alter table student_period_history_201812 engine=Innodb ; | 19.54687500 | InnoDB | 4194304 | 194860 |
| testdbs_students001 | alter table student_period_history_201808 engine=Innodb ; | 20.54687500 | InnoDB | 4194304 | 203676 |
| testdbs_students001 | alter table student_period_history_201904 engine=Innodb ; | 20.54687500 | InnoDB | 4194304 | 204831 |
| testdbs_students001 | alter table student_period_history_201903 engine=Innodb ; | 21.54687500 | InnoDB | 3145728 | 218756 |
| testdbs_students001 | alter table student_period_history_201901 engine=Innodb ; | 22.54687500 | InnoDB | 4194304 | 219717 |
| testdbs_students001 | alter table student_finance engine=Innodb ; | 28.54687500 | InnoDB | 7340032 | 368189 |
| testdbs_students001 | alter table course_real_period_log engine=Innodb ; | 79.03125000 | InnoDB | 5242880 | 404931 |
| testdbs_students001 | alter table course_real_period engine=Innodb ; | 71.04687500 | InnoDB | 5242880 | 406539 |
| testdbs_students001 | alter table audition_order engine=Innodb ; | 179.03125000 | InnoDB | 7340032 | 548999 |
| testdbs_students001 | alter table inform_order engine=Innodb ; | 429.85937500 | InnoDB | 7340032 | 648426 |
| testdbs_students001 | alter table teacher_full_time_finance_log engine=Innodb ; | 136.79687500 | InnoDB | 7340032 | 700182 |
| testdbs_students001 | alter table teacher_all_time_finance_log engine=Innodb ; | 137.79687500 | InnoDB | 4194304 | 712279 |
| testdbs_students001 | alter table student_period_cancel_logs engine=Innodb ; | 90.14062500 | InnoDB | 4194304 | 841515 |
| testdbs_students001 | alter table course_order engine=Innodb ; | 377.00000000 | InnoDB | 6291456 | 1113689 |
| testdbs_students001 | alter table order engine=Innodb ; | 547.34375000 | InnoDB | 7340032 | 1121134 |
| testdbs_students001 | alter table order_status_log engine=Innodb ; | 137.28125000 | InnoDB | 5242880 | 1182890 |
| testdbs_students001 | alter table student_finance_log engine=Innodb ; | 171.21875000 | InnoDB | 5242880 | 1349596 |
| testdbs_students001 | alter table uid_to_sale engine=Innodb ; | 122.98437500 | InnoDB | 6291456 | 1480265 |
| testdbs_students001 | alter table period_msg_to_teacher engine=Innodb ; | 424.75000000 | InnoDB | 6291456 | 2183860 |
| testdbs_students001 | alter table teacher_course_remark engine=Innodb ; | 2983.00000000 | InnoDB | 4194304 | 2226556 |
| testdbs_students001 | alter table student_period engine=Innodb ; | 386.21875000 | InnoDB | 6291456 | 2344035 |
| testdbs_students001 | alter table teacher_part_time_finance_log engine=Innodb ; | 645.54687500 | InnoDB | 7340032 | 3224173 |
| testdbs_students001 | alter table teacher_subsidy_detail engine=Innodb ; | 827.20312500 | InnoDB | 6291456 | 3812535 |
| testdbs_students001 | alter table student_course_log engine=Innodb ; | 816.54687500 | InnoDB | 4194304 | 4489196 |
| testdbs_students001 | alter table teacher_finance_log engine=Innodb ; | 1449.75000000 | InnoDB | 5242880 | 6493046 |
| testdbs_students001 | alter table order_update_log engine=Innodb ; | 1088.00000000 | InnoDB | 7340032 | 7501555 |
+---------------------+------------------------------------------------------------------+---------------+--------+-----------+------------+
66 rows in set (0.02 sec) mysql>

mysql 查询碎片的方法的更多相关文章

  1. MySql查询时间段的方法(转)

    http://www.jb51.net/article/58668.htm 本文实例讲述了MySql查询时间段的方法.分享给大家供大家参考.具体方法如下: MySql查询时间段的方法未必人人都会,下面 ...

  2. MySql查询时间段的方法

    本文实例讲述了MySql查询时间段的方法.分享给大家供大家参考.具体方法如下: MySql查询时间段的方法未必人人都会,下面为您介绍两种MySql查询时间段的方法,供大家参考. MySql的时间字段有 ...

  3. MySQL查询关键数据方法

    MySQL查询关键数据方法 操作表的SQL语句补充 1.修改表名 alter table 表名 reame 新表名: 2.新增字段名 alter table 表名 add 字段名 字段类型(数字) 约 ...

  4. mysql查询乱码解决方法

    http://blog.csdn.net/u012408083/article/details/52734762 MySQL 命令行查询乱码 编码问题 当使用数据库工具查询数据时显示数据正常,中文也很 ...

  5. 记录一次优化mysql查询语句的方法

    今天在数据库中导入大量的数据,大概有25万条,结果在查询的时候优化没有做好,因此导致查询意外停止或者是直接查询程序中止,很是苦恼.所以才有了优化查询的方法总结 1.首先是查看一下数据量 2.接下来按照 ...

  6. mysql查询今天,昨天,近7天,近30天,本月,上一月数据的方法(摘录)

    mysql查询今天,昨天,近7天,近30天,本月,上一月数据的方法分析总结: 话说有一文章表article,存储文章的添加文章的时间是add_time字段,该字段为int(5)类型的,现需要查询今天添 ...

  7. 查询和修改mysql最大连接数的方法

    查询和修改mysql最大连接数的方法切换到mysql库里查询show variables like 'max_connections';show global status like 'Max_use ...

  8. MySQL查询语句执行过程及性能优化-查询过程及优化方法(JOIN/ORDER BY)

    在上一篇文章MySQL查询语句执行过程及性能优化-基本概念和EXPLAIN语句简介中介绍了EXPLAIN语句,并举了一个慢查询例子:

  9. Mysql查询缓存碎片、缓存命中率及Nagios监控

    Mysql 的优化方案,在互联网上可以查找到非常多资料,今天对Mysql缓存碎片和命中率作了详细了解,个人作了简单整理. 一.Mysql查询缓存碎片和缓存命中率. mysql> SHOW STA ...

随机推荐

  1. Flume采集日志

    角色 Source 数据来源 (exec, kafka, http…)Channel 数据通道 (memory,file,jdbc)Sink 数据目的地 (kafka,hdfs,es…) Agent ...

  2. 【react】input输入框可输入的最好实现方式

    使用的是refs.react中输入框不能直接定义value.输入框是可变的,react会提示报错.需要使用的inChange事件(输入框内容被改变时触发). 要定义输入框初始值,需要在componen ...

  3. ETH 全节点的远程Debug环境搭建

    ETH全节点还是很浪费资源的,尤其是在同步下来所有区块链,如果你打算在本地进行全节点的Debug吗,有点不现实.这个文档 编译,在要运行的机器上面安装devel,一般的方法是,编译好之后,放到服务器上 ...

  4. 模仿抽奖转盘,并且用cookie记录历史次数

    自己制作了一个模仿抽奖转盘的小游戏,代码比较简单,规则是只有三次抽奖机会,并且浏览器会记录抽奖的次数, 代码如下 <!DOCTYPE html> <html> <head ...

  5. 封装cookie,自定义过期时间,domain,path

    在使用Cookie进行存储的时候,遇到了许多不可思议的bug,特地标识出来,以作总结. 是这样一个项目,登录是放在官网进行操作的,而登录进入的是后台,后台和官网属于同一域名的不同目录,那么常规进行co ...

  6. win10更新导致chrome打开网页速度太慢

    升级win10之后如果出现chrome内核的浏览器网页总是打不开 打开很慢 而ie和edge是可以正常访问的 用这个方法可以 我弄了几天终于 搞好了 我直接转载过来了 近期,工程师收到大量反馈360浏 ...

  7. 关于confusion_matrix()返回的矩阵的索引顺序(类别顺序)

    转载至:https://blog.csdn.net/m0_38061927/article/details/77198990 1.混淆矩阵 混淆矩阵是机器学习中总结分类模型预测结果的情形分析表,以矩阵 ...

  8. 【神经网络与深度学习】【CUDA开发】caffe-windows win32下的编译尝试

    [神经网络与深度学习][CUDA开发]caffe-windows win32下的编译尝试 标签:[神经网络与深度学习] [CUDA开发] 主要是在开发Qt的应用程序时,需要的是有一个使用的库文件也只是 ...

  9. [ASP.NET] [JS] GridView点击高亮当前选择行,并在点击另一行时恢复上一选择行背景颜色

    在ASP.NET中的gridview控件里面可以通过设定其OnRowDataBound事件来进行实现高亮当前行的操作 前端控件的设置: 只要设置好OnRowDataBound属性即可,会自动在.cs文 ...

  10. ERROR 1709 (HY000): Index column size too large. The maximum column size is 767 bytes.

    MySQL版本5.6.35 在一个长度为512字符的字段上创建unique key报错 CREATE DATABASE dpcs_metadata DEFAULT CHARACTER SET utf8 ...