Sphinx 重新索引需要几个小时
我应该怎样做才能加速 Sphinx 索引(使用 MySQL)? 我应该使用其他数据库,noSQL 数据库吗?
另请注意,增量索引速度很快,只有完整的 redeinx 过程很慢。 请详细解释一下。谢谢!
更新: 我正在对超过 100.000 个项目重新建立索引,我的 Thinking-sphinx 索引定义如下所示
define_index do
indexes [text, user(:nickname), user(:full_name)]
has rewrites(:id), :as => :rewrite_id
has rewrites(:user_id), :as => :rewrite_user_id
has [rewrites(:user_id), user_id], :as => :user_id_or_rewrites_user_id
has comments(:user_id), :as => :comments_user_id
has simbols(:id), :as => :simbol_ids
has followings(:follower_id), :as => :follower_id
has follows(:followable_id), :as => :followable_id
has created_at, :sortable => true
has rewrites_count, :sortable => true
has relevance, :sortable => true
has user_id
set_property :delta => :datetime
end
What should I do to speed up Sphinx indexing (using MySQL)?
Should I use other database, noSQL database?
Note also that delta indexing is fast, only a full reindeinx process is slow.
Please explain in details. Thx!
UPDATE:
I'm reindexing over 100.000 items and my thinking-sphinx index definition looks like this
define_index do
indexes [text, user(:nickname), user(:full_name)]
has rewrites(:id), :as => :rewrite_id
has rewrites(:user_id), :as => :rewrite_user_id
has [rewrites(:user_id), user_id], :as => :user_id_or_rewrites_user_id
has comments(:user_id), :as => :comments_user_id
has simbols(:id), :as => :simbol_ids
has followings(:follower_id), :as => :follower_id
has follows(:followable_id), :as => :followable_id
has created_at, :sortable => true
has rewrites_count, :sortable => true
has relevance, :sortable => true
has user_id
set_property :delta => :datetime
end
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
建立完整索引的速度很慢。有多慢?
建立 Delta 指数的速度很快。
根据我的经验,这听起来很正常。
noSQL 数据库(我上次听说@Rails 2.3.5)很难与Rails 集成。 SQL 速度不依赖于您的数据集和关系。
如果没有更多信息,这听起来很正常。
== 编辑 ==
确保
除了主键之外还有 SQL 索引。
Building a full index is slow. How slow?
Building a delta index is fast.
This sounds normal in my experience.
noSQL databases (last I heard @Rails 2.3.5) were kind of difficult to integrate with Rails. No SQL speeds depend on your data sets and relations.
Without more information this sounds normal.
== Edit ==
Make sure you have SQL indexes on
in addition to your primary keys naturally.
使用thinking_sphinx时,请始终查看它在真实sphinx配置文件中生成的SQL。针对它将运行的所有查询运行查询分析器。我发现您还可以对查询进行相当多的操作。
另外,对于一对多关系,您可能需要添加以下内容:
:source => :ranged_query
它将导致 sphinx 使用单独的查询来收集子项而不是外连接。在许多情况下它要快得多。
When working with thinking_sphinx always look at the SQL it generates in the real sphinx configuration file. Run a query analyzer against all the queries it will run. I have found you can also manipulate the queries quite a bit.
Also for one to many relationships you may need to add this:
:source => :ranged_query
It will cause the sphinx to use a separate query to gather the children rather than an outer join. It is much faster in many cases.
使用实时索引怎么样(调整适当的内存限制)
how about using Real Time indexes (with adjusting appropriate memory limit)