This section explores how to design and configure your MySQL database to be as fast as possible.
Chapter 4, "Designing for Speed," begins by examining the various types of MySQL storage engines, as well as how they should be selected for optimal speed. This chapter also assesses a number of performance-related table configuration parameters, as well as how you can use views to speed and simplify your application. Finally, the chapter discusses situations in which you might want to denormalize your database.
MySQL offers a collection of constraints that you can use to help improve performance. These include PRIMARY, FOREIGN, ENUM, and SET constraints. Chapter 5, "Using Constraints to Improve Performance," reviews how to employ these constraints in your applications.
Chapter 6, "Understanding the MySQL Optimizer," investigates the MySQL optimizer, including a detailed review of the EXPLAIN command, which provides valuable information about how the optimizer processes requests. It also explores the ANALYZE TABLE and OPTIMIZE TABLE commands. Finally, Chapter 6 discusses how to give the optimizer hints on how you want it to behave.
Without a doubt, proper indexing can spell the difference between a sluggish application and one that works well. Chapter 7, "Indexing Strategies," provides extensive coverage of best practices for indexing. It reviews how MySQL structures and stores indexes, as well as which types of indexes to use for various situations and storage engines.