Updated on 2024-08-23 GMT+08:00

API Overview

DAS provides extension APIs. By calling DAS APIs, you can use some DAS functions. See the following table for details.

Table 1 APIs

Type

Description

Querying API Versions

  • Query API versions.
  • Query a specified API version.

Querying a SQL Execution Plan

Query a SQL execution plan. Currently, this function is supported only for MySQL DB instances.

Killing Sessions

Kill sessions. Sessions are killed by user, database, or session ID. Currently, this function is supported only for MySQL DB instances.

Querying Metadata Locks

Query metadata locks. Currently, this function is supported only for MySQL DB instances.

Querying InnoDB Lock Waits

Query InnoDB lock waits. Currently, this function is supported only for MySQL DB instances.

Querying Database Users

Query registered database users. Currently, this function is supported only for MySQL DB instances.

Registering a Database User

Register the database username and password with the DAS system. A database user ID will be returned in the response and is required for calling other APIs, such as the API used to query instance sessions. The database password is encrypted and used for DAS API calls only. This API does not create database user objects on the database. Currently, this function is supported only for MySQL DB instances.

Querying Instance Sessions

Query instance sessions by database or user. Currently, this function is supported only for MySQL DB instances.

Querying a Specified Database User

Query information of a specified database user. Currently, this function is supported only for MySQL DB instances.

Modifying a Database User

Change the username and password for a registered database user. Currently, this function is supported only for MySQL DB instances.

Deleting a Database User

Delete a database user. The database user is deleted from the DAS system only. The real database user object is not deleted. Currently, this function is supported only for MySQL DB instances.

Obtaining the Space Analysis Data

Obtain the space analysis data. The file system generates instance-level data, and the information_schema.tables table generates database-level and table-level data. Space & Metadata Analysis allows you to analyze a maximum of 10,000 tables. If tablespace data is missing, there may be too many instance tables, or the account password has not been saved. If the account password has not been saved, use the user management interface or page to save the database account. This function is supported for MySQL and GaussDB(for MySQL) DB instances.

Creating a Space Analysis Task

Create a space analysis task, for example, triggering re-analysis. This function is supported for MySQL and GaussDB(for MySQL) DB instances.

Enabling or Disabling SQL Explorer and Slow Query Log

Enable or disable SQL Explorer. After this function is enabled, the instance performance loss rate is within 5% and DAS stores all SQL statement logs for analysis. You can set the retention period of SQL explorer data. After the retention period expires, the data is automatically deleted. If not specified, the data is retained for seven days.

Enable or disable Slow Query Log. After this function is enabled, DAS stores slow query logs for analysis. You can set the retention period of slow query logs. After the retention period expires, the data is automatically deleted. If not specified, the data is retained for seven days.

Querying Whether SQL Explorer and Slow Query Log Are Enabled

Query whether SQL Explorer and Slow Query Log are enabled.

Exporting Slow Query Logs

After Slow Query Log is enabled, you can export the slow query logs within a specified period at a time. The data can be obtained by page.

Exporting SQL Explorer Data

After SQL Explorer is enabled, you can export the SQL explorer data within a specified period at a time. The data can be obtained by page.

Querying Whether SQL Statement Concurrency Control Is Enabled

Query whether SQL Statement Concurrency Control is enabled. Currently, this function is supported only for MySQL DB instances.

Enabling or Disabling SQL Statement Concurrency Control

Enable or disable SQL Statement Concurrency Control. Currently, this function is supported only for MySQL DB instances.

Querying Concurrency Control Rules of SQL Statements

Query concurrency control rules of SQL statements. Currently, this function is supported only for MySQL DB instances.

Creating a Concurrency Control Rule

Add concurrency control rules of SQL statements. Currently, this function is supported only for MySQL DB instances.

The restrictions are as follows:

  • Take select~a as an example. select and a are two keywords contained in a concurrency control rule. The keywords are separated by a tilde (~). In this example, the rule restricts the execution of only the SQL statements containing keywords select and a.
  • If a SQL statement matches multiple concurrency control rules, only the most recently added rule is applied.
  • Keywords in a concurrency control rule are sorted in a specific order, and the system will match them from first to last. For example, if one rule contains the keyword a~and~b, the system only matches xxx a>1 and b>2.
  • Generated keywords may be case-sensitive. Execute SHOW VARIABLES LIKE 'rds_sqlfilter_case_sensitive' or go to the DAS console to check parameter settings for specifying case-sensitivity.
  • Concurrency control rules can only be added for primary instances.
  • System catalogs are not restricted, queries which do not involve data are not restricted, and the root user is not restricted in specific versions.

Deleting a Concurrency Control Rule

Delete concurrency control rules of SQL statements. Currently, this function is supported only for MySQL DB instances.

Querying Concurrency Control Tasks

Query information about an SQL concurrency control task with a specified ID.

Exporting the Top SQL Template List

Export the TopSQL template list after the TopSQL switch is turned on. This function is available only for paid instances. The maximum query interval is one hour.

Exporting SQL Execution Time Distribution

Export the SQL execution duration after the TopSQL switch is turned on. This function is available only for paid instances. The query interval is 6 hours.

Exporting the Slow SQL Template List

Export the slow SQL template after the slow SQL switch is turned on. This function is available only for paid instances. The maximum query interval is one day.