如何在redshift中检查当前的Queue插槽并发级别

时间:2017-12-28 08:39:04

标签: amazon-redshift

我需要知道特定redshift用户的redshift Queue配置中的当前插槽计数值。 redshift中是否有任何系统表提供此用户级信息。

1 个答案:

答案 0 :(得分:0)

您可以在" WLM系统表和视图"中找到内部表的列表。 http://docs.aws.amazon.com/redshift/latest/dg/cm-c-wlm-system-tables-and-views.html

此查询总结了一些事项:

SELECT
      wlm.service_class                      queue
    , TRIM( wlm.name )                       queue_name
    , LISTAGG( TRIM( cnd.condition ), ', ' ) condition
    , wlm.num_query_tasks                    query_concurrency
    , wlm.query_working_mem                  per_query_memory_mb
    , ROUND(((wlm.num_query_tasks * wlm.query_working_mem)::NUMERIC / mem.total_mem::NUMERIC) * 100, 0)::INT  cluster_memory_pct
    , wlm.max_execution_time
    , wlm.user_group_wild_card
    , wlm.query_group_wild_card
FROM stv_wlm_service_class_config wlm
JOIN stv_wlm_classification_config cnd ON wlm.service_class = cnd.action_service_class
CROSS JOIN (SELECT SUM( num_query_tasks * query_working_mem ) total_mem
            FROM pg_catalog.stv_wlm_service_class_config
            WHERE service_class > 5) mem
WHERE wlm.service_class > 5
GROUP BY wlm.service_class, TRIM( wlm.name ), wlm.num_query_tasks, wlm.query_working_mem, mem.total_mem,
    wlm.max_execution_time, wlm.user_group_wild_card, wlm.query_group_wild_card
ORDER BY 1
;

输出

 queue |    queue_name    |    condition     | query_concurrency | per_query_memory_mb | cluster_memory_pct | max_execution_time | user_group_wild_card | query_group_wild_card
-------+------------------+------------------+-------------------+---------------------+--------------------+--------------------+----------------------+-----------------------
     6 | Service class #1 | (querytype: any) |                 5 |                1208 |                100 |                  0 | false                | false
(1 row)