

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

# SYS\$1LOAD\$1DETAIL
<a name="SYS_LOAD_DETAIL"></a>

返回用于跟踪或排查数据加载的信息。

此视图记录了在每个数据文件加载到数据库表中时的进度。

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

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

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

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

以下示例返回上次 COPY 操作的详细信息。

```
select query_id, trim(file_name) as file, record_time
from sys_load_detail
where query_id = pg_last_copy_id();

 query_id |               file               |          record_time        
----------+----------------------------------+----------------------------
 28554    | s3://dw-tickit/category_pipe.txt | 2013-11-01 17:14:52.648486 
(1 row)
```

以下查询包含 TICKIT 数据库中初次加载表时的条目：

```
select query_id, trim(file_name), record_time
from sys_load_detail
where file_name like '%tickit%' order by query_id;

 query_id |           btrim          |          record_time          
----------+--------------------------+----------------------------
 22475    | tickit/allusers_pipe.txt | 2013-02-08 20:58:23.274186 
 22478    | tickit/venue_pipe.txt    | 2013-02-08 20:58:25.070604  
 22480    | tickit/category_pipe.txt | 2013-02-08 20:58:27.333472 
 22482    | tickit/date2008_pipe.txt | 2013-02-08 20:58:28.608305  
 22485    | tickit/allevents_pipe.txt| 2013-02-08 20:58:29.99489    
 22487    | tickit/listings_pipe.txt | 2013-02-08 20:58:37.632939 
 22593    | tickit/allusers_pipe.txt | 2013-02-08 21:04:08.400491  
 22596    | tickit/venue_pipe.txt    | 2013-02-08 21:04:10.056055  
 22598    | tickit/category_pipe.txt | 2013-02-08 21:04:11.465049  
 22600    | tickit/date2008_pipe.txt | 2013-02-08 21:04:12.461502  
 22603    | tickit/allevents_pipe.txt| 2013-02-08 21:04:14.785124  
 22605    | tickit/listings_pipe.txt | 2013-02-08 21:04:20.170594  

(12 rows)
```

向此系统视图的日志文件写入一个记录的事实并不表示加载操作已作为其所属的事务的一部分成功提交。要验证加载提交，请查询 STL\$1UTILITYTEXT 视图并查找与 COPY 事务对应的 COMMIT 记录。例如，此查询基于针对 STL\$1UTILITYTEXT 的子查询联接 SYS\$1LOAD\$1DETAIL 和 STL\$1QUERY：

```
select l.query_id,rtrim(l.file_name),q.transaction_id
from sys_load_detail l, sys_query_text q
where l.query_id=q.query_id
and exists
(select xid from stl_utilitytext where xid=q.transaction_id and rtrim("text")='COMMIT');

 query_id |           rtrim           |  transaction_id
----------+---------------------------+-----------------
 22600    | tickit/date2008_pipe.txt  | 68311
 22480    | tickit/category_pipe.txt  | 68066
  7508    | allusers_pipe.txt         | 23365
  7552    | category_pipe.txt         | 23415
  7576    | allevents_pipe.txt        | 23429
  7516    | venue_pipe.txt            | 23390
  7604    | listings_pipe.txt         | 23445
 22596    | tickit/venue_pipe.txt     | 68309
 22605    | tickit/listings_pipe.txt  | 68316
 22593    | tickit/allusers_pipe.txt  | 68305
 22485    | tickit/allevents_pipe.txt | 68071
  7561    | allevents_pipe.txt        | 23429
  7541    | category_pipe.txt         | 23415
  7558    | date2008_pipe.txt         | 23428
 22478    | tickit/venue_pipe.txt     | 68065
   526    | date2008_pipe.txt         |  2572
  7466    | allusers_pipe.txt         | 23365
 22482    | tickit/date2008_pipe.txt  | 68067
 22598    | tickit/category_pipe.txt  | 68310
 22603    | tickit/allevents_pipe.txt | 68315
 22475    | tickit/allusers_pipe.txt  | 68061
   547    | date2008_pipe.txt         |  2572
 22487    | tickit/listings_pipe.txt  | 68072
  7531    | venue_pipe.txt            | 23390
  7583    | listings_pipe.txt         | 23445
(25 rows)
```