Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use the pt-duplicate-key-checker tool in MySQL

2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly shows you "how to use pt-duplicate-key-checker tools in MySQL", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "how to use pt-duplicate-key-checker tools in MySQL" this article.

Pt-duplicate-key-checker

Function introduction:

Find duplicate indexes and foreign keys from the mysql table. This tool lists duplicate indexes and foreign keys.

And generate a statement to delete the duplicate index

Usage introduction:

Pt-duplicate-key-checker

[OPTION...]

[DSN]

Contains more options, specifically, you can use the command pt-duplicate-key-checker-- help to see which options are supported.

DSN is a database or table.

Examples of use:

[root@idb4] # pt-duplicate-key-checker-host=localhost-user=mdba-password=123456-database=sjcj

#

# sjcj.ai_kp_xxfp

#

# FPDM is a left-prefix of fpdm_fphm_index

# Key definitions:

# KEY `FPDM` (`FPDM`)

# KEY `index` (`FPDM`, `FPHM`)

# Column types:

# `fpdm` varchar (20) not null default''comment'?

# `fphm` varchar (20) not null default'0' comment'?

# To remove this duplicate index, execute:

ALTER TABLE `sjcj`.`ai _ kp_ xxfp` DROP INDEX `FPDM`

#

# sjcj.asb_download

#

# Uniqueness of id ignored because PRIMARY is a duplicate constraint

# id is a duplicate of PRIMARY

# Key definitions:

# UNIQUE KEY `id` (`id`) USING BTREE

# PRIMARY KEY (`id`)

# Column types:

# `id` int (12) not null auto_increment

# To remove this duplicate index, execute:

ALTER TABLE `sjcj`.`asb _ download`DROP INDEX `id`

#

# sjcj.ixinnuo_ptfp_zyfp_jsfp_dzfp_mx

#

# index_fpdm is a left-prefix of PRIMARY

# Key definitions:

# KEY `index_ fpdm` (`FPDM`)

# PRIMARY KEY (`FPDM`, `FPHM`, `ID`)

# Column types:

# `fpdm` varchar (20) not null comment'?

# `fphm` varchar (20) not null comment'?

# `id`float not null comment'?

# To remove this duplicate index, execute:

ALTER TABLE `sjcj`.`ixinnuo _ ptfp_zyfp_jsfp_dzfp_ mx`DROP INDEX `index_ fpdm`

#

# sjcj.jxfp

#

# jxfp_ind is a duplicate of idx_fpdm_fphm

# Key definitions:

# KEY `jxfp_ ind` (`fpdm`, `fphm`)

# KEY `idx_fpdm_ fphm` (`fpdm`, `fphm`)

# Column types:

# `fpdm` varchar (20) default null comment'?

# `fphm` varchar (20) default null comment'?

# To remove this duplicate index, execute:

ALTER TABLE `sjcj`.`jxfp` DROP INDEX `jxfp_ ind`

#

# Summary of indexes

#

# Size Duplicate Indexes 702977946

# Total Duplicate Indexes 4

# Total Indexes 179

The above is all the contents of this article entitled "how to use pt-duplicate-key-checker tools in MySQL". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report