mysql 5.5用fulltext和PARTITION创建一个表

时间:2011-11-30 09:27:46

标签: mysql partitioning full-text-search create-table mysql-error-1214

我将mysql versition从5.0更新到5.5。我是学习mysql partition的新人。首先,我输入

  

SHOW VARIABLES LIKE'%partition%'

Variable_name      Value
have_partitioning   YES

确保新版本支持partition。我尝试每10分钟对表格进行一次分区,然后插入,更新,查询大量数据到此表中进行测试。首先,我需要创建一个新表,我输入我的代码:

CREATE TABLE test  ( 
`id` int unsigned NOT NULL auto_increment, 
`words` varchar(100) collate utf8_unicode_ci NOT NULL,  
`date` varchar(10) collate utf8_unicode_ci NOT NULL, 
PRIMARY KEY  (`id`),  
FULLTEXT KEY `index` (`words`)
) 
ENGINE=MyISAM  
DEFAULT CHARSET=utf8 
COLLATE=utf8_unicode_ci 
AUTO_INCREMENT=0  
PARTITION BY RANGE (MINUTE(`date`)) 
(
PARTITION p0 VALUES LESS THAN (1322644000),  
PARTITION p1 VALUES LESS THAN (1322644600) , 
PARTITION p2 VALUES LESS THAN (1322641200) ,  
PARTITION p3 VALUES LESS THAN (1322641800) ,  
PARTITION p4 VALUES LESS THAN MAXVALUE
);

它返回警报:#1564 - This partition function is not allowed,那么这个问题是什么?感谢。

更新

date修改为int NOT NULL,将PARTITION BY RANGE MINUTE(date)修改为PARTITION BY RANGE COLUMNS(date)

CREATE TABLE test  ( 
`id` int unsigned NOT NULL auto_increment, 
`words` varchar(100) collate utf8_unicode_ci NOT NULL,  
`date` int NOT NULL, 
PRIMARY KEY  (`id`),  
FULLTEXT KEY `index` (`words`)
) 
ENGINE=MyISAM  
DEFAULT CHARSET=utf8 
COLLATE=utf8_unicode_ci 
AUTO_INCREMENT=0  
PARTITION BY RANGE COLUMNS(`date`) 
(
PARTITION p0 VALUES LESS THAN (1322644000),  
PARTITION p1 VALUES LESS THAN (1322644600) , 
PARTITION p2 VALUES LESS THAN (1322641200) ,  
PARTITION p3 VALUES LESS THAN (1322641800) ,  
PARTITION p4 VALUES LESS THAN MAXVALUE
);

然后导致了新的错误:#1214 - The used table type doesn't support FULLTEXT indexes

3 个答案:

答案 0 :(得分:1)

我很抱歉,mysql不支持全文和分区。

请参阅partitioning limitations

FULLTEXT索引。分区表不支持FULLTEXT索引或搜索。这包括使用MyISAM存储引擎的分区表。

答案 1 :(得分:0)

一个问题可能是

select MINUTE('2008-10-10 56:56:98')返回null,原因是Minute函数从时间或日期时间值返回分钟,其中您的案例日期为varchar

答案 2 :(得分:0)

MINUTE函数在date / datetime表达式中返回。同样,分区键必须是整数列或解析为的表达式 整数,但在你的情况下它是VARCHAR