开发者

Sphinx reindexing takes several hours

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 => tru开发者_运维知识库e
    has rewrites_count, :sortable => true
    has relevance, :sortable => true
    has user_id
    set_property :delta => :datetime
  end


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

 created_at
 rewrites_count
 relevance

in addition to your primary keys naturally.


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)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜