|
Read-write splitting
The plugin executes read-only statements on the configured MySQL slaves, and
all other queries on the MySQL master. Statements are
considered read-only if they either start with SELECT,
the SQL hint /*ms=slave*/, or if a slave had been chosen for
running the previous query and the query starts with the SQL hint
/*ms=last_used*/. In all other cases, the query will
be sent to the MySQL replication master server. It is recommended to
use the constants SQL hints are a special kind of standard compliant SQL comments. The plugin does check every statement for certain SQL hints. The SQL hints are described within the mysqlnd_ms constants documentation, constants that are exported by the extension. Other systems involved with the statement processing, such as the MySQL server, SQL firewalls, and SQL proxies, are unaffected by the SQL hints, because those systems are designed to ignore SQL comments. The built-in read-write splitter can be replaced by a user-defined filter, see also the user filter documentation. A user-defined read-write splitter can request the built-in logic to send a statement to a specific location, by invoking mysqlnd_ms_is_select.
|