Skip to content

MySQL – Disabling Binary Logging for INSERT and UPDATE

I have run into many situations where there would be a benefit to not replicate a large INSERT or UPDATE from the MASTER to SLAVE in order to not block replication for a long period of time. Luckily MySQL provides a means to disable binary logging for your current session. Simply execute SET SQL_BIN_LOG=0 before the SQL Statement that you do not want logged to the BINLOG. This is a session variable, meaning it will be re-enabled when you close the session, or you can set it back to 1.

In order to keep the Slave in-sync, you will need to execute the same query on the Slave. You can also use mk-table-sync from the Maatkit toolkit to re-sync your table data at a later time.

One Trackback/Pingback

  1. Top My.CNF Optimizations for Innodb | Prodromus on Friday, August 20, 2010 at 12:07 pm

    [...] MySQL – Disabling Binary Logging for INSERT and UPDATE (prodromus.com) Share and Enjoy: [...]

Post a Comment

Your email is never published nor shared. Required fields are marked *
*
*

CommentLuv badge