Ruby on Rails Thursday, May 23, 2019

Turn your logging level up to debug, and watch the queries that are being generated by ActiveRecord in order to load this route. Are you seeing multiple requests to the database, or one big honking joined query? Sometimes using joins is slower than eager loading (which generally loads in two or more queries). But for slow, nothing beats an N+1 query, where you load a bunch of objects, then make a separate query or more per object to gather associated records from other related models.

Without any more details about your setup (running on a Raspberry Pi? or bouncing your database connection off the moon?) it's impossible to say. But start there.

Walter

> On May 23, 2019, at 3:02 PM, tom <tomabroad@gmail.com> wrote:
>
> i have roughly 30 resources in routes, 10 scopes, a few nested resources. how can i find out what the problem is?
>
> --
> 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/CADQqhMcMrB1ZLtn_v76RbW33vV1N-M%2B5Xypt3u1H-FBA342jDg%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.

--
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/67541D5B-D756-40C3-AC98-476C46D351BD%40wdstudio.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment