
"Why is this query suddenly so slow?" is almost always an indexing question once your tables grow past a few thousand rows. Here's the short version.

An index is basically a lookup table that lets the database find rows without scanning every single one. Without an index on a column you filter or join on, the database does a full table scan — fine on a small table, painfully slow once it grows.
Index columns used in WHERE clauses, especially ones on large tables.
Index foreign keys used in JOINs.
Composite indexes help when you frequently filter on multiple columns together.
Don't over-index — every index speeds up reads but slows down writes (inserts/updates), so index what you actually query, not everything.

Most databases have an "explain query" tool (EXPLAIN in MySQL/Postgres) that shows exactly whether your query is using an index or doing a full scan — that's the first thing to check before guessing.

What's the biggest speed improvement you've gotten from adding a single index?