3 min read2 days ago
–
Press enter or click to view image in full size
if you are not a medium member then Click here to read free
If you’ve ever seen your backend API take forever to load — like 10 seconds just to show some data — there’s a high chance the problem isn’t your code… it’s your SQL.
But don’t worry — this isn’t another boring “use indexes” article. We’ll go step-by-step, in simple language, so even if you’re not a database expert, you’ll get it immediately.
1. Don’t Bring Everything — Take Only What You Need
Imagine you’re in a restaurant. You say:
“Bring me everything on the menu.
The wait…
3 min read2 days ago
–
Press enter or click to view image in full size
if you are not a medium member then Click here to read free
If you’ve ever seen your backend API take forever to load — like 10 seconds just to show some data — there’s a high chance the problem isn’t your code… it’s your SQL.
But don’t worry — this isn’t another boring “use indexes” article. We’ll go step-by-step, in simple language, so even if you’re not a database expert, you’ll get it immediately.
1. Don’t Bring Everything — Take Only What You Need
Imagine you’re in a restaurant. You say:
“Bring me everything on the menu.
The waiter takes 30 minutes.
But if you say:
“Just a burger and fries.”
You get it in 5 minutes.
That’s exactly what happens in SQL. If you write:
SELECT * FROM orders;
You’re bringing every column.
Instead:
SELECT id, customer_name, total_price FROM orders;
Only bring what your app actually needs — it’s faster and lighter.