开发者

Msql Partitioning - Key vs Hash vs List vs Range

I went through some of the documentation of mysql but cannot understand the difference in the fo开发者_如何学Pythonllowing ways of partitioning : Key vs Hash vs List vs Range.Can someone explain in pure english?

Also we have the following table: How do we partition by forum_id?

CREATE TABLE IF NOT EXISTS `posts_content` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `post_id` int(11) NOT NULL,
  `forum_id` int(11) NOT NULL,
  `content` longtext CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=79850 ;

Thanking you


key and hash means that the records will be distributed randomly, for example if you define 3 partitions for forum_id, then the records for forum_id 1,3 and 7 may go to partition 1, for 2 and 4 to partition 2, and for 5 and 6 to partition 3. In list and range you define which data goes to which partition, and they are prefered if you are partitioning based on date, in order to ensure that all recent posts will be on the same partition. Generally you have to avoid queries that will use more than one partition. For this reason, you have first to know your data access patterns, and then to choose the right partitioning type.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜