Module 57: Transactions and Indexes

Lesson 5 of 5 · 15–25 minutes

Performance habits

🏠The everyday picture

A busy restaurant speeds up by fixing what's actually slow (the one overloaded station), not by buying a bigger building on a hunch.

📘What it really is

🖱️Try it

Write two versions of "show the 50 latest orders with customer names": one with a loop doing a query per order (you can simulate it by running the customer query 50 times), and one with a join. Compare the number of queries and time. Add the finding to your queries.sql notes.

✅Quick check

What's the N+1 query problem?

Show the answer

One query to load a list, then one more query per item, instead of fetching everything needed in one or two queries.

Why keep transactions short?

Show the answer

Long transactions hold locks that block other users' changes.

← PreviousReading query plans
ProLearners Assist