Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).


CHANGE_QUERY_PRIORITY enables superusers to modify the priority of a query that is either running or waiting in workload management (WLM).

This function enables superusers to immediately change the priority of any query in the system. Only one query, user, or session can run with the priority CRITICAL.


CHANGE_QUERY_PRIORITY(query_id, priority)



The query identifier of the query whose priority is changed. Requires an INTEGER value.


The new priority to be assigned to the query. This argument must be a string with the value CRITICAL, HIGHEST, HIGH, NORMAL, LOW, or LOWEST.

Return Type



To show the column query_priority in the STV_WLM_QUERY_STATE system table, use the following example.

SELECT query, service_class, query_priority, state FROM stv_wlm_query_state WHERE service_class = 101; +-------+---------------+----------------+---------+ | query | service_class | query_priority | state | +-------+---------------+----------------+---------+ | 1076 | 101 | Lowest | Running | | 1075 | 101 | Lowest | Running | +-------+---------------+----------------+---------+

To show the results of a superuser running the function change_query_priority to change the priority to CRITICAL, use the following example.

SELECT CHANGE_QUERY_PRIORITY(1076, 'Critical'); +-------------------------------------------------------------------------------+ | change_query_priority | +-------------------------------------------------------------------------------+ | Succeeded to change query priority. Priority changed from Lowest to Critical. | +-------------------------------------------------------------------------------+