Вопрос

I need help in figuring out what was the query_group of a query which was run on redshift. I have set a query_group in the wlm config and want to make sure the query is getting executed from that query group.

Это было полезно?

Решение

query_group is the part of WLM(workload management) configuration which enables you to manage how to run queries through queues on the Redshift cluster. To use query_group, you have to set up your own queue with query_group name(Label) through the AWS console([Amazon Redshift] -> [Parameter Groups] -> Select parameter group -> [WLM]) or cli in advance.

Here is an example which is snipped from the Redshift doc.

set query_group to 'Monday';
select * from category limit 1;
...
reset query_group

You have to set the query_group before starting the query which you want to assign to the specific queue, and reset the query_group after finishing.

You can track the queries of query_group as following. 'label' is the name of query_group.

select query, pid, substring, elapsed, label
from svl_qlog where label ='Monday'
order by query;

query | pid  |        substring                   |  elapsed  | label
------+------+------------------------------------+-----------+--------
789   | 6084 | select * from category limit 1;    | 65468     | Monday
790   | 6084 | select query, trim(label) from ... | 1260327   | Monday
791   | 6084 | select * from svl_qlog where ..    | 2293547   | Monday
792   | 6084 | select count(*) from bigsales;     | 108235617 | Monday
... 

This document is good to understand how WLM works and use it.

This link is about query_group.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top