Home Database Mysql Tutorial mysql检测重复索引_MySQL

mysql检测重复索引_MySQL

May 30, 2016 pm 05:11 PM
index

mysql居然可以在相同的字段上重复建索引,oracle是不行的。需要安装pt-query-digest

[root@VM-10 ~]# pt-duplicate-key-checker -h10.10.11.208 -uroot -proot -P3316 --charset=gbk

# ########################################################################
# test.app_chat_message
# ########################################################################
# idx_app_chat_message_to_user_from_user is a left-prefix of Index 3
# Key definitions:
# KEY `idx_app_chat_message_to_user_from_user` (`to_user`,`from_user`),
# KEY `Index 3` (`to_user`,`from_user`,`message_id`),
# Column types:
# `to_user` varchar(50) not null default ''
# `from_user` varchar(50) not null default ''
# `message_id` varchar(40) not null default ''
# To remove this duplicate index, execute:

ALTER TABLE `test`.`app_chat_message` DROP INDEX `idx_app_chat_message_to_user_from_user`;

# Index 2 is a left-prefix of Index 3
# Key definitions:
# KEY `Index 2` (`to_user`,`from_user`),
# KEY `Index 3` (`to_user`,`from_user`,`message_id`),
# Column types:
# `to_user` varchar(50) not null default ''
# `from_user` varchar(50) not null default ''
# `message_id` varchar(40) not null default ''
# To remove this duplicate index, execute:
ALTER TABLE `test`.`app_chat_message` DROP INDEX `Index 2`;
# ########################################################################
# test.pub_user
# ########################################################################
# phone is a duplicate of phone_idx
# Key definitions:
# KEY `phone` (`phone`),
# KEY `phone_idx` (`phone`),
# Column types:
# `phone` varchar(15) collate utf8_bin default null
# To remove this duplicate index, execute:
ALTER TABLE `test`.`pub_user` DROP INDEX `phone`;

# email is a duplicate of email_idx
# Key definitions:
# KEY `email` (`email`),
# KEY `email_idx` (`email`),
# Column types:
# `email` varchar(50) collate utf8_bin default null
# To remove this duplicate index, execute:
ALTER TABLE `test`.`pub_user` DROP INDEX `email`;

# account is a duplicate of account_idx
# Key definitions:
# KEY `account` (`account`),
# KEY `account_idx` (`account`),
# Column types:
# `account` varchar(50) collate utf8_bin default null
# To remove this duplicate index, execute:
ALTER TABLE `test`.`pub_user` DROP INDEX `account`;
#########################################################################
.........................................................................
.........................................................................
# Size Duplicate Indexes 20358902596
# Total Duplicate Indexes 17
# Total Indexes 664
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to fix 100% disk usage on Windows 11 How to fix 100% disk usage on Windows 11 Apr 20, 2023 pm 12:58 PM

How to fix 100% disk usage on Windows 11

How to hide files and folders and remove them from search in Windows 11? How to hide files and folders and remove them from search in Windows 11? Apr 26, 2023 pm 11:07 PM

How to hide files and folders and remove them from search in Windows 11?

Here are 6 ways to fix Windows 11 search bar not available. Here are 6 ways to fix Windows 11 search bar not available. May 08, 2023 pm 10:25 PM

Here are 6 ways to fix Windows 11 search bar not available.

What are the Oracle index types? What are the Oracle index types? Nov 16, 2023 am 09:59 AM

What are the Oracle index types?

Windows 11 Outlook Search Not Working: 6 Fixes Windows 11 Outlook Search Not Working: 6 Fixes Apr 22, 2023 pm 09:46 PM

Windows 11 Outlook Search Not Working: 6 Fixes

How to solve the problem that the index exceeds the array limit How to solve the problem that the index exceeds the array limit Nov 15, 2023 pm 05:22 PM

How to solve the problem that the index exceeds the array limit

How to improve the efficiency of data grouping and data aggregation in PHP and MySQL through indexes? How to improve the efficiency of data grouping and data aggregation in PHP and MySQL through indexes? Oct 15, 2023 am 11:39 AM

How to improve the efficiency of data grouping and data aggregation in PHP and MySQL through indexes?

Advanced applications of Python slicing and indexing: reveal hidden functions and explore the infinite possibilities of programming Advanced applications of Python slicing and indexing: reveal hidden functions and explore the infinite possibilities of programming Feb 19, 2024 pm 08:40 PM

Advanced applications of Python slicing and indexing: reveal hidden functions and explore the infinite possibilities of programming

See all articles