主要翻译记录https://dev.mysql.com/doc/refman/8.0/en/optimization.html
This chapter explains how to optimize MySQL performance and provides examples. Optimization involves configuring, tuning, and measuring performance, at several levels. Depending on your job role (developer, DBA, or a combination of both), you might optimize at the level of individual SQL statements, entire applications, a single database server, or multiple networked database servers. Sometimes you can be proactive and plan in advance for performance, while other times you might troubleshoot a configuration or code issue after a problem occurs. Optimizing CPU and memory usage can also improve scalability, allowing the database to handle more load without slowing down.
本章解释如何优化mysql的性能,并提供了例子。优化涉及了在各个层次配置、调试、和测试性能。对于不同的工作角色(开发者、数据库管理员),你可能需要从单独的sql声明语句、整个应用、单个数据库服务器或多个联网服务器等层次进行优化。有时可能是积极主动地提前计划以提升性能,也可能是在当问题发生后检查配置或代码中的故障。优化CPU和内存使用也可以提升可扩展性,使得数据库能够处理更大的负载并且不会降低处理速度。
Database performance depends on several factors at the database level, such as tables, queries, and configuration settings. These software constructs result in CPU and I/O operations at the hardware level, which you must minimize and make as efficient as possible. As you work on database performance, you start by learning the high-level rules and guidelines for the software side, and measuring performance using wall-clock time. As you become an expert, you learn more about what happens internally, and start measuring things such as CPU cycles and I/O operations.
从数据库的层次来讲,优化依赖多个因素,比如表、查询语句、配置设置信息。这些软件构成会造成硬件层面上的CPU和I/O操作,而CPU和I/O操作是你必须要最小化以尽可能提升性能。面对数据库性能问题时,新手会从软件层面的高层次的规则和指南入手,并且通过墙上时钟时间来衡量性能(https://blog.csdn.net/xingchenxuanfeng/article/details/73549506)。而成为专家需要知道其内部发生了什么,并开始使用CPU的时钟周期和I/O操作来衡量性能。
Typical users aim to get the best database performance out of their existing software and hardware configurations. Advanced users look for opportunities to improve the MySQL software itself, or develop their own storage engines and hardware appliances to expand the MySQL ecosystem.
典型的使用者目标是在已有的软硬件配置上实现数据库的最佳性能。高级使用者寻找机会来提升mysql软件本身,或者开发自己的存储引擎和硬件设备来扩展mysql生态圈。
The most important factor in making a database application fast is its basic design:
让数据库应用变快的最重要因素是它的基本设计:
InnoDB
or a nontransactional one such as MyISAM
can be very important for performance and scalability.InnoDB
tables, and for read-only MyISAM
tables.InnoDB
storage engine handles most locking issues without involvement from you, allowing for better concurrency in the database and reducing the amount of experimentation and tuning for your code.InnoDB
buffer pool and the MyISAM
key cache.Any database application eventually hits hardware limits as the database becomes more and more busy. A DBA must evaluate whether it is possible to tune the application or reconfigure the server to avoid these bottlenecks, or whether more hardware resources are required. System bottlenecks typically arise from these sources:
随着数据库变得越来越繁忙,任何数据库应用程序最终都会达到硬件极限。 DBA必须评估是否有可能调整应用程序或重新配置服务器以避免这些瓶颈,或者是否需要更多的硬件资源。系统瓶颈通常来自以下来源:
To use performance-oriented SQL extensions in a portable MySQL program, you can wrap MySQL-specific keywords in a statement within /*! */
comment delimiters. Other SQL servers ignore the commented keywords. For information about writing comments, see Section 9.6, “Comment Syntax”.
要在可移植的MySQL程序中使用面向性能的SQL扩展,可以在/ *!中的语句中包装特定于MySQL的关键字。 * /注释定界符。其他SQL Server忽略注释的关键字。有关编写注释的信息,请参见第9.6节“注释语法”。
原文:https://www.cnblogs.com/rookielet/p/12452535.html