索引时思考的Sphinx挂起

时间:2013-01-24 22:42:31

标签: ruby-on-rails sphinx thinking-sphinx

我正在使用Thinking Sphinx为单个表索引43,000条记录。当我尝试索引它时,该过程运行非常缓慢并在36,000之后冻结。

我认为数据存在一些问题,并试图发现哪个索引导致了问题。删除除11个索引以外的所有索引后,我仍然一直看到错误。但这就是问题:没有一个指数似乎是罪魁祸首。如果我删除过去11中的任何一个,则该过程完成而不会冻结。如果我把它添加回来,问题就会回来。 (虽然我注意到当我删除其中一个索引时,该过程仍然在39,000处减慢很多。)

所以现在我很难过。我有足够的RAM和磁盘空间,所以这不是问题。我将sql_range_step设置为15000,将mem_limit设置为2047M。什么都没有帮助。

这是我精简的索引列表:

  define_index do
    indexes :email
    has :id, :as => :code
    has :premium_school_id
    has :current_employer_account_id
    has :years_experience_id
    has :user_status_id
    has practice_areas(:id), :as => :practice_area_ids
    has languages(:id), :as => :language_ids
    has preferred_employer_types(:id), :as => :preferred_employer_type_ids
    has geographical_regions(:id), :as => :geographical_region_ids
    has workflow_events(:id), :as => :workflow_event_ids
  end

欢迎任何想法。

1 个答案:

答案 0 :(得分:0)

Pat Allan最近为我回答了一个类似的问题,可能值得一读这个帖子看看是否有帮助。

基本上它与has_and_belongs_to_many关系中的大量连接以及Thinking Sphinx生成结果SQL的方式有关。

https://groups.google.com/d/msg/thinking-sphinx/CBdWy-RivaU/tBRlLci83IkJ