我正在尝试使用全文本分数获得全文本搜索的10个最佳匹配。
下面的查询在我的1000万行MyISAM表上运行完美:
SELECT
index,
MATCH(villes) AGAINST('montreuil') as score
FROM
(
SELECT index, villes
FROM table
WHERE MATCH(villes) AGAINST('montreuil' IN BOOLEAN MODE)
) t
但是,当我尝试检索订单分数时遇到错误时:
SELECT index
FROM (
*** PREVIOUS QUERY ***
) t2
ORDER BY t2.score
错误是:4秒后,mysql工作台中“与mysql服务器的连接断开”。
到目前为止,我已经尝试过:
我不清楚mysql日志:
10:10:58 UTC - mysqld got exception 0xc00000fd ;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
Attempting to collect some information that could help diagnose the problem.
As this is a crash and something is definitely wrong, the information
collection process might fail.
key_buffer_size=67108864
read_buffer_size=8388608
max_used_connections=3
max_threads=151
thread_count=2
connection_count=2
It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 2541349 K bytes of memory
Hope that's ok; if not, decrease some variables in the equation.
Thread pointer: 0x21ee0a9b580
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
2019-04-16T10:11:12.359438Z 0 [Warning] 'NO_AUTO_CREATE_USER' sql mode was not set.
编辑
显示创建表:
'CREATE TABLE `table` (
`index` int(11) NOT NULL,
`villes` text,
PRIMARY KEY (`index`),
FULLTEXT KEY `villes` (`villes`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8'
说明:
type: fulltext
possible keys: villes
key: villes
ref: const
rows: 1
filtered: 100.00
extra: using where, using filesort
答案 0 :(得分:0)
我找不到直接解决此问题的方法。我读了一些文章,解释说使用全文对子查询进行排序可能会导致一些内存问题。
但是,一种解决方法是使用子查询的结果创建一个临时表,并对它进行排序,这非常有效。