2011-10-24 94 views
0

我想在我的MySQL表上創建分區和子分區以優化表的性能。在MySQL中創建子分區

對於防爆: -

Create table mytest (id int not null, mydate date) 
PARTITION BY LIST (id) 
SUBPARTITION BY RANGE (TO_DAYS(mydate)) 
(
PARTITION P01 VALUES IN (1,2,5,6,8,10) 
(
SUBPARTITION S01 VALUES LESS THAN ('2011-10-23'), 
SUBPARTITION S02 VALUES LESS THAN ('2011-10-16'), 
SUBPARTITION S03 VALUES LESS THAN ('2011-10-09') 
)); 

這樣的I M試圖創建子分區,但得到它說近距離不正確的語法錯誤。

任何人都可以幫助我是否允許PARTITION BY LIST和SUBPARTITION BY RANGE。

回答

3

您不能通過RANGE子分區。您只能通過HASHKEY進行子分配。與子分區

"In MySQL 5.1, it is possible to subpartition tables that are partitioned by RANGE or LIST. Subpartitions may use either HASH or KEY partitioning."

+0

的MySQL 5.7以及>'「問題的子分區必須使用HASH或KEY分區只有RANGE和LIST分區可subpartitioned; HASH和KEY分區不能subpartitioned:它是在documentation規定。 。「' – gfunk