測試了一下全文索引(ngram), 全文索引一個問題, 當每條數據都包含一個詞時,如:“活動”。 這時,搜索“活動”, 查詢速度偏慢。
20萬數據:0.89秒鐘
100萬數據:4.5秒鐘
沒有不走索引的like快。
如果不考慮分詞,推薦使用like。
參考文檔:
InnoDB全文索引基礎 https://blog.51cto.com/lee90/1959856
information_schema系列十 https://www.cnblogs.com/shengdimaya/p/6916554.html
MySQL中InnoDB全文檢索 https://www.cnblogs.com/olinux/p/5169282.html
N-GRAM解決MYSQL單表千萬級數據檢索 https://www.zengjianfeng.com/2017/06/150.html
https://dev.mysql.com/doc/refman/5.7/en/fulltext-search-ngram.html
https://dev.mysql.com/doc/refman/5.7/en/fulltext-search.html