Description:
The following 2 queries on the full text index seem to depend on the cardinality of the search item. Since the cardinality should be known and remembered after indexing, the simple count statements should take the same amount of time.
mysql> select count(*) from sentences WHERE MATCH (sentence) AGAINST ('apop');
+----------+
| count(*) |
+----------+
| 21 |
+----------+
1 row in set (0.06 sec)
mysql> select count(*) from sentences WHERE MATCH (sentence) AGAINST ('endometriosis');
+----------+
| count(*) |
+----------+
| 14711 |
+----------+
1 row in set (35.10 sec)
How to repeat:
Make a DB with full text index and look for token of different frequency like the two above.
Suggested fix:
Determine and use the cardinality of each token known after indexing.
Description: The following 2 queries on the full text index seem to depend on the cardinality of the search item. Since the cardinality should be known and remembered after indexing, the simple count statements should take the same amount of time. mysql> select count(*) from sentences WHERE MATCH (sentence) AGAINST ('apop'); +----------+ | count(*) | +----------+ | 21 | +----------+ 1 row in set (0.06 sec) mysql> select count(*) from sentences WHERE MATCH (sentence) AGAINST ('endometriosis'); +----------+ | count(*) | +----------+ | 14711 | +----------+ 1 row in set (35.10 sec) How to repeat: Make a DB with full text index and look for token of different frequency like the two above. Suggested fix: Determine and use the cardinality of each token known after indexing.