Details
-
Bug
-
Status: Done
-
Low
-
Resolution: Invalid
-
None
-
None
-
None
Description
**Reported in Launchpad by Mike Siekkinen last update 21-11-2014 10:05:01
I have a table that looks somewhat like
CREATE TABLE `activity` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`activity_date` datetime NOT NULL,
PRIMARY KEY (`activity_date`,`id`),
UNIQUE KEY `id` (`id`)
) ENGINE=InnoDB;
There are of course other columns that hold useful data but the structure of the PK is what is important to this scenario.
pt-table-checksum will attempt to chunk based on the auto inc value, which could be acceptable since there is at least a secondary index. However it adds a force index primary key clause. Although id is part of the PK, not being the first part is resulting in table scans.
I realize there are some options to give hints on indexes but it seems incorrect to issue a force index primary key for an auto increment value when it cannot be effectively used.