分享一个有意思的MySQL Shell的plugin
https://github.com/lefred/mysqlshell-plugins我也是刚知道MySQL Shell竟然还能自己写plugin,学习了。
它在mysqlshell里集成了很多实用的工具/功能,例如查看innodb表碎片
MySQL127.0.0.1:3306 sslPy > innodb.get_fragmented_tables()
+-----------------+--------+-------+-------+-------+------------+---------+-----------+---------------+
| TABLE | ENGINE | ROWS| DATA| IDX | TOTAL SIZE | IDXFRAC | data_free | data_free_pct |
+-----------------+--------+-------+-------+-------+------------+---------+-----------+---------------+
| sbtest.sbtest1| InnoDB | 0.10M | 0.02G | 0.00G | 0.03G | 0.18 | 6.00MB | (22.59%) |
| sbtest.sbtest10 | InnoDB | 0.10M | 0.02G | 0.00G | 0.03G | 0.18 | 6.00MB | (22.59%) |
| sbtest.sbtest2| InnoDB | 0.10M | 0.02G | 0.00G | 0.03G | 0.18 | 6.00MB | (22.59%) |
| sbtest.sbtest3| InnoDB | 0.10M | 0.02G | 0.00G | 0.03G | 0.18 | 6.00MB | (22.59%) |
| sbtest.sbtest4| InnoDB | 0.10M | 0.02G | 0.00G | 0.03G | 0.18 | 6.00MB | (22.59%) |
| sbtest.sbtest5| InnoDB | 0.10M | 0.02G | 0.00G | 0.03G | 0.18 | 6.00MB | (22.59%) |
| sbtest.sbtest6| InnoDB | 0.10M | 0.02G | 0.00G | 0.03G | 0.18 | 6.00MB | (22.59%) |
| sbtest.sbtest7| InnoDB | 0.10M | 0.02G | 0.00G | 0.03G | 0.18 | 6.00MB | (22.59%) |
| sbtest.sbtest8| InnoDB | 0.10M | 0.02G | 0.00G | 0.03G | 0.18 | 6.00MB | (22.59%) |
| sbtest.sbtest9| InnoDB | 0.10M | 0.02G | 0.00G | 0.03G | 0.18 | 6.00MB | (22.59%) |
+-----------------+--------+-------+-------+-------+------------+---------+-----------+---------------+
Don't forget to run 'ANALYZE TABLE ...' for a more accurate result. 或者比如想查看一些涉及到性能的关键点
MySQL127.0.0.1:3306 sslPy > check.
get_amount_d_d_l() get_query_most_row_affected() get_trx_with_most_statements()
get_binlogs() get_query_temp_disk() help()
get_binlogs_i_o() get_query_updating_same_p_k() show_trx_size()
get_cascading_f_k() get_running_statements() show_trx_size_sort()
get_full_table_scan_query() get_slower_query() workload()
get_inno_d_b_tables_with_no_p_k()get_trx_rate() workload_info()
get_non_inno_d_b_tables() get_trx_with_most_rows_affected()
页:
[1]