zoukankan      html  css  js  c++  java
  • 06. pt-duplicate-key-checker


    | t01 | CREATE TABLE `t01` (
    `pkid` int(10) unsigned NOT NULL AUTO_INCREMENT,
    `name` varchar(50) NOT NULL,
    `code` int(11) NOT NULL,
    `ctime` datetime DEFAULT CURRENT_TIMESTAMP,
    `utime` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
    PRIMARY KEY (`pkid`),
    KEY `idx_name` (`name`),
    KEY `idx_code` (`code`),
    KEY `idx_name_code` (`name`,`code`)
    ) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 |

    vim duplicate_key.cnf

    host=192.168.100.101
    port=3306
    user=admin
    password=admin
    databases=db01
    tables=t01,pt_deadlocks
    clustered
    all-structs


    pt-duplicate-key-checker --config duplicate_key.cnf


    # ########################################################################
    # db01.t01
    # ########################################################################

    # idx_name is a left-prefix of idx_name_code
    # Key definitions:
    # KEY `idx_name` (`name`)
    # KEY `idx_name_code` (`name`,`code`),
    # Column types:
    # `name` varchar(50) not null
    # `code` int(11) not null
    # To remove this duplicate index, execute:
    ALTER TABLE `db01`.`t01` DROP INDEX `idx_name`;

    # ########################################################################
    # Summary of indexes
    # ########################################################################

    # Size Duplicate Indexes 1010
    # Total Duplicate Indexes 1
    # Total Indexes 5


    pt-duplicate-key-checker h=192.168.100.101,P=3306,u=admin,p=admin -d db01 -t t01,pt_deadlocks


    # ########################################################################
    # db01.t01
    # ########################################################################

    # idx_name is a left-prefix of idx_name_code
    # Key definitions:
    # KEY `idx_name` (`name`),
    # KEY `idx_name_code` (`name`,`code`)
    # Column types:
    # `name` varchar(50) not null
    # `code` int(11) not null
    # To remove this duplicate index, execute:
    ALTER TABLE `db01`.`t01` DROP INDEX `idx_name`;

    # ########################################################################
    # Summary of indexes
    # ########################################################################

    # Size Duplicate Indexes 1010
    # Total Duplicate Indexes 1
    # Total Indexes 5

    pt-duplicate-key-checker h=192.168.100.101,P=3306,u=admin,p=admin -d db01

    # ########################################################################
    # db01.t01
    # ########################################################################

    # idx_name is a left-prefix of idx_name_code
    # Key definitions:
    # KEY `idx_name` (`name`),
    # KEY `idx_name_code` (`name`,`code`)
    # Column types:
    # `name` varchar(50) not null
    # `code` int(11) not null
    # To remove this duplicate index, execute:
    ALTER TABLE `db01`.`t01` DROP INDEX `idx_name`;

    # ########################################################################
    # Summary of indexes
    # ########################################################################

    # Size Duplicate Indexes 1010
    # Total Duplicate Indexes 1
    # Total Indexes 5


    [root@server01 ~]# mysql -e 'alter table db01.t01 drop index idx_name'


    [root@server01 ~]# pt-duplicate-key-checker h=192.168.100.101,P=3306,u=admin,p=admin -d db01 -t t01,pt_deadlocks

    # ########################################################################
    # Summary of indexes
    # ########################################################################

    # Total Indexes 4

    wechat: nick753159 qq: 417966852 email: nzq42@qq.com base: shanghai
  • 相关阅读:
    [k8s]kube-dns/dashboard排错历险记(含sa加载用法/集群搭建)
    禁用nginx的access日志
    redis info 各信息意义
    使用JProfiler进行内存分析
    lr11 BUG?Failed to send data by channels
    loadrunner 怎么能得到返回的http状态?
    SQL SERVER查看当前连接情况
    总结: Struts2 + Spring 的线程安全问题
    转发:maven打包时始终出现以下提示:-source 1.3 中不支持泛型(请使用 -source 5 或更高版本以启用泛型)
    SQL Server 索引结构及其使用(一)
  • 原文地址:https://www.cnblogs.com/cyberbit/p/pt-duplicate-key-checker.html
Copyright © 2011-2022 走看看