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