I have table that has composite PK.
CREATE TABLE `tag_value_copy` (
`tag_id` INT(11) NOT NULL,
`created_at` INT(11) NOT NULL,
`value` FLOAT NULL DEFAULT NULL,
PRIMARY KEY (`tag_id`, `created_at`)
)
COLLATE='utf8_unicode_ci'
ENGINE=InnoDB
ROW_FORMAT=COMPACT;
When I execute following query
DELETE FROM tag_value_copy WHERE (tag_id, created_at) IN ((1,2), (2,3), ..., (5,6))
mysql does not use index and goes through all rows. But why?
EXPLAIN SELECT * FROM tag_value_copy WHERE (tag_id,created_at) in ((1,1518136666), (2,1518154836))
do NOT use an index as well.
UPD 1
show index from tag_value_copy
UPD 2
explain delete from tag_value_copy where (tag_id=1 and created_at=1518103037) or (tag_id=2 and created_at=1518103038)