All Products
Search
Document Center

AnalyticDB for MySQL:Specify a resource group to execute queries

Last Updated:Mar 11, 2024

AnalyticDB for MySQL Data Lakehouse Edition (V3.0) allows you to specify a resource group to execute queries. If you do not specify a resource group to execute queries, the user_default resource group is used. The method that is used to specify a resource group varies based on whether you submit SQL queries or Spark applications. For example, if you use Java Database Connectivity (JDBC) to submit a XIHE SQL query, you can specify a resource group by adding a hint to SQL statements or associating the resource group with a database account. If you use the Job Development page in the AnalyticDB for MySQL console to submit a Spark SQL query or a Spark application, you can select a resource group on the Job Development page. This topic describes how to specify a resource group when you submit XIHE SQL queries, Spark SQL queries, or Spark applications.

Use JDBC to submit SQL queries

You can use one of the following methods to specify a resource group to execute queries:

  • Add a hint to SQL statements. Syntax: /*+resource_group=resourceGroupName*/.

  • Associate a resource group with a database account. For more information, see Associate with or disassociate from a database account.

  • If you do not specify a resource group, the user_default resource group is used.

If you specify multiple resource groups by using the preceding methods, the resource groups take effect in the following order based on priority: hint-based resource group, associated resource group, and default resource group.

Use the Job Development page to submit Spark SQL queries or Spark applications

You can select a resource group on the Job Development page in the AnalyticDB for MySQL console. In this case, you cannot specify a resource group by adding a hint to SQL statements or associating the resource group with a database account.

Use API operations to submit Spark applications

You can call the SumbitSparkApp operation and use the ResourceGroupName parameter to specify a resource group. For more information, see SubmitSparkApp.

Use other methods to submit Spark applications