Customized Hints for Read/Write Splitting
DDM allows you to customize a hint to specify whether SQL statements are executed on the primary instance or its read replicas.
The following hint formats are supported:
- /*!mycat:db_type=host*/
- /*+ db_type=host */
host can be master or slave. master indicates a primary instance, and slave indicates a read replica.
After read/write splitting is enabled, write operations are performed only on the primary DB instance, and read operations are performed only on its read replicas. To read from the primary instance, you can customize a hint to forcibly perform read operations on the primary instance. This method is only suitable for queries.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.