- Layer
- 3. The Database Depths
- Type
- Monster
- Uptime
- 60, plus 10 per unindexed request
- Latency
- 8,400 ms and rising
- Threat Level
- ★★★☆☆
Lore
The Slow Query Slime starts out cute. A little blob, a few hundred rows, nothing to worry about. But every time it’s forced to read the whole table to find one record, it absorbs the effort and grows. A year later it fills the entire Database Depths, and every page load has to wade through it. Visitors start to wonder if the site is down. It isn’t. It’s just thinking.
How to defeat it
Add an Index. The Slime can’t grow if the database already knows exactly where to look. Database Wizards wearing the Index Amulet deal double damage here.
Real-world tip: A slow query is a database request that takes too long, often because the database has to scan every row instead of jumping straight to the right ones. An index works like a book’s index and lets MySQL find rows quickly. Tools such as the Query Monitor plugin or MySQL’s EXPLAIN show which queries are slow and whether they use an index. Common WordPress causes are huge autoloaded options and searches on unindexed post meta.
