

 从补丁 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\_COMMIT\_STATS
<a name="r_STL_COMMIT_STATS"></a>

提供与提交性能相关的指标，包括提交的各个阶段的时间和提交的数据块的数量。查询 STL\_COMMIT\_STATS 以确定提交时使用的是事务的哪个部分以及出现了多少队列。

STL\_COMMIT\_STATS 仅对超级用户可见。有关更多信息，请参阅 [系统表和视图中的数据可见性](cm_chap_system-tables.md#c_visibility-of-data)。

此表中的部分或全部数据也可以在 SYS 监控视图 [SYS\_TRANSACTION\_HISTORY](SYS_TRANSACTION_HISTORY.md) 中找到。SYS 监控视图中的数据经过格式化处理，便于使用和理解。我们建议您使用 SYS 监控视图进行查询。

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


| 列名称  | 数据类型  | 描述  | 
| --- | --- | --- | 
| xid  | bigint | 所提交的事务 ID。 | 
| node  | integer  | 节点编号。-1 是领导节点。 | 
| startqueue  | timestamp | 提交的队列的开始时间。 | 
| startwork  | timestamp | 提交的开始时间。 | 
| endflush  | timestamp | 脏数据块刷新阶段的结束时间。 | 
| endstage | timestamp | 元数据暂存阶段的结束时间。 | 
| endlocal | timestamp | 本地提交阶段的结束时间。 | 
| startglobal  | timestamp | 全局阶段的开始时间。 | 
| endtime  | timestamp | 提交的结束时间。 | 
| queuelen  | bigint | 提交队列中位于此事务之前的事务数。 | 
| permblocks  | bigint | 此次提交时现有永久性数据块的数量。 | 
| newblocks  | bigint | 此次提交时新的永久性数据块的数量。 | 
| dirtyblocks  | bigint  | 必须作为此提交的一部分写入的数据块的数量。 | 
| headers | bigint | 必须作为此提交的一部分写入的数据块标头的数量。 | 
| numxids | integer | 活动 DML 事务的数量。 | 
| oldestxid | bigint | 最旧的活动 DML 事务的 XID。 | 
| extwritelatency | bigint | 此信息仅供内部使用。 | 
| metadatawritten | int | 此信息仅供内部使用。 | 
| tombstonedblocks | bigint | 此信息仅供内部使用。 | 
| tossedblocks | bigint | 此信息仅供内部使用。 | 
| batched\_by | bigint | 此信息仅供内部使用。 | 

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

```
select node, datediff(ms,startqueue,startwork) as queue_time, 
datediff(ms, startwork, endtime) as commit_time, queuelen
from stl_commit_stats
where xid = 2574
order by node;

node | queue_time   | commit_time | queuelen
-----+--------------+-------------+---------
  -1 |            0 |         617 |        0
   0 | 444950725641 |         616 |        0
   1 | 444950725636 |         616 |        0
```