The Need for Speed Part of the reason for MySQL’s blazing performance is its fully multi-threaded architecture, which allows multiple concurrent accesses to the database. This multi-threaded architecture is the core of the MySQL engine, allowing multiple clients to read the same database simultaneously and providing a substantial performance gain. The MySQL code tree is also structured in a modular, multi-layered manner, with minimum redundancies and special optimizers for such complex tasks as joins and indexing. MySQL’s designers also initially left out many of the features that cause performance degradation on competing systems, including transactions, referential integrity, and stored procedures. (These features typically add complexity to the server and result in a performance hit.) User requests for these features, however, have resulted in a creative compromise: versions of MySQL later than 3.23.34a do include support for transactions but allow users to make the choice of whether to enable them (and lose some measure of performance) or exclude them (and continue to operate at peak efficiency). This choice may even be made on a table-by-table basis, making it possible to perform fine-grained optimization for maximum performance. Finally, MySQL 4.0 also includes a unique new feature, a query cache, which can substantially improve performance by caching the results of common queries and returning this cached data to the caller without having to reexecute the query each time. (This is different from competing systems, such as Oracle, in that those systems merely cache the execution plan, not the results. However, they still need to execute the query, including all joins, and re-retrieve the query results on every run.) MySQL benchmarks claim that this feature improves performance by more than 200 percent, with no special programming required on the part of the user. |