

 从补丁 198 开始，Amazon Redshift 将不再支持创建新的 Python UDF。现有的 Python UDF 将继续正常运行至 2026 年 6 月 30 日。有关更多信息，请参阅[博客文章](https://www.amazonaws.cn/blogs/big-data/amazon-redshift-python-user-defined-functions-will-reach-end-of-support-after-june-30-2026/)。

# WLM 系统表和视图
WLM 系统表和视图

WLM 根据内部定义的 WLM 服务类配置查询队列。Amazon Redshift 根据这些服务类以及在 WLM 配置中定义的队列创建多个内部队列。在系统表中，术语*队列* 和*服务类* 通常可互换使用。超级用户队列使用服务类 5。用户定义的队列使用服务类 6 及更高的服务类。

您可以使用特定于 WLM 的系统表查看查询、队列和服务类的状态。查询以下系统表并注意以下事项：
+ 查看正在跟踪哪些查询，工作负载管理器分配哪些资源。
+ 查看查询被分配到哪个队列。
+ 查看工作负载管理器当前跟踪的查询的状态。

[\[See the AWS documentation website for more details\]](http://docs.amazonaws.cn/redshift/latest/dg/cm-c-wlm-system-tables-and-views.html)

 您使用任务 ID 来跟踪系统表中的查询。下面的示例介绍如何获取最近提交的用户查询的任务 ID：

```
select task from stl_wlm_query where exec_start_time =(select max(exec_start_time) from stl_wlm_query); 

task 
------ 
137 
(1 row)
```

 下面的示例介绍当前正在各个服务类（队列）中执行或等待的查询。该查询在跟踪 Amazon Redshift 的整体并发工作负载时很有用：

```
select * from stv_wlm_query_state order by query;


xid |task|query|service_| wlm_start_  |  state  |queue_ | exec_
    |    |     |class   | time        |         |time   | time
----+----+-----+--------+-------------+---------+-------+--------
2645| 84 | 98  | 3      | 2010-10-... |Returning|   0   | 3438369
2650| 85 | 100 | 3      | 2010-10-... |Waiting  |   0   | 1645879
2660| 87 | 101 | 2      | 2010-10-... |Executing|   0   | 916046
2661| 88 | 102 | 1      | 2010-10-... |Executing|   0   | 13291
(4 rows)
```

## WLM 服务类 ID
WLM 服务类 ID

下表列出了分配到服务类的 ID 的列表。

[\[See the AWS documentation website for more details\]](http://docs.amazonaws.cn/redshift/latest/dg/cm-c-wlm-system-tables-and-views.html)