content_image/810251.jpg
•Use of ANALYZE TABLE  or OPTIMIZE TABLE  statements. The purpose of read-only mode is to prevent changes to table structure or contents. Analysis and optimization do not qualify as such changes. This means, for example, that consistency checks on read-only replicas can be performed with mysqlcheck --all-databases --analyze . 

•Operations on TEMPORARY  tables. 

•Inserts into the log tables ( mysql.general_log  and mysql.slow_log ); see Section 5.4.1, “Selecting General Query Log and Slow Query Log Output Destinations” . 

•Updates to Performance Schema tables, such as UPDATE  or TRUNCATE TABLE  operations. 

Changes to read_only  on a replication source server are not replicated to replica servers. The value can be set on a replica server independent of the setting on the source. 

The following conditions apply to attempts to enable read_only  (including implicit attempts resulting from enabling super_read_only ): 

•The attempt fails and an error occurs if you have any explicit locks (acquired with LOCK TABLES ) or have a pending transaction. 

•The attempt blocks while other clients have any ongoing statement, active LOCK TABLES WRITE , or ongoing commit, until the locks are released and the statements and transactions end. While the attempt to enable read_only  is pending, requests by other clients for table locks or to begin transactions also block until read_only  has been set. 

•The attempt blocks if there are active transactions that hold metadata locks, until those transactions end. 

• read_only  can be enabled while you hold a global read lock (acquired with FLUSH TABLES WITH READ LOCK ) because that does not involve table locks. 

• read_rnd_buffer_size 

<img src='content_image/810251.jpg'>

This variable is used for reads from MyISAM  tables, and, for any storage engine, for Multi-Range Read optimization. 

When reading rows from a MyISAM  table in sorted order following a key-sorting operation, the rows are read through this buffer to avoid disk seeks. See Section 8.2.1.16, “ORDER BY Optimization” . Setting the variable to a large value can improve ORDER BY  performance by a lot. However, this is a buffer allocated for each client, so you should not set the global variable to a large value. Instead, change the session variable only from within those clients that need to run large queries. 

