MySQL 5.6 InnoDB 全文搜索
我意识到 MySQL 5.6 仍处于测试阶段,但是有人有使用新的 InnoDB FTS 引擎的经验吗?它与狮身人面像之类的东西相比如何?
谢谢 贾森
I realize that MySQL 5.6 is still in beta, but does anyone have experience using the new InnoDB FTS engine? How does it compare to something like Sphinx?
Thanks
Jason
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
从未使用过 Sphinx,但在大约 170k 行的 Innodb 表上尝试过 MySQL 5.6 FTS。在姓名列上创建 FTS 索引(包含一个人的所有姓名)。要在字符串的任何位置查找单词
MATCH(name) AGAINST("+word*") IN BOOLEAN MODE
确实比使用快得多(在我的例子中为 2-3 倍) >名称如“word%”或名称如“%word”
。但是,在进行连接时,请检查 EXPLAIN 以查看是否实际使用了 FTS 索引。看来 MySQL 优化器不太擅长猜测何时应该使用 FTS 索引。Never used Sphinx, but tried MySQL 5.6 FTS on an Innodb table with about 170k rows. Made an FTS index on the name column (contains all names of a person). To find a word in any position of the string
MATCH(name) AGAINST("+word*") IN BOOLEAN MODE
does work a lot faster (2-3 times in my case) than usingname LIKE "word%" OR name LIKE "% word"
. However when making joins do check EXPLAIN to see if the FTS index is actually used. It seems MySQL optimizer is not that good at guessing when the FTS index should be used.以前需要从 labs.mysql.com 下载特殊版本的 FULLTEXT 功能现在是 5.6.5 及更高版本中主线 MySQL 版本的一部分(仍处于测试阶段)。 FULLTEXT 函数的文档现在包含 InnoDB 特定的详细信息: MySQL全文搜索功能
The FULLTEXT feature that formerly required downloading a special build from labs.mysql.com is now part of the mainline MySQL build in 5.6.5 and up (still in beta). The documentation for the FULLTEXT functions now includes the InnoDB-specific details: MySQL Full-Text Search Functions
请记住,Sphinx 搜索是为 mysql 中的全文搜索而开发的,这只是一个功能...
这里有 sphinx 和 mysql FTS 的比较:
http://www.percona.com/files//presentations/opensql2008_sphinx.pdf
下面是 InnoDB FTS 与 MyISAM 对比的性能测试:
http://blogs.innodb.com/wp/2011/07/ innodb-fts-performance/
InnoDB 的速度更快一点,尤其是在索引方面,但它与 sphinx 的性能相比还很远......
Remember, that Sphinx search is developed for full text searching in mysql it's just a feature...
Here you have compare of sphinx and mysql FTS:
http://www.percona.com/files//presentations/opensql2008_sphinx.pdf
Here is performance test of InnoDB FTS compared to MyISAM:
http://blogs.innodb.com/wp/2011/07/innodb-fts-performance/
InnoDB its bit faster especially in indexing, but it's still far away from sphinx performance...