You’re staring at a query that takes 30 seconds to run. Your users are upset, and the database server’s fans are whirring loudly. Performance tuning is the art of making that query fly. In this chapter, we’ll look at ways to turn a slow database into a fast one — from clever indexing and smart memory use to telling the optimizer exactly what you want.