• table(s) locked
      If , LOCK TABLES or FLUSH TABLES WITH READ LOCK is executed, multiplexing is disabled until UNLOCK TABLES is executed.

    • use of GET_LOCK()
      If GET_LOCK() is executed, multiplexing is disabled and is never enabled again.

    • use of specific session/user variables
      All queries that have @ in their query_digest will disable multiplexing, and it will never be enabled again.

    NOTE: If you are selecting a variable (e.g. select ) and you are not getting results as you expected, its most probably due to a query rule which is routing your statement to a different hostgroup (review your query rules for this).

    Similarly, the same happens if these commands are executed:

    • SET FOREIGN_KEY_CHECKS
    • SET AUTO_INCREMENT_INCREMENT (v 1.4.4+)
    • SET AUTO_INCREMENT_OFFSET (v 1.4.4+)
    • SELECT @

    • use of SQL_CALC_FOUND_ROWS
      If a query contains SQL_CALC_FOUND_ROWS, multiplexing is disabled and is never enabled again on the connection.

    • Temporary tables
      If CREATE TEMPORARY TABLE is executed, multiplexing is disabled and is never enabled again on the connection.

    • use of PREPARE
      If is executed (creation of prepared statements using the TEXT protocol and not the BINARY protocol), multiplexing is disabled and is never enabled again.

    Most of the session variables are not handled automatically.For example, if a client issues SET TX_ISOLATION=? , multiplexing is NOT disabled.This is a bug if you have clients that use different tx_isolation, while it is a feature if all the clients specify the same tx_isolation that is also the default (this is the common case, in my experience).

    Ad-hoc enable/disable of multiplexing

    mysql_query_rules.multiplexing allows to enable or disable multiplexing based on matching criteria.The field currently accepts these values:

    • 0 : disable multiplex
    • 1 : enable multiplex

    If your application is sending something like SELECT @@max_allowed_packet and you want to prevent multiplexing to be disabled because of this, you can create the following rule:

    … and maybe even cache it:

    If your application is trying to set a variable that will lead to disable multiplexing, and you think that it can be filtered, you can create a filter that returns OK without executing the query: