DEV Community

0 seconds of 0 secondsVolume 90%
Press shift question mark to access a list of keyboard shortcuts
00:00
00:00
04:34
 
AppMap Ruby for AppMap

Posted on

12 6

Find the N+1 Query Problem in Rails Apps in Under 5 Mins

This video is based on the brilliant Eager Loading and the N+1 Query Problem blog post by Kevin Gilpin.

It is a short demonstration of how to identify the N+1 Query anti-pattern using the AppMap extension for VS Code, jq and the Rails Sample Application Sixth Edition as an example.

The N+1 anti-pattern happens when a query is executed for every result of a previous query. If left unchecked N+1 queries result in a gradual slowdown in the performance of an application.

N+1 Query Problem

Detecting  N+1 queries is tricky, because they are not revealed by any mainstream testing strategy.

To detect the N+1 query problems we need to look at the number of SQL queries that are performed in a realistic situation, such as an integration test, and compare this number with a “reasonable” expectation.

You can find full usage instructions, and all these links, on the AppMap page in the VSCode marketplace.

Thanks for watching!

Heroku

Built for developers, by developers.

Whether you're building a simple prototype or a business-critical product, Heroku's fully-managed platform gives you the simplest path to delivering apps quickly — using the tools and languages you already love!

Learn More

Top comments (0)

5 Playwright CLI Flags That Will Transform Your Testing Workflow

  • 0:56 --last-failed
  • 2:34 --only-changed
  • 4:27 --repeat-each
  • 5:15 --forbid-only
  • 5:51 --ui --headed --workers 1

Learn how these powerful command-line options can save you time, strengthen your test suite, and streamline your Playwright testing experience. Click on any timestamp above to jump directly to that section in the tutorial!

👋 Kindness is contagious

If this article connected with you, consider tapping ❤️ or leaving a brief comment to share your thoughts!

Okay