docs
udbproxy
How Tos
SQL Routing

SQL Routing

Under normal circumstances, the read/write separation feature provided by a database proxy effectively utilizes replica databases, thereby improving the throughput of the entire database system. However, in certain situations, we may also want to route SQL queries to specific databases to meet our business requirements. Here are some scenarios where SQL routing can be useful:

  1. Query statements need to avoid master-replica replication delay, so they are routed to the master database to ensure data real-time consistency.
  2. Data statistics and complex computation queries are routed to replica databases with lower load weights to separate them from real-time business databases.

Access SQL Routing

Click on 'Details' for the proxy to enter the details page. image On the far right of the Database Proxy details page, you will find the SQL Routing feature. Click on the 'Edit' button to access the SQL Routing configuration page. image On the SQL Routing page, at the top left corner, there is a 'Create Route' button. Clicking on it will open a dialog to create an SQL route. image

Create SQL Routing Rule

On the SQL Routing settings page, you can set rate limiting for SQL statements of the SELECT type. image

We can input the corresponding SQL statements based on the actual business scenario. The system will automatically replace variables ('hello world') with placeholders to accommodate incoming parameters. image

Based on the actual business requirements, we can choose to route this SQL statement to the master database, replica database, or custom databases. In the 'Custom' option, you can select multiple databases. image

Click 'Confirm,' and you will see that the rule has been added to the list. image

Modify Routing Type

After creating the SQL routing rule, you can modify the routing type by clicking on the 'Modify Routing Type' button on the right. image

Clicking on it will open a pop-up box where you can modify the routing type. image

Delete Routing Rule

You can delete SQL routing rules. Click the 'Delete' button on the right, and then confirm to delete the rule. image

  • Company
  • ContactUs
  • Blog
Copyright © 2024 SurferCloud All Rights Reserved
  • Contact our sales to help your business.
  • Contact our sales to help your business.