Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

SET SESSION TRANSACTION READ ONLY;

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.

Does the InnoDB engine run such optimizations for read-only transactions?

like image 573
Vlad Mihalcea Avatar asked Jan 21 '26 16:01

Vlad Mihalcea


1 Answers

This syntax was important for MySQL 5.6, where creating a READ ONLY transaction saved InnoDB from setting up a number of structures internally.

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.

like image 153
Morgan Tocker Avatar answered Jan 24 '26 07:01

Morgan Tocker



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!