60.MySQL-Utilities工具包之-mysqlindexcheck

文章展示了如何使用mysqlindexcheck工具检查数据库test中表test1、test2和test3的索引情况,确认这些表没有冗余或重复的索引。工具也显示了对于数据量不足的表无法计算最佳/最差索引的警告。
摘要由CSDN通过智能技术生成

mysqlindexcheck  
1.检查数据库test的冗余或者重复的索引。
[root@mysql1 ~]# mysqlindexcheck --server=root:rootroot@192.168.1.51:3306:/mysql/mysql3306.sock --show-drops --show-indexes --stats  --report-indexes -vvv test
WARNING: Using a password on the command line interface can be insecure.
# Source on 192.168.1.51: ... connected.
# Checking indexes...
# Getting indexes for test.test1
# Showing indexes from test.test1:
#
+-----------+--------+----------+--------+---------+----------------+----------+
| database  | table  | name     | type   | unique  | accepts nulls  | columns  |
+-----------+--------+----------+--------+---------+----------------+----------+
| test      | test1  | PRIMARY  | BTREE  | True    | False          | id       |
+-----------+--------+----------+--------+---------+----------------+----------+
#
# Table test.test1 has no duplicate nor redundant indexes.
# WARNING: Not enough data to calculate best/worst indexes.
#
# Getting indexes for test.test2
# Showing indexes from test.test2:
#
+-----------+--------+----------+--------+---------+----------------+----------+
| database  | table  | name     | type   | unique  | accepts nulls  | columns  |
+-----------+--------+----------+--------+---------+----------------+----------+
| test      | test2  | PRIMARY  | BTREE  | True    | False          | id       |
+-----------+--------+----------+--------+---------+----------------+----------+
#
# Table test.test2 has no duplicate nor redundant indexes.
# WARNING: Not enough data to calculate best/worst indexes.
#
# Getting indexes for test.test3
# Showing indexes from test.test3:
#
+-----------+--------+----------+--------+---------+----------------+----------+
| database  | table  | name     | type   | unique  | accepts nulls  | columns  |
+-----------+--------+----------+--------+---------+----------------+----------+
| test      | test3  | PRIMARY  | BTREE  | True    | False          | id       |
+-----------+--------+----------+--------+---------+----------------+----------+
#
# Table test.test3 has no duplicate nor redundant indexes.
# WARNING: Not enough data to calculate best/worst indexes.
#
# ...done.

2.查看某个表test.test1 的索引是否存在冗余索引
[root@mysql1 ~]# mysqlindexcheck --server=root:rootroot@192.168.1.51:3306:/mysql/mysql3306.sock --show-drops --show-indexes --stats  --report-indexes -vvv test.test1
WARNING: Using a password on the command line interface can be insecure.
# Source on 192.168.1.51: ... connected.
# Checking indexes...
# Getting indexes for test.test1
# Showing indexes from test.test1:
#
+-----------+--------+----------+--------+---------+----------------+----------+
| database  | table  | name     | type   | unique  | accepts nulls  | columns  |
+-----------+--------+----------+--------+---------+----------------+----------+
| test      | test1  | PRIMARY  | BTREE  | True    | False          | id       |
+-----------+--------+----------+--------+---------+----------------+----------+
#
# Table test.test1 has no duplicate nor redundant indexes.
# WARNING: Not enough data to calculate best/worst indexes.
#
# ...done.
3.总结

mysqlindexcheck 工具可以检查每个表的索引。这样我们通过输出结果就能很方便的查看表的索引是否有重复的。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值