MySQL InnoDB引擎是否对只读事务运行任何性能优化 [英] Does MySQL InnoDB engine run any performance optimization for read-only transactions
问题描述
根据参考文档,只读"事务标志可能会暗示存储引擎正在运行某些优化.
According to the reference documentation the READ ONLY transaction flag may hint the storage engines for running some optimizations.
仅设置会话事务;
如果事务访问模式设置为只读",则更改为表 被禁止.这可以使存储引擎发挥性能 不允许写时可能会进行的改进.
If the transaction access mode is set to READ ONLY, changes to tables are prohibited. This may enable storage engines to make performance improvements that are possible when writes are not permitted.
InnoDB引擎是否对只读事务运行这样的优化?
Does the InnoDB engine run such optimizations for read-only transactions?
推荐答案
此语法对MySQL 5.6非常重要,在MySQL 5.6中,创建READ ONLY
事务可避免InnoDB从内部设置许多结构.
This syntax was important for MySQL 5.6, where creating a READ ONLY
transaction saved InnoDB from setting up a number of structures internally.
在MySQL 5.7中,优化得到了扩展,以便所有事务将从READ ONLY
开始,然后根据需要转换为READ_WRITE
. 此博客文章中对此进行了进一步描述.
In MySQL 5.7, the optimization was extended so that all transactions would start out READ ONLY
and then convert to READ_WRITE
as required. This is described further in this blog post.
这篇关于MySQL InnoDB引擎是否对只读事务运行任何性能优化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!