pt-duplicate-key-checker forgets prefix lengths on suggestions

Bug #1696429 reported by Matthew B
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Percona Toolkit moved to https://jira.percona.com/projects/PT
New
Undecided
Unassigned

Bug Description

When suggesting to remove/replace an index that contains a prefix, pt-d-k-c does not keep that length in the suggestion. In the example below, the prefix on title is 20 characters because this is a text field.

The suggestion to drop and recreate would not work as a prefix length is required for TEXT columns.

CREATE TABLE `title` (
  `id` int(10) unsigned NOT NULL,
  `title` text NOT NULL,
  PRIMARY KEY (`id`),
  KEY `title` (`title`(20)),
  KEY `title_2` (`title`(20),`id`)
)

$ pt-duplicate-key-checker -uroot -d imdb -t title
...
# Key title_2 ends with a prefix of the clustered index
# Key definitions:
# KEY `title_2` (`title`(20),`id`)
# PRIMARY KEY (`id`),
# Column types:
# `title` text not null
# `id` int(10) unsigned not null
# To shorten this duplicate clustered index, execute:
ALTER TABLE `imdb`.`title` DROP INDEX `title_2`, ADD INDEX `title_2` (`title`);

Revision history for this message
Shahriyar Rzayev (rzayev-sehriyar) wrote :

Percona now uses JIRA for bug reports so this bug report is migrated to: https://jira.percona.com/browse/PT-1430

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.