

 Amazon Redshift は、パッチ 198 以降、新しい Python UDF の作成をサポートしなくなります。既存の Python UDF は、2026 年 6 月 30 日まで引き続き機能します。詳細については、[ブログ記事](https://aws.amazon.com/blogs/big-data/amazon-redshift-python-user-defined-functions-will-reach-end-of-support-after-june-30-2026/)を参照してください。

# STL\$1WLM\$1QUERY
<a name="r_STL_WLM_QUERY"></a>

WLM が扱うサービスクラス内で実行が試みられたクエリごとに、レコードが 1 件作成されます。

STL\$1WLM\$1QUERY はすべてのユーザーに表示されます。スーパーユーザーはすべての行を表示できますが、通常のユーザーは自分のデータのみを表示できます。詳細については、「[システムテーブルとビューのデータの可視性](cm_chap_system-tables.md#c_visibility-of-data)」を参照してください。

このテーブルの一部またはすべてのデータは、SYS モニタリングビュー [SYS\$1QUERY\$1HISTORY](SYS_QUERY_HISTORY.md) でも確認できます。SYS モニタリングビューのデータは、使いやすく理解しやすいようにフォーマットされます。クエリには、SYS モニタリングビューを使用することをお勧めします。

## テーブルの列
<a name="r_STL_WLM_QUERY-table-columns"></a>

[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ja_jp/redshift/latest/dg/r_STL_WLM_QUERY.html)

## サンプルクエリ
<a name="r_STL_WLM_QUERY-sample-queries"></a>

 **クエリのキューと実行にかかったクエリの平均時間の表示** 

次のクエリでは、4 を超えるサービスクラスの現在の設定を表示します。サービスクラス ID のリストについては、「[WLM サービスクラス ID](cm-c-wlm-system-tables-and-views.md#wlm-service-class-ids)」を参照してください。

次のクエリは、各クエリがクエリキュー内に置かれていた時間および実行にかかった時間の平均を、サービスクラス別にマイクロ秒単位で返します。

```
select service_class as svc_class, count(*),
avg(datediff(microseconds, queue_start_time, queue_end_time)) as avg_queue_time,
avg(datediff(microseconds, exec_start_time, exec_end_time )) as avg_exec_time
from stl_wlm_query
where service_class > 4
group by service_class
order by service_class;
```

このクエリは、次のサンプル出力を返します。

```
 svc_class | count | avg_queue_time | avg_exec_time
-----------+-------+----------------+---------------
         5 | 20103 |              0 |         80415
         5 |  3421 |          34015 |        234015
         6 |    42 |              0 |        944266
         7 |   196 |           6439 |       1364399
(4 rows)
```

 **クエリのキューと実行にかかったクエリの最大時間の表示** 

次のクエリは、クエリがいずれかのクエリキュー内に置かれていた時間と実行にかかった時間の最大値を、サービスクラスごとにマイクロ秒単位で返します。

```
select service_class as svc_class, count(*),
max(datediff(microseconds, queue_start_time, queue_end_time)) as max_queue_time,
max(datediff(microseconds, exec_start_time, exec_end_time )) as max_exec_time
from stl_wlm_query
where svc_class > 5  
group by service_class
order by service_class;
```

```
 svc_class | count | max_queue_time | max_exec_time
-----------+-------+----------------+---------------
         6 |    42 |              0 |       3775896
         7 |   197 |          37947 |      16379473
(4 rows)
```