Hello.
I have a mysql table; It's pretty large but straightforward. It has 12767901 entries; here's output of show create (irrelevant parts omitted):
CREATE TABLE `a` (
`num` int(10) unsigned NOT NULL,
`subnum` int(10) unsigned NOT NULL,
`comment` text,
...
PRIMARY KEY (`num`,`subnum`),
FULLTEXT KEY `comment` (`comment`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8
I want to use fulltext search on it, but it's ridiculously slow:
mysql> select count(*) from a where match(comment) against('pretty');
+----------+
| count(*) |
+----------+
| 176203 |
+----------+
1 row in set (13 min 23.29 sec)
mysql> select count(*) from a where match(comment) against('pretty');
+----------+
| count(*) |
+----------+
| 176203 |
+----------+
1 row in set (0.00 sec)
mysql> explain select count(*) from a where match(comment) against('pretty');
+----+-------------+-------+----------+---------------+---------+---------+------+------+-------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+-------+----------+---------------+---------+---------+------+------+-------------+
| 1 | SIMPLE | a | fulltext | comment | comment | 0 | | 1 | Using where |
+----+-------------+-------+----------+---------------+---------+---------+------+------+-------------+
1 row in set (0.12 sec)
Notice how the second time the same query completes immediately. Is this intended behavior or am I doing something wrong? show processlist says that query spends most time in Sending data state.