Help Center/ TaurusDB/ User Guide/ Database Proxy (Read/Write Splitting)/ Using Hints for Read/Write Splitting
Updated on 2025-07-11 GMT+08:00

Using Hints for Read/Write Splitting

In addition to configuring weights of nodes for read/write splitting, you can use hints in SQL statements to route read and write requests to a primary node or read replica.

Specifying Whether a SQL Statement Is Sent to a Primary Node or Read Replica By Adding a Hint

Hints supported by read/write splitting are as follows:

/*FORCE_MASTER*/: A SQL statement is executed on a primary node.

/*FORCE_SLAVE*/: A SQL statement is executed on read replicas.

  • Hints are only used as routing suggestions. In non-read-only SQL and non-transaction scenarios, SQL statements cannot be routed to read replicas.
  • If you want to connect to an instance using the MySQL CLI and Hints, add the -c option.