0

我在我的 innoDB 数据库中使用全文搜索时遇到了一个大问题。
首先,ns_pages 表有超过 2.6m 的记录,全文索引和 3 个 keyblock。
该数据库在具有 128GB 内存的戴尔 R710 上运行。
当我使用此查询时,数据库停止工作。
如果我使用 webmin 检查查询,我会看到查询在超时之前仍然有效。

查询很简单,但我不知道为什么它不起作用。

SELECT   sh.id,body, `source`, `page_in_source`, `datepaper`, `folder`
, `attach_fn`, Description,s.ImgFName
FROM ns_pages sh INNER JOIN ns_source s on s.id=sh.source where viewnews=1 
AND DATE_ADD(sh.datepaper,INTERVAL s.days_in_advance DAY)  
BETWEEN '2017-12-22' AND '2017-12-22' 
AND source in (1815,345,1,382,89,14,12,239,108,119,485,490,13,509,2,537,182,193,333,559,1817,111,506,1615,1752,248,33,34,35,357,36,458,131,26,27,32,30,29,31,28,1816) 
AND MATCH (body) AGAINST ('"United States of America"' IN BOOLEAN  MODE) 
order by datepaper, DistributionArea, cadence, Description, page_in_source desc

但简单的一个很好用

SELECT   sh.id,body, `source`, `page_in_source`, `datepaper`, `folder`
, `attach_fn`, Description,s.ImgFName
FROM ns_pages sh INNER JOIN ns_source s on s.id=sh.source where viewnews=1 
AND DATE_ADD(sh.datepaper,INTERVAL s.days_in_advance DAY)  
BETWEEN '2017-12-22' AND '2017-12-22' 
AND source in (1815,345,1,382,89,14,12,239,108,119,485,490,13,509,2,537,182,193,333,559,1817,111,506,1615,1752,248,33,34,35,357,36,458,131,26,27,32,30,29,31,28,1816) 
AND MATCH (body) AGAINST ('Jamaica' IN BOOLEAN  MODE) 
order by datepaper, DistributionArea, cadence, Description, page_in_source desc

执行计划

4

1 回答 1

0

问题在于文本

MATCH (body) AGAINST ('"United States of America"' IN BOOLEAN MODE)

搜索词包括美国在双引号内,并且在我的 MySQL 布尔搜索中针对全文搜索,内容被视为单个搜索。

你删除双引号

MATCH (body) AGAINST ('United States of America' IN BOOLEAN MODE)

于 2017-12-22T10:52:32.083 回答