Monday, January 29, 2018

[Rails] Re: help with ransack / mysql performance

That query looks suspiciously like you might be using kaminari for pagination? If so that is what is causing this slow query. See https://github.com/kaminari/kaminari#paginating-without-issuing-select-count-query for how to solve that. I don't believe ransack ever needs to count anything.

On Thursday, October 12, 2017 at 7:17:04 AM UTC-7, 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/d47efafc-ab5d-4965-aeaa-13b870d7ea8a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment