tencent cloud

TencentDB for MySQL

Accessing a Read-Only Analysis Engine

PDF
Focus Mode
Font Size
Last updated: 2025-11-28 18:24:47
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 instances 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.
Cloud Virtual Machine (CVM) can be used to connect to databases via the private network address of TencentDB for MySQL.
CVM or third-party applications can be used to connect to databases via the public network address of TencentDB for MySQL.

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 or read-only analysis engine specified in the /*to server instance ID*/ syntax and the /*to ap*/ syntax does not exist, SQL statements will be forwarded to an existing read-only instance or the read-write instance in the database proxy by default for execution.
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.xx.xx.12 -P3306 -utest -p -c -A

mysql> /* to server cdbaro-rmoskdfp */ show databases;
+---------------------+
| Database |
+---------------------+
| INFORMATION_SCHEMA |
| Test1 |
| Test2 |
| __cdb_recycle_bin__ |
| haha |
| libra_system |
| test |
+---------------------+
7 rows in set (0.01 sec)
Database proxy of version 1.4.4 or later supports using the /*to ap*/ syntax.
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 cdbaro-rmoskdfp */ * 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 cdbaro-rmoskdfp */ /*+ 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