Search code examples
mysqlpartitioningfull-text-searchcreate-tablemysql-error-1214

How to create a table in MySQL 5.5 that has fulltext indexing and partitioning?


I update MySQL versition from 5.0 to 5.5. and I am new for studying mysql partition. firstly, I type:

SHOW VARIABLES LIKE '%partition%'

Variable_name      Value
have_partitioning   YES

Make sure that the new version support partition. I tried to partition my table by every 10 minutes, then INSERT, UPDATE, QUERY huge data into this table for a test.

First, I need create a new table, I type my code:

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
);

It return alert: #1564 - This partition function is not allowed, so what is this problem? thanks.

UPDATE

Modify date into int NOT NULL, and PARTITION BY RANGE MINUTE(date) into 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
);

Then caused new error: #1214 - The used table type doesn't support FULLTEXT indexes


Solution

  • I am so sorry, mysql not support fulltext and partition at the same time.

    See partitioning limitations

    FULLTEXT indexes. Partitioned tables do not support FULLTEXT indexes or searches. This includes partitioned tables employing the MyISAM storage engine.