Ruby on Rails
Tuesday, July 18, 2017
hi, when i run my index action it takes forever to load up (www.ezhubb.com/search). how can i speed up the mysql / rails process? i do try to limit the results, but this code is not working: @q = MyModel.order("RAND()").limit(100).ransack(:some_field => Date.today ) @q.result(distinct: true).includes(:user).paginate(page: params[:page], per_page: 30) #.order("RAND()")
any ideas how to speed this up? ho wmany record should i pull when no search criterias are given? everything is still on default settings (mysql, nginx etc..) 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/dc4958a3-838f-40ef-8708-2d59cf26a120%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment