Slow flush ramchunk with hnsw

Author: glookkaCreated Sep 23, 2026Updated Sep 23, 2026
Labelsbug

Bug description

Ramchunk flush is slow when there's a HNSW index (27sec for 30k rows). Also, knn_parallel_build doesn't seem to have an effect. This needs to be investigated and fixed.

MRE:

D=/tmp/m4739; mkdir -p "$D"
cat >$D/m.conf <<EOF
searchd {
 listen=127.0.0.1:29306:mysql41
 listen=127.0.0.1:29308:http
 data_dir=$D
 pid_file=$D/pid
 log=$D/log
 binlog_path=
}
EOF
searchd --config $D/m.conf >/dev/null; sleep 1
mysql -h127.0.0.1 -P29306 -e "DROP TABLE IF EXISTS t; CREATE TABLE t(v float_vector knn_type='hnsw' knn_dims='768' hnsw_similarity='cosine' quantization='1bit') rt_mem_limit='1G'"
perl -e '$v=join(",",(0.0360844)x768);for(1..30000){print qq({"insert":{"table":"t","id":$_,"doc":{"v":[$v]}}}\n)}' >$D/docs
time wget -qO/dev/null --header='Content-Type: application/x-ndjson' --post-file=$D/docs http://127.0.0.1:29308/bulk
echo loaded
time mysql -h127.0.0.1 -P29306 -e 'FLUSH RAMCHUNK t'
~  bash /tmp/t.sh

real	0m27.030s
user	0m0.017s
sys	0m0.330s
loaded

real	0m10.789s
user	0m0.005s
sys	0m0.005s

Manticore Search version

Operating system version

Have you tried the latest development version?

Yes — the issue still occurs

How does this bug affect you?

Minor issue / no significant operational impact

How do you use Manticore Search?

No response

What do you use Manticore for?

No response

Company or project

No response

Approximate scale

No response

Can we learn more about your use case?

  • Yes — feel free to @mention me in this issue if you'd like to ask more about how we use Manticore.

Internal Checklist

To be completed by the assignee. Check off tasks that have been completed or are not applicable.

  • Implementation completed
  • Tests developed
  • Documentation updated
  • Documentation reviewed

Source: manticoresoftware/manticoresearch