My query took 2 minutes. I added ONE line. Now it's 0.3 seconds. 🚀
Me: "Why is this so slow?"
Senior Dev: "Do you have an index?"
Me: "A what now?"
The Problem:
SELECT * FROM orders
WHERE customer_id = 12345;
-- ⏱️ 127 seconds
The Fix:
CREATE INDEX idx_customer
ON orders(customer_id);
-- ⏱️ 0.3 seconds
The Rule: Index columns in your WHERE clause.
That's it. 400x faster.
What obvious thing did you learn embarrassingly late? 👇
#SQL #DataEngineeringtamil #DataEngineering