Get the App
SLTechnology News&Howtos  ›  Database  › 

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

Shulou Source: shulou.com Published: 2022-05-31 15:46:21 10月03日 Update

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!

Tags: Tools content articles indexing learning help functions available through commands data databases easy to understand more organization knowledge editing industry sentences information information channels Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Redmi OPPO Reno Huawei Shulou Information Apple