How to Eliminate Unnecessary Database Queries in Rails


Argh! Your Rails app is taking far too long to process each request. What’s going on!?

On the server side, one of the things that can slow down a Rails app the most is the number of round-trips to the database. And one of the most common causes of too many round-trips: the infamous N+1 query.

In the following video snippet from my Rails 4.1 Performance Fundamentals video course, you will learn how to install and use the Bullet gem. This gem notifies you, the developer, whenever any page has an N+1 query. And it tells you exactly how to fix it.

I’ve got a bunch of Pluralsight unlimited access cards to give away

[UPDATE: I have run out of Pluralsight discount cards. Sorry!]


Pluralsight is a subscription-based tech training site for developers. After I finished making this course, they gave me hundreds of Unlimited Access Passes to give away. The cards give you unlimited viewing hours for one month. Without a card, their normal free trial is only good for 200 minutes over 10 days.

If you’d like one, just add a comment and I’ll email you a private message with a code. (While supplies last.)

In addition to being able to view all the old PeepCode content, these cards give you access to watch a bunch of newer tech training videos. Many of them are really good. They’ve got some super-popular, in-depth courses on topics like Angular and jQuery. And since they also bought Digital Tutors, they’ve got a bunch of content on digital creation. (Photoshop, Illustrator, game design, animation, and so on.)