It’s probably happened to most Rails devs working on an app of any scale – the app seems a little sluggish on certain screens and you see a bunch of these in your logs:
<code>SELECT * FROM ...
SELECT * FROM ...
SELECT * FROM ...
</code>
Over. And over. And over. Congrats! You’ve discovered an N+1 query. If you’re early in your Rails career, this is rite of passage – kid of like getting in a fender-bender with your first car. If you’re mid-career, it’s more like a recurring nightmare that shows up just when you think your app is clean. Luckily, Rails gives us some great tools like .includes and .preload, but you still have to know where the N+1s are. And let’s be honest: scrolling through logs like you’re deciphering the Dead Sea Scrolls is not the move. Enter Prosopite.
What Is Prosopite?
Prosopite is a tiny gem that quietly watches your app for N+1 queries — in dev and in test — and then tattles on you in the most helpful way possible.
The best part? It doesn’t just say,
“Hey pal, you’ve got an N+1.”
It tells you exactly where the offending code is.
That means less spelunking, less finger-pointing, and fewer “but it worked on my machine” moments.
Why You Actually Want This in Your Rails Stack
1. N+1s Are Silent Performance Killers
They’re the reason your app goes from “pretty snappy” to “the server is making noises like an old diesel tractor.”
Prosopite flips the lights on.
2. It Works in Development, Test… and (Carefully) Production
By default, you’ll enable it in development and test. Which is perfect, because you want to catch N+1s before your users experience them.
Can you run it temporarily in production? Sure — if your traffic is sane and you’re careful. Prosopite is intentionally low-overhead. Just don’t run it all the time in a high-traffic environment unless you enjoy fire drills.
3. It Fits Naturally Into a Rails Workflow
Just add it to your Gemfile:
<code>group :development, :test do
gem 'prosopite'
end
</code>
Then create an initializer:
<code># config/initializers/prosopite.rb
if Rails.env.development? || Rails.env.test?
Prosopite.rails_logger = true
Prosopite.raise = true # optional, but forces you to fix the N+1
end
</code>
Now Rails will literally blow up your request the moment you introduce an N+1.
It is both helpful… and slightly judgmental. Which is honestly how all developer tools should be.
4. Your Future Self Will Thank You
If you ever want to make your future self genuinely happy, eliminate N+1s before adding features. Nothing is worse than debugging performance issues in an area you haven’t touched in six months because some Model Concern named CommonScopes is secretly doing a nested eager load from hell.
With Prosopite installed, you won’t forget. It will remind you. Loudly.
Prosopite in the Real World
Here’s what a Prosopite warning looks like:
<code>Prosopite: N+1 query detected
User => posts
app/controllers/users_controller.rb:12
</code>
That’s it. That’s the ballgame.
No spelunking, no guesswork — fix it with something like:
<code>@users = User.includes(:posts)
</code>
Boom. Shipped.
Bonus: Works Great in CI
If you enable raise = true for your test environment, your test suite will fail the moment an N+1 creeps in. This is the kind of guardrail that junior and mid-level devs particularly benefit from — it enforces good habits without forcing them to be database detectives.
If you lead a team, turning Prosopite on in test is like giving everyone free performance-review points.
Who Should Be Using Prosopite?
Honestly? I don’t see a reason not to, but your focus may vary based on your career stage:
- Junior devs learning how ActiveRecord really works
- Mid-level devs who want to stop guessing and start shipping confidently
- Seniors who are tired of cleaning up other people’s N+1 messes
- Teams adopting Rails 7+ where performance expectations are higher
If you care about performance — and you should — this belongs in your toolkit. If you need help with data migrations, visualizations or custom dev, checkout Alice.







