Description
You can use this statement to query information about prepared statement (PS) caches when the PS protocol is used.
Limitations
If you log in as a normal user, you can query only information about the PS caches of the current user. For example, if you specify
cs_idin a query, the query is executed only when the client session specified bycs_idbelongs to the current user.If you log in to the
systenant or as theroot@proxysysuser, you can query information about the PS caches of any user.
Syntax
SHOW PROXYPS [cs_id] [like "sql"] [tenant like "tenant_name"] [DETAIL];
Parameters
| Parameter | Description |
|---|---|
| SHOW PROXYPS | Shows information about PS caches. If you execute the SHOW PROXYPS; statement in the sys tenant or as the root@proxysys user, it returns the information about all PS caches. If you execute the SHOW PROXYPS; statement as a normal user, it returns only the information about the PS caches used by the current user. |
| cs_id | Optional. The client session ID used to query information about PS caches. It is allocated by OceanBase Database Proxy (ODP). You can query it by using the SHOW PROCESSLIST; or SHOW PROXYSESSION; statement, and the value of the Id column in the output is the client session ID. |
| like "sql" | Optional. The SQL statement used to query information about PS caches. You can specify _ for fuzzy search of a single character or % for fuzzy search of multiple characters. |
| tenant like "tenant_name" | Optional. The tenant name used to query information about PS caches. You can specify _ for fuzzy search of a single character or % for fuzzy search of multiple characters. |
| DETAIL | Optional. Specifies whether to show the SQL text and parsing results of prepared statements. |
Examples
Query with
cd_idand the SQL statement specifiedSHOW PROXYPS 1 like '%select%';In this example,
cs_idis1. You can query its actual value by using theSHOW PROCESSLIST;orSHOW PROXYSESSION;statement, and the value of theIdcolumn in the output iscs_id.The output of the
SHOW PROXYPSstatement is as follows:+-------+--------------+-------------+-------+---------+-------------+--------------+-----------+--------------+ | cs_id | cluster_name | tanant_name | ps_id | ps_name | prepare_sql | parse_result | used_mem | used_session | +-------+--------------+-------------+-------+---------+-------------+--------------+-----------+--------------+ | 1 | obcluster | mysql | -1 | PS1 | NULL | NULL | 10533 | 1 | +-------+--------------+-------------+-------+---------+-------------+--------------+-----------+--------------+Query with the SQL statement and tenant name specified
SHOW PROXYPS like '%select%' tenant like '%mysql%';The output is as follows:
+-------+--------------+-------------+-------+---------+-------------+--------------+-----------+--------------+ | cs_id | cluster_name | tanant_name | ps_id | ps_name | prepare_sql | parse_result | used_mem | used_session | +-------+--------------+-------------+-------+---------+-------------+--------------+-----------+--------------+ | 1 | obcluster | mysql | -1 | PS1 | NULL | NULL | 10533 | 1 | +-------+--------------+-------------+-------+---------+-------------+--------------+-----------+--------------+
Columns
| Column | Description |
|---|---|
| cs_id | The client session ID corresponding to the PS cache. This column has a valid value only when cs_id or a tenant name is specified in the SHOW PROXYPS statement. Otherwise, the value of this column is -1. |
| cluster_name | The cluster name corresponding to the PS cache. This column has a valid value only when cs_id or a tenant name is specified in the SHOW PROXYPS statement. Otherwise, the value of this column is empty. |
| tenant_name | The tenant name corresponding to the PS cache. This column has a valid value only when cs_id or a tenant name is specified in the SHOW PROXYPS statement. Otherwise, the value of this column is empty. |
| ps_id | The PS ID of the PS cache. This column has a valid value only when cs_id or a tenant name is specified in the SHOW PROXYPS statement and the prepared statement conforms to the binary protocol. |
| ps_name | The PS name of the PS cache. This column has a valid value only when cs_id or a tenant name is specified in the SHOW PROXYPS statement and the prepared statement conforms to the text protocol. |
| prepare_sql | The prepared SQL statement in the PS cache. This column has a valid value only when DETAIL is specified in the SHOW PROXYPS statement. |
| parse_result | The parsing results of the prepared SQL statement in the PS cache. This column has a valid value only when DETAIL is specified in the SHOW PROXYPS statement. |
| used_mem | The size of memory used by the PS cache. |
| used_session | The number of sessions that concurrently use the PS cache. |