tencent cloud

TDSQL-C for MySQL

Accessing a Read-Only Analysis Engine

Download
Focus Mode
Font Size
Last updated: 2026-05-29 15:21:12
AI-Translated
When the read-only analysis engine feature is enabled, you can access read-only analysis engines from any MySQL database client/JDBC/ODBC. This document describes several common access methods.

Accessing via the Address of a Read-Only Analysis Engine

You can connect to a cluster in any of the following ways and access a read-only analysis engine via its address.
Connection Method
Description
Connecting to a cluster via DMC is easy. DMC provides database management services that integrate database/table-level operations, real-time monitoring, instance session management, SQL window, and data management.
Note:
Only the new version of DMC supports accessing read-only analysis engines. For the login address of the new version of DMC, go to the login page.
Developers using Linux CVM instances can use this connection method.
Developers using Windows CVM instances can use this connection method.

Accessing the Database via the CCN Address

For detailed operations on accessing the database via the CCN address, see Connecting Through CCN.

Accessing Through SQL Forwarding by the Database Proxy

You can use any MySQL database client to access a read-only analysis engine added to the database proxy.
You can see Enabling Database Proxy to enable the database proxy. Currently, only database proxy of version 1.3.15 and the latest version support adding read-only analysis engines. If your database proxy kernel version is earlier than 1.3.15, you cannot add read-only analysis engines to the database proxy. In this case, you can see Upgrading Kernel Minor Version of Database Proxy to upgrade the database proxy version to 1.3.15 or the latest version.
Database proxy of a version earlier than 1.4.4 only supports forwarding SQL statements to a read-only analysis engine in the database proxy for execution by using the /* to server instance ID */ syntax in Hint Syntax Usage.
Database proxy of the version 1.4.4 and later supports forwarding SQL statements to a read-only analysis engine in the database proxy for execution by using the /*to ap*/ Hint syntax. If there are multiple read-only analysis engine instances, load balancing will be performed for SQL statements according to the weight of read-only analysis engines.
Starting from version 1.4.5, the database proxy supports the unified weight management feature, which treats the read-only analysis engine and the standard read-only instances equally. SQL queries can be assigned to the analysis engine for execution based on the weight.
Note:
If the instance ID specified by the /*to server instance ID*/ syntax does not exist or the read-only analysis engine does not exist, the SQL statement will be forwarded to an existing read-only instance or read-write instance in the current database proxy for execution by default.
For database proxy of version 1.4.4, if the instance ID specified by the /*to ap*/ syntax does not exist or the read-only analysis engine does not exist, the SQL statement will be forwarded to an existing read-only instance or read-write instance in the current database proxy for execution by default.
For database proxy of version 1.4.5 and later, if the instance ID specified by the /*to ap*/ syntax does not exist or the read-only analysis engine does not exist, you need to use the "Analysis Engine Fault Forwarding" configuration item of the database proxy. After this configuration is enabled, when the read-only analysis engine fails, SQL statements that should have been forwarded to the read-only analysis engine will be forwarded to a read-only instance or a read-write instance for execution. Otherwise, the SQL statements will not be forwarded to other instances and an error will be reported.
If you use a MySQL client to access the database proxy, add the "-c" parameter to the connection parameters. Otherwise, the hint syntax added to SQL statements will not take effect.
# mysql -h172.16.0.12 -P3306 -utest -p -c -A

mysql> /* to server libradb-ins-hw0af2zi */ show databases;
+---------------------+
| Database |
+---------------------+
| INFORMATION_SCHEMA |
| Test1 |
| Test2 |
| __cdb_recycle_bin__ |
| haha |
| libra_system |
| test |
+---------------------+
7 rows in set (0.01 sec)
The /*to ap*/ syntax is supported in version 1.4.4 and later.
mysql> select /* to ap */ * from haha.t;
+----+------+
| id | haha |
+----+------+
| 1 | 1 |
| 2 | 2 |
+----+------+
2 rows in set (0.01 sec)
The hint can be added to the middle of SQL statements.
mysql> select /* to server libradb-ins-hw0af2zi */ * from haha.t;
+----+------+
| id | haha |
+----+------+
| 1 | 1 |
| 2 | 2 |
+----+------+
2 rows in set (0.01 sec)
The hint for specifying the route and the syntax of SQL execution plans can be added at the same time.
mysql> select /* to server libradb-ins-hw0af2zi */ /*+ set_var(libra_enable_late_materialization=1) */ * from haha.t;
+----+------+
| id | haha |
+----+------+
| 1 | 1 |
| 2 | 2 |
+----+------+
2 rows in set (0.01 sec)

Help and Support

Was this page helpful?

Help us improve! Rate your documentation experience in 5 mins.

Feedback