I found the reson for my speed problem when rebuilding the index and using
deltas. The problem was the reset_query method in the DefaultDelta class. It
currently look like this:

def reset_query(model)
   "UPDATE #{model.quoted_table_name} SET " +
   "#[email protected]_column(@column.to_s)} = #{adapter.boolean(false)}"
end

This means that it will update every row in the table regardless of whether
delta is true or false. If I add an where statement only updating rows where
delta is true is much much faster:

def reset_query(model)
  "UPDATE #{model.quoted_table_name} SET " +
  "#[email protected]_column(@column.to_s)} = #{adapter.boolean(false)}" +
  " WHERE #[email protected]_column(@column.to_s)} = #{adapter.boolean(true)}"
end

/David


On Mon, Apr 27, 2009 at 11:29 PM, David Wennergren <
[email protected]> wrote:

> I'm experiencing the same increase in time when building my index after
> activating delta index (with delayed_job). I have a index on my delta
> column.
>
> Before it took a few minutes. Now it stops at:
>
> indexing index 'article_core'...
>
> After an hour or so it continues to build the index with the same speed as
> before using delta index.
>
> I'm using postgres and the 0.9.9 branch of TS with Sphinx 0.9.9-rc2
>
> /David
>
>
> > > 2) I attempted to use the delta mechanism but after added the delta
>> > > column
>> > > and the set propertly :delta => true into my define_index section of
>> > > my
>> > > model, indexing for the first time never completed.   I Hvae one table
>> > > with
>> > > close to 7 million rows that takes maybe a couple of minutes to index
>> > > but
>> > > after adding the delta and trying to create a fresh index, i let it
>> > > run for
>> > > 3 hours and it never even got to the point in the console output that
>> > > said
>> > > it was processing.  It just showed the initial "creating index...".
>> >
>> > Is there an index on your delta column?
>> >
>> Doh!   Forgot to add an index.    That's gotta be it.  Thanks!
>>
>>
>


-- 
David Wennergren

Newsdesk AB
Bondegatan 21
S-116 33 Stockholm
Sweden

+46 (0)8 50 900 211
[email protected]

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Thinking Sphinx" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/thinking-sphinx?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to