

 从补丁 198 开始，Amazon Redshift 将不再支持创建新的 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/)。

# STV\$1LOCKS
<a name="r_STV_LOCKS"></a>

使用 STV\$1LOCKS 表可以查看数据库中各个表的所有当前更新。

Amazon Redshift 锁定表以防止两个用户同时更新同一个表。STV\$1LOCKS 表显示所有当前表更新，而查询 [STL\$1TR\$1CONFLICT](r_STL_TR_CONFLICT.md) 表则可查看锁定冲突的日志。使用 [SVV\$1TRANSACTIONS](r_SVV_TRANSACTIONS.md) 视图可标识未结事务和锁定争用问题。

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

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

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

## 示例查询
<a name="r_STV_LOCKS-sample-query"></a>

要查看当前事务中发生的所有锁定，请键入以下命令：

```
select table_id, last_update, lock_owner, lock_owner_pid from stv_locks;
```

此查询返回以下示例输出，其中显示三个当前生效的锁定：

```
 table_id |        last_update         | lock_owner | lock_owner_pid
----------+----------------------------+------------+----------------
100004  | 2008-12-23 10:08:48.882319 |       1043 |           5656
100003  | 2008-12-23 10:08:48.779543 |       1043 |           5656
100140  | 2008-12-23 10:08:48.021576 |       1043 |           5656
(3 rows)
```