mysql> SELECT title FROM fti WHERE MATCH(title) AGAINST('+windows +query +linux' IN BOOLEAN MODE);
+--------------------------------------------------------------------------+
| title |
+--------------------------------------------------------------------------+
| Same Mysql Update query giving different result in linux and windows |
| Re: Same Mysql Update query giving different result in linux and windows |
| Re: Same Mysql Update query giving different result in linux and windows |
| Re: Same Mysql Update query giving different result in linux and windows |
| Re: Same Mysql Update query giving different result in linux and windows |
| Re: Same Mysql Update query giving different result in linux and windows |
+--------------------------------------------------------------------------+
6 rows in set (0.01 sec)
mysql> SELECT COUNT(*) FROM fti WHERE MATCH(title) AGAINST('windows query linux' IN BOOLEAN MODE);
+----------+
| COUNT(*) |
+----------+
| 18758 |
+----------+
1 row in set (0.04 sec)
mysql> SELECT title FROM fti WHERE MATCH(title) AGAINST('windows query linux' IN BOOLEAN MODE) LIMIT 11;
+-------------------------------------------------------------------------+
| title |
+-------------------------------------------------------------------------+
| Connecting from PHP on one linux box to another linux running MySQL |
| Re: Connecting from PHP on one linux box to another linux running MySQL |
| export hebrew from linux to windows |
| Performance on Linux vs Windows |
| Backup Transfer from Windows Mysql to Linux Mysql |
| Re: Performance on Linux vs Windows |
| Copy specific tables from windows to Linux |
| Re: Copy specific tables from windows to Linux |
| From Linux to Windows |
| Different results on Linux and windows |
| Re: Different results on Linux and windows |
+-------------------------------------------------------------------------+
11 rows in set (0.02 sec)
mysql> SELECT title, MATCH(title) AGAINST('windows query linux') AS score FROM fti WHERE MATCH(title) AGAINST('+windows +query +linux') LIMIT 11;
+--------------------------------------------------------------------------+--------------------+
| title | score |
+--------------------------------------------------------------------------+--------------------+
| Connecting from PHP on one linux box to another linux running MySQL | 13.917098999023438 |
| Re: Connecting from PHP on one linux box to another linux running MySQL | 13.917098999023438 |
| Same Mysql Update query giving different result in linux and windows | 12.674331665039062 |
| Re: Same Mysql Update query giving different result in linux and windows | 12.674331665039062 |
| Re: Same Mysql Update query giving different result in linux and windows | 12.674331665039062 |
| Re: Same Mysql Update query giving different result in linux and windows | 12.674331665039062 |
| Re: Same Mysql Update query giving different result in linux and windows | 12.674331665039062 |
| Re: Same Mysql Update query giving different result in linux and windows | 12.674331665039062 |
| export hebrew from linux to windows | 11.582389831542969 |
| Performance on Linux vs Windows | 11.582389831542969 |
| Re: Performance on Linux vs Windows | 11.582389831542969 |
+--------------------------------------------------------------------------+--------------------+
11 rows in set (0.04 sec)
mysql> SELECT COUNT(*) FROM fti;
+----------+
| COUNT(*) |
+----------+
| 185079 |
+----------+
1 row in set (0.03 sec)
摘要
MySQL的FULLTEXT速度很快。
我的表是你的表的18%,但即使找到10%的行也很快。
有多种变体(BOOLEAN、NATURAL LANGUAGE、带/a不带+等)。
您需要在SELECT和WHERE中使用MATCH来查看数字并按“相关性”对其进行排序。
索引声明只是FULLTEXT KEY title ( title ),; title可以是VARCHAR或TEXT。
1条答案
按热度按时间at0kjp5o1#
摘要
FULLTEXT
速度很快。BOOLEAN
、NATURAL LANGUAGE
、带/a不带+
等)。SELECT
和WHERE
中使用MATCH
来查看数字并按“相关性”对其进行排序。FULLTEXT KEY
title(
title),
;title
可以是VARCHAR
或TEXT
。