开发者

What should i do with partitioning in a table require 2 ways of selections for best performance in MYSQL - myisam?

开发者 https://www.devze.com 2023-04-03 07:57 出处:网络
I have a table like bellow: CREATE TABLE `hosts` ( `ID` int(11) unsigned NOT NULL AUTO_INCREMENT, `Name` varchar(60) NOT NULL,

I have a table like bellow:

CREATE TABLE `hosts` (
  `ID` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `Name` varchar(60) NOT NULL,
   PRIMARY KEY (`ID`,`Name`),
   UNIQUE KEY `UniqueHost` (`Name`),
) ENGINE=MyISAM AUTO_INCREMENT=32527823 DEFAULT CHARSET=utf8
/*!50100 PARTITION BY KEY开发者_高级运维 (`Name`)
PARTITIONS 20 */

What i want to select here are:

select * from hosts where Name = 'blah.com';

and:

select * from hosts where ID = 123123;

What should i do when i have 2 ways of selection like above for best performance ? other tables requires the ID of this table. However, i also need to select the Name of hosts frequently.

Another question is How many partitions i should create for 32 millions of rows?

0

精彩评论

暂无评论...
验证码 换一张
取 消