How to optimize slow SQL queries?

Asked by Lisa Park Jun 15, 2025 intermediate 949 views
54

My SQL query is running very slow on a large table (millions of rows). The query:

SELECT * FROM orders
WHERE customer_id = 12345
  AND created_at > '2024-01-01'
ORDER BY created_at DESC;

What steps should I take to optimize this? How do I use EXPLAIN to analyze queries?

Solutions

0 answers

No solutions yet

Be the first to help solve this problem!