Following is the code to create a table in mysql database.
CREATE TABLE IF NOT EXISTS `hightraffic` (
`id` int(11) NOT NULL auto_increment,
`videoID` int(11) NOT NULL default '0',
`userid` int(11) NOT NULL,
`name` varchar(255) NOT NULL default '',
`title` int(11) NOT NULL default '0',
`date` datetime NOT NULL default '0000-00-00 00:00:00',
PRIMARY KEY (`id`),
KEY `videoID ` (`videoID `),
KEY `date` (`date`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=342 ;
I want to know following:
- What is KEY, is it primary key or its a index ?
- Why there are KEY applied on videoID and date?
- If there will be no KEY on videoId and date then is there any performance issues, Or if its there then what are the performance benefits and why?