Summing Up
In this chapter, we explored some of the most common issues you’ll run into when trying to optimize the way a Rails application accesses the database. Taking a more holistic approach, I recommend you get an understanding of what the database is really doing when you use that sweet, sweet ActiveRecord API to fetch and manipulate data. When using the database, less is always better. Less can mean four things:
-
Fewer rows need to be examined to get the result. This typically means using indexing, so your database engine doesn’t need to scan huge chunks of your table to complete the query.
-
Less data being returned from the database to the clients. This means being careful with the amount of data that you are fetching from the database ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access