

 从补丁 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/)。

# STL\_HASHJOIN
<a name="r_STL_HASHJOIN"></a>

分析查询的哈希联接执行步骤。

STL\_HASHJOIN 对所有用户可见。超级用户可以查看所有行；普通用户只能查看其自己的数据。有关更多信息，请参阅 [系统表和视图中的数据可见性](cm_chap_system-tables.md#c_visibility-of-data)。

**注意**  
STL\_HASHJOIN 仅包含在主预置集群上运行的查询。它不包含在并发扩展集群或无服务器命名空间上运行的查询。要访问在主集群、并发扩展集群和无服务器命名空间上运行的查询的解释计划，我们建议您使用 SYS 监控视图 [SYS\_QUERY\_DETAIL](SYS_QUERY_DETAIL.md)。SYS 监控视图中的数据经过格式化处理，便于使用和理解。

## 表列
<a name="r_STL_HASHJOIN-table-columns"></a>


| 列名称  | 数据类型  | 描述  | 
| --- | --- | --- | 
| userid | integer | 生成该条目的用户 ID。 | 
| query | integer | 查询 ID。查询列可用于连接其他系统表和视图。 | 
| slice | integer | 标识运行查询所在切片的标识符。 | 
| segment | integer | 标识查询区段的数字。 | 
| step | integer | 运行的查询步骤。 | 
| starttime | timestamp | 查询开始的时间（采用 UTC 表示）。总时间包括排队和执行时间。秒的小数部分以 6 位精度表示。例如：2009-06-12 11:29:19.131358。 | 
| endtime | timestamp | 查询完成的时间（采用 UTC 表示）。总时间包括排队和执行时间。秒的小数部分以 6 位精度表示。例如：2009-06-12 11:29:19.131358。 | 
| tasknum | 整数 | 分配用于运行步骤的查询任务进程的数量。 | 
| rows | bigint | 处理的总行数。 | 
| tbl | integer | 表 ID。 | 
| num\_parts | integer | 哈希表在一个哈希步骤期间被分为的分区的总数。 | 
| join\_type | integer | 步骤的联接类型：[See the AWS documentation website for more details](http://docs.amazonaws.cn/redshift/latest/dg/r_STL_HASHJOIN.html)  | 
| hash\_looped | character(1) | 此信息仅供内部使用。 | 
| switched\_parts | character(1) | 指示构建（或外部）和探测（内部）端是否已切换。 | 
| used\_prefetching | character(1) | 此信息仅供内部使用。 | 
| hash\_segment | integer | 相应哈希步骤的分段。 | 
| hash\_step  | integer | 相应哈希步骤的步骤数。 | 
| checksum | bigint | 此信息仅供内部使用。 | 
| 分配  | integer | 此信息仅供内部使用。 | 

## 示例查询
<a name="r_STL_HASHJOIN-sample-queries"></a>

以下示例返回在查询 720 的哈希联接中使用的分区的数量。

```
select query, slice, tbl, num_parts
from stl_hashjoin
where query=720 limit 10;
```

```
 query | slice | tbl | num_parts
-------+-------+-----+-----------
   720 |     0 | 243 |         1
   720 |     1 | 243 |         1
(2 rows)
```