Ruby on Rails Sunday, October 15, 2017

your like '%Tampa% will not use an index.  Looks like you are implementing some type of search.  For this type of free text search SQL is not a good option.  Elasticsearch is worth looking at or goodle for 'rails free text serach tools'.

Ben

On Thursday, October 12, 2017 at 3:17:04 PM UTC+1, der_tom wrote:
hi,

i am using ransack and i am experiencing slow queries, eg on the search sites i have a query like that:

SELECT DISTINCT COUNT(DISTINCT `tablename`.`id`) FROM `tablename` WHERE (`tablename`.`city` LIKE '%Tampa%');
~5sec

w/o distinct 
~ 6sec

w/o distinct & w/o where
~4 sec



what do you guys do? i reviewed all indexes, datatypes, memory is ok. no overload.

and yet i am feeling that i am missing something....

thx


--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/b2b49cc0-0d24-443b-881f-c04f9568d760%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment