The most common performance fix I apply to production databases: add an index.
A table with 500,000 rows and no index on the filtered column performs a full table scan on every query — 500,000 row evaluations for a query that should return 10 rows in under a millisecond.
Always index foreign keys. Always index columns in WHERE and ORDER BY for frequent queries. Use composite indexes when you filter on multiple columns together.
Run EXPLAIN on your slow queries. Add the missing indexes. This is the highest-return database work you will ever do.
— Dick Bassey | DevDick | 2019