当我添加一些以布尔模式为条件的单词时,全文匹配忽略了它的索引。选择如下:
explain select * from seeds WHERE MATCH(text) AGAINST ("mount cameroon" IN BOOLEAN MODE);
Run Code Online (Sandbox Code Playgroud)
产出
+----+-------------+-------+----------+---------------+------+---------+------+------+-------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+-------+----------+---------------+------+---------+------+------+-------------+
| 1 | SIMPLE | seeds | fulltext | text | text | 0 | | 1 | Using where |
+----+-------------+-------+----------+---------------+------+---------+------+------+-------------+
Run Code Online (Sandbox Code Playgroud)
具有多个条件词的相同查询
explain select * from seeds WHERE MATCH(text) AGAINST ("mount cameroon" IN BOOLEAN MODE) = 4;
Run Code Online (Sandbox Code Playgroud)
产出
+----+-------------+-------+------+---------------+------+---------+------+------+-------------+
| id …
Run Code Online (Sandbox Code Playgroud) 我有一个基本表:
create table fullTextTest
(
id INT(11) NOT NULL,
superText CHAR(255) NOT NULL,
superLongText TEXT NOT NULL,
primary key (`id`),
FULLTEXT KEY `superText` (`superText`),
FULLTEXT KEY `superLongtext` (`superLongtext`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
insert into fullTextTest
set id=1,
superText="Hi guys, how is it goin'?",
superLongtext="Please give me some dummy text to search on!!!"
;
show index from fullTextTest;
| fullTextTest | 0 | PRIMARY | 1 | id | A | 1 | NULL | NULL | | BTREE | | …
Run Code Online (Sandbox Code Playgroud) 我在https://serverfault.com/questions/353888/mysql-full-text-search-cause-high-usage-cpu 上提出了一个问题一些用户建议在这里提问。
我们建立了一个新闻网站。每天我们都会从web api输入数以万计的数据。
为了提供精准的搜索服务,我们的表使用了MyISAM,建立了全文索引(标题、内容、日期)。我们的网站正在测试 Godaddy VDS,内存为 2GB,空间为 30GB(无交换,因为 VDS 不允许构建交换)。CPU是Intel(R) Xeon(R) CPU L5609 @ 1.87GHz
运行一个 ./mysqltuner.pl
我们得到一些结果:
-------- General Statistics --------------------------------------------------
[--] Skipped version check for MySQLTuner script
[OK] Currently running supported MySQL version 5.5.20
[OK] Operating on 32-bit architecture with less than 2GB RAM
-------- Storage Engine Statistics -------------------------------------------
[--] Status: -Archive -BDB -Federated +InnoDB -ISAM -NDBCluster
[--] Data in MyISAM tables: 396M (Tables: 39)
[--] Data in InnoDB tables: 208K (Tables: 8)
[!!] …
Run Code Online (Sandbox Code Playgroud)