pt-duplicate-key-checker使用
- mysql> desc new_orders;
- +---------+-------------+------+-----+---------+-------+
- | Field | Type | Null | Key | Default | Extra |
- +---------+-------------+------+-----+---------+-------+
- | no_o_id | int() | NO | PRI | NULL | |
- | no_d_id | tinyint() | NO | PRI | NULL | |
- | no_w_id | smallint() | NO | PRI | NULL | |
- +---------+-------------+------+-----+---------+-------+
- rows in set (0.00 sec)
- mysql> create index idx1 on new_orders(no_o_id);
- Query OK, rows affected (0.92 sec)
- Records: Duplicates: Warnings:
- mysql> create index idx2 on new_orders(no_o_id);
- Query OK, rows affected, warning (0.93 sec)
- Records: Duplicates: Warnings:
- mysql> create index idx3 on new_orders(no_o_id);
- Query OK, rows affected, warning (0.87 sec)
- Records: Duplicates: Warnings:
- mysql> create index idx3 on new_orders(no_o_id,no_d_id);
- ERROR (): Duplicate key name 'idx3'
- mysql> create index idx4 on new_orders(no_o_id,no_d_id);
- Query OK, rows affected (1.07 sec)
- Records: Duplicates: Warnings:
- mysql> create index idx5 on new_orders(no_o_id,no_d_id,no_w_id);
- Query OK, rows affected (1.04 sec)
- Records: Duplicates: Warnings:
- mysql> create index idx6 on new_orders(no_o_id,no_d_id,no_w_id);
- Query OK, rows affected, warning (1.58 sec)
- Records: Duplicates: Warnings:
- [root@mxqmongodb2 bin]# ./pt-duplicate-key-checker --host=172.16.16.35 --port= --user=root --password= --database=test --tables=new_orders;
- # ########################################################################
- # test.new_orders
- # ########################################################################
- # idx6 is a duplicate of idx5
- # Key definitions:
- # KEY `idx6` (`no_o_id`,`no_d_id`,`no_w_id`)
- # KEY `idx5` (`no_o_id`,`no_d_id`,`no_w_id`),
- # Column types:
- # `no_o_id` int() not null
- # `no_d_id` tinyint() not null
- # `no_w_id` smallint() not null
- # To remove this duplicate index, execute:
- ALTER TABLE `test`.`new_orders` DROP INDEX `idx6`;
- # idx4 is a left-prefix of idx5
- # Key definitions:
- # KEY `idx4` (`no_o_id`,`no_d_id`),
- # KEY `idx5` (`no_o_id`,`no_d_id`,`no_w_id`),
- # Column types:
- # `no_o_id` int() not null
- # `no_d_id` tinyint() not null
- # `no_w_id` smallint() not null
- # To remove this duplicate index, execute:
- ALTER TABLE `test`.`new_orders` DROP INDEX `idx4`;
- # idx1 is a left-prefix of idx5
- # Key definitions:
- # KEY `idx1` (`no_o_id`),
- # KEY `idx5` (`no_o_id`,`no_d_id`,`no_w_id`),
- # Column types:
- # `no_o_id` int() not null
- # `no_d_id` tinyint() not null
- # `no_w_id` smallint() not null
- # To remove this duplicate index, execute:
- ALTER TABLE `test`.`new_orders` DROP INDEX `idx1`;
- # idx2 is a left-prefix of idx5
- # Key definitions:
- # KEY `idx2` (`no_o_id`),
- # KEY `idx5` (`no_o_id`,`no_d_id`,`no_w_id`),
- # Column types:
- # `no_o_id` int() not null
- # `no_d_id` tinyint() not null
- # `no_w_id` smallint() not null
- # To remove this duplicate index, execute:
- ALTER TABLE `test`.`new_orders` DROP INDEX `idx2`;
- # idx3 is a left-prefix of idx5
- # Key definitions:
- # KEY `idx3` (`no_o_id`),
- # KEY `idx5` (`no_o_id`,`no_d_id`,`no_w_id`),
- # Column types:
- # `no_o_id` int() not null
- # `no_d_id` tinyint() not null
- # `no_w_id` smallint() not null
- # To remove this duplicate index, execute:
- ALTER TABLE `test`.`new_orders` DROP INDEX `idx3`;
- # ########################################################################
- # Summary of indexes
- # ########################################################################
- # Size Duplicate Indexes
- # Total Duplicate Indexes
- # Total Indexes
pt-duplicate-key-checker使用的更多相关文章
- ON DUPLICATE KEY UPDATE重复插入时更新
mysql当插入重复时更新的方法: 第一种方法: 示例一:插入多条记录 假设有一个主键为 client_id 的 clients 表,可以使用下面的语句: INSERT INTO clients (c ...
- 【转】MySQL的Replace into 与Insert into on duplicate key update真正的不同之处
原文链接:http://www.jb51.net/article/47090.htm 今天听同事介绍oracle到mysql的数据migration,他用了Insert into ..... on ...
- ON DUPLICATE KEY UPDATE
如果在INSERT语句末尾指定了ON DUPLICATE KEY UPDATE,并且插入行后会导致在一个UNIQUE索引或PRIMARY KEY中出现重复值,则在出现重复值的行执行UPDATE: 如果 ...
- 深入mysql "on duplicate key update" 语法的分析
如果在INSERT语句末尾指定了on duplicate key update,并且插入行后会导致在一个UNIQUE索引或PRIMARY KEY中出现重复值,则在出现重复值的行执行UPDATE:如果不 ...
- [BTS]The join order has been enforced because a local join hint is used.;Duplicate key was ignored.".
在一个客户的BizTalk Server 2013 R2环境中会报如下的ERROR,查找相关资料后,先试试停掉所有Trace. Log Name: ApplicationSource: ...
- INSERT INTO .. ON DUPLICATE KEY更新多行记录
现在问题来了,如果INSERT多行记录, ON DUPLICATE KEY UPDATE后面字段的值怎么指定?要知道一条INSERT语句中只能有一个ON DUPLICATE KEY UPDATE,到底 ...
- insert into hi_user_score set hello_id=74372073,a=10001 on duplicate key update hello_id=74372073, a=10001
insert into hi_user_score set hello_id=74372073,a=10001 on duplicate key update hello_id=74372073, a ...
- MySql避免重复插入记录方法(ignore,Replace,ON DUPLICATE KEY UPDATE)
ON DUPLICATE KEY UPDATE 博客 http://blog.csdn.net/jbboy/article/details/46828917
- mysql:on duplicate key update与replace into
在往表里面插入数据的时候,经常需要:a.先判断数据是否存在于库里面:b.不存在则插入:c.存在则更新 一.replace into 前提:数据库里面必须有主键或唯一索引,不然replace into ...
- mysql 插入重复值 INSERT ... ON DUPLICATE KEY UPDATE
向数据库插入记录时,有时会有这种需求,当符合某种条件的数据存在时,去修改它,不存在时,则新增,也就是saveOrUpdate操作.这种控制可以放在业务层,也可以放在数据库层,大多数数据库都支持这种需求 ...
随机推荐
- es第三篇:Search APIs
大多数search API都是可以操作多个索引的,除了explain API. 当执行一个search API时,可以指定routing参数,去搜索特定的主分片及其副本分片.routing参数值可以是 ...
- Java - 自定义异常(尚学堂第六章异常机制作业计算平均数)
编写一个计算N个学生分数平均分的程序.程序应该提示用户输入N的值,如何必须输入所有N个学生分数.如果用户输入的分数是一个负数,则应该抛出一个异常并捕获,提示“分数必须是正数或者0”.并提示用户再次输入 ...
- 使用jsp完成商品列表的动态显示
1数据库准备工作 1创建数据库 2 创建product表 代码如下: CREATE TABLE `product` ( `pid` ) NOT NULL, `pname` ) DEFAULT NULL ...
- Parcel Vs Webpack
横空出世的Parcel近日成为了前端圈的又一大热点,在短短几周内就获得了13K的Star.作为前端构建工具新人的Parcel为什么能在短期内获得这么多赞同?他和老大哥Webpack比起来到底有什么优势 ...
- Truncated incorrect DOUBLE value: 'NO_REFUND'
解决办法:Mysql中,如果一个字段是字符串,则一定要加单引号 问题原因: `item_refund_state` ) NOT NULL item_refund_state字段的类型是varchar但 ...
- log4j 详细讲解
日志是应用软件中不可缺少的部分,Apache的开源项目log4j是一个功能强大的日志组件,提供方便的日志记录.在apache网站:jakarta.apache.org/log4j 可以免费下载到Log ...
- 在线课程笔记—.NET基础
关于学习北京理工大学金旭亮老师在线课程的笔记. 介绍: 在线课程网址:http://mooc.study.163.com/university/BIT#/c 老师个人网站:http://jinxuli ...
- JSON 转 VO
需求 将获取的json数据直接转为vo 解决 利用net.sf.json.JSONObject的toBean() 确保json中的key值和vo中的字段名称一致 JSONObject jsonObje ...
- System.arraycopy的测试
ArrayList的源码中数组的拷贝用到该方法: public static void arraycopy(Object src, --源数组 int srcPos, --源数组要复制的起始位置 Ob ...
- 官网下载apache服务器并运行
1.打开官网 https://httpd.apache.org/ 2.找到下载位置,比如我们要下载2.x版本 点击download,在下一页找到 Files for Microsoft Wi ...