DEV Community

0 seconds of 4 minutes, 34 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!

AWS GenAI LIVE image

How is generative AI increasing efficiency?

Join AWS GenAI LIVE! to find out how gen AI is reshaping productivity, streamlining processes, and driving innovation.

Learn more

Top comments (0)

Speedy emails, satisfied customers

Postmark Image

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay