Tech
Rails Interview #1: The N+1 Query Problem
You ship a /posts index page. It renders 50 posts, and for each one it shows the author's name with post.author.name . QA says the page is slow, and the logs are full of repetitive SQL.
What is this problem called, and why is it happening?
How would you detect it, in dev and in a running app?
How do you fix it, and what's the difference between the main fixing strategies?
Answer: N+1 queries
What it is and why it happens
This is the N+1 query problem. One query...
Read the full discussion on Dev.to
This article was aggregated from Dev.to. Click to join the conversation.
View on Dev.to