Im trying to get the 10 best matches of a fulltext search using fulltext score.
Following query works perfectly on my 10M lines MyISAM table :
SELECT
index,
MATCH(villes) AGAINST('montreuil') as score
FROM
(
SELECT index, villes
FROM table
WHERE MATCH(villes) AGAINST('montreuil' IN BOOLEAN MODE)
) t
However, when I get an error when trying to retrieve to order scores :
SELECT index
FROM (
*** PREVIOUS QUERY ***
) t2
ORDER BY t2.score
Error is : "Lost connection to mysql server" in mysql workbench after 4 seconds.
So far I've tried:
The mysql log is unclear to me :
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.
EDIT
SHOW CREATE TABLE :
'CREATE TABLE `table` (
`index` int(11) NOT NULL,
`villes` text,
PRIMARY KEY (`index`),
FULLTEXT KEY `villes` (`villes`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8'
EXPLAIN :
type: fulltext
possible keys: villes
key: villes
ref: const
rows: 1
filtered: 100.00
extra: using where, using filesort
I couldnt find a direct solution to this problem. I read some posts explaining that sorting a subquery using fulltext might cause some memory issues.
However a workaround was to create a temporary table with the result of the subquery and sort it which works perfectly.
User contributions licensed under CC BY-SA 3.0