Menu
Amazon Redshift
Database Developer Guide (API Version 2012-12-01)

query_group

Values (Default in Bold)

No default; the value can be any character string.

Description

This parameter applies a user-defined label to a group of queries that are run during the same session. This label is captured in the query logs and can be used to constrain results from the STL_QUERY and STV_INFLIGHT tables and the SVL_QLOG view. For example, you can apply a separate label to every query that you run to uniquely identify queries without having to look up their IDs.

This parameter does not exist in the server configuration file and must be set at runtime with a SET command. Although you can use a long character string as a label, the label is truncated to 30 characters in the LABEL column of the STL_QUERY table and the SVL_QLOG view (and to 15 characters in STV_INFLIGHT).

In the following example, query_group is set to Monday, then several queries are executed with that label:

Copy
set query_group to 'Monday'; SET select * from category limit 1; ... ... 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 ...