STL_S3CLIENT - Amazon Redshift
Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅 中国的 Amazon Web Services 服务入门 (PDF)

STL_S3CLIENT

记录传输时间和其他性能指标。

使用 STL_S3CLIENT 表可查找传输 Amazon S3 中的数据所花费的时间。

STL_S3CLIENT 对所有用户可见。超级用户可以查看所有行;普通用户只能查看其自己的数据。有关更多信息,请参阅系统表和视图中的数据可见性

表列

列名称 数据类型 描述
userid integer 生成该条目的用户 ID。
query integer 查询 ID。查询列可用于连接其他系统表和视图。
slice integer 标识运行查询所在切片的标识符。
recordtime timestamp 记录的记录时间。
pid integer 进程 ID。会话中的所有查询在同一进程中运行,因此,如果您在同一会话中运行一系列查询,则此值保持不变。
http_method character(64) 与 Amazon S3 请求对应的 HTTP 方法名称。
character(64) S3 桶名称。
key character(256) 与 Amazon S3 对象对应的键。
transfer_size bigint 传输的字节数。
data_size bigint 数据的字节数。此值与未压缩的数据的 transfer_size 相同。如果使用了压缩,则这是未压缩的数据的大小。
start_time bigint 传输开始时的时间(自 2000 年 1 月 1 日起以微秒为单位)。
end_time bigint 传输结束时的时间(自 2000 年 1 月 1 日起以微秒为单位)。
transfer_time bigint 传输花费的时间(单位为微秒)。
compression_time bigint 用来解压缩数据花费的传输时间的一部分(单位为微秒)。
connect_time bigint 从开始直至连接到远程服务器完成的时间(单位为微秒)。
app_connect_time bigint 从开始直至与远程主机的 SSL 连接/握手完成的时间(单位为微秒)。
retries bigint 重试传输的次数。
request_id char(32) Amazon S3 HTTP 响应标头中的请求 ID
extended_request_id char(128) Amazon S3 HTTP 标头响应中的扩展请求 ID(x-amz-id-2)。
ip_address char(64) 服务器的 IP 地址(ip V4 或 V6)。
is_partial integer 值,如果为真 (1) 表示在 COPY 操作期间输入文件被拆分为范围。如果此值为假 (0),则不会拆分输入文件。
start_offset bigint 值,如果在 COPY 操作期间拆分输入文件,则表示拆分的偏移值(以字节为单位)。如果文件未拆分,则此值为 0。

示例查询

以下查询返回使用 COPY 命令加载文件花费的时间。

select slice, key, transfer_time from stl_s3client where query = pg_last_copy_id();

结果

slice | key | transfer_time ------+-----------------------------+--------------- 0 | listing10M0003_part_00 | 16626716 1 | listing10M0001_part_00 | 12894494 2 | listing10M0002_part_00 | 14320978 3 | listing10M0000_part_00 | 11293439 3371 | prefix=listing10M;marker= | 99395

以下示例将 start_timeend_time 转换为时间戳。

select userid,query,slice,pid,recordtime,start_time,end_time, '2000-01-01'::timestamp + (start_time/1000000.0)* interval '1 second' as start_ts, '2000-01-01'::timestamp + (end_time/1000000.0)* interval '1 second' as end_ts from stl_s3client where query> -1 limit 5;
userid | query | slice | pid | recordtime | start_time | end_time | start_ts | end_ts --------+-------+-------+-------+----------------------------+-----------------+-----------------+----------------------------+---------------------------- 0 | 0 | 0 | 23449 | 2019-07-14 16:27:17.207839 | 616436837154256 | 616436837207838 | 2019-07-14 16:27:17.154256 | 2019-07-14 16:27:17.207838 0 | 0 | 0 | 23449 | 2019-07-14 16:27:17.252521 | 616436837208208 | 616436837252520 | 2019-07-14 16:27:17.208208 | 2019-07-14 16:27:17.25252 0 | 0 | 0 | 23449 | 2019-07-14 16:27:17.284376 | 616436837208460 | 616436837284374 | 2019-07-14 16:27:17.20846 | 2019-07-14 16:27:17.284374 0 | 0 | 0 | 23449 | 2019-07-14 16:27:17.285307 | 616436837208980 | 616436837285306 | 2019-07-14 16:27:17.20898 | 2019-07-14 16:27:17.285306 0 | 0 | 0 | 23449 | 2019-07-14 16:27:17.353853 | 616436837302216 | 616436837353851 | 2019-07-14 16:27:17.302216 | 2019-07-14 16:27:17.353851