Hello guys,
I have the following table:
CREATE TABLE `items_types` (
`item_id` int(11) unsigned NOT NULL,
`type` enum('t1','t2','t3','t4','t5') NOT NULL default 't1',
PRIMARY KEY (`item_id`,`type`),
KEY `item_id` (`item_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
I am doing a LEFT JOIN `items_types` `i_t` ON `i_t`.`item_id` = `i`.`item_id` a lot so I need this to use an index.
Do I need the extra KEY on `item_id`? Or I can just remove it and be confident that MySQL would use the PRIMARY KEY correctly for that JOIN?
The MySQL version is 5.0.87-community on a CentOS 5.4 server.
I'm pretty sure of the answer, I will also use an EXPLAIN to test both cases. But until then, I would like an expert opinion.
Thanks
Free Flash Components at
http://flashxml.net