Hi Axel The reason for the search request is that Sphinx is checking whether the record exists in the before it updates attributes in that index (something it can do without requiring delta indexes). I'm going to change things so updates will be made to Sphinx and catch the relevant error if the record isn't in the index (which can happen for objects created since the last index).
You could set ThinkingSphinx.updates_enabled to false while updating - I'm surprised the query adds such an overhead though. Cheers -- Pat On 25/08/2011, at 8:24 PM, AxelD wrote: > Hi, > > I noticed a very bad performance when mass uploading products in my > database. I have isolated the problem and it turned out Sphinx was > slowing down every save by a Query. > > My product model: > > class Product < ActiveRecord::Base > define_index do > indexes additional_search_text > indexes title > has current_price > end > end > > > When I do a save of a product (p.save), my log files show (note the > Sphinx entries): > > SQL (0.1ms) BEGIN > AREL (0.3ms) UPDATE `products` SET `title` = 'product-title', > `updated_at` = '2011-08-25 10:09:46' WHERE `products`.`id` = 2 > Sphinx Query (1.9ms) > Sphinx Found 1 result > SQL (1.0ms) COMMIT > > > My question, what is the Sphinx Query doing in the save operation? > > I use now a work around by stopping Sphinx, updating the database with > all the new records and then indexing and starting Sphinx again. > Problem is that the text search is not available during the update. Is > there a better solution? > > Thanks in advance! > > Axel > > -- > 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. > -- 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.
