Asked about Getting the data out
A query is slow. How do you diagnose it?
An answer that works
EXPLAIN ANALYZE and look at whether it is scanning the table or using an index, and how many rows it reads compared to how many it returns. A sequential scan on a large table where you filter on a column usually means a missing index.
Reading an answer is not being able to give one. The section that teaches this is Getting the data out, 6 hours of SQL & data access.
Learn this properlyAlso asked about SQL & data access
What is the difference between WHERE and HAVING?When do you use a LEFT JOIN?What is a window function for?Write a query for each user's most recent order.Why can NOT IN return nothing?What is the difference between COUNT(*) and COUNT(column)?A client retries a request after a timeout. How do you make sure it is not processed twice?What is a race condition in a read-modify-write, and how do you prevent it?