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

STL_ANALYZE

记录 ANALYZE 操作的详细信息。

STL_ANALYZE 只对超级用户可见。有关更多信息,请参阅系统表和视图中的数据可见性

此表中的部分或全部数据也可以在 SYS 监控视图 SYS_ANALYZE_HISTORY 中找到。SYS 监控视图中的数据经过格式化处理,便于使用和理解。我们建议您使用 SYS 监控视图进行查询。

表列

列名称 数据类型 描述
userid integer 生成该条目的用户的 ID。
xid long 事务 ID。
数据库 char(30) 数据库名称。
table_id integer 表 ID。
status char(15) 分析命令的结果。可能的值为 FullSkippedPredicateColumn
rows double 表中的总行数。
modified_rows double 自上次执行 ANALYZE 操作以来修改的行的总数。
threshold_percent integer analyze_threshold_percent参数的值。
is_auto char(1) 如果操作预设情况下包含 Amazon Redshift 分析,则值为 true (t)。如果明确运行了 ANALYZE 命令,则值为 false (f)。
starttime timestamp 分析操作开始运行的时间(采用 UTC 表示)。
endtime timestamp 分析操作完成运行的时间(采用 UTC 表示)。
prevtime timestamp 上次分析表的时间(采用 UTC 表示)。
num_predicate_cols integer 表中现有的谓词列的数量。
num_new_predicate_cols integer 自上次分析操作以来表中新谓词列的数量。
is_background character(1) 如果分析由自动分析操作运行,则值为 true (t)。否则,该值将设置为 false (f)。
auto_analyze_phase character(100) 保留供内部使用。
schema_name char(128) 表 schema 的名称。
table_name char(136) 表的名称。

示例查询

以下示例联接 STV_TBL_PERM 以显示表名称和执行详细信息。

select distinct a.xid, trim(t.name) as name, a.status, a.rows, a.modified_rows, a.starttime, a.endtime from stl_analyze a join stv_tbl_perm t on t.id=a.table_id where name = 'users' order by starttime; xid | name | status | rows | modified_rows | starttime | endtime -------+-------+-----------------+-------+---------------+---------------------+-------------------- 1582 | users | Full | 49990 | 49990 | 2016-09-22 22:02:23 | 2016-09-22 22:02:28 244287 | users | Full | 24992 | 74988 | 2016-10-04 22:50:58 | 2016-10-04 22:51:01 244712 | users | Full | 49984 | 24992 | 2016-10-04 22:56:07 | 2016-10-04 22:56:07 245071 | users | Skipped | 49984 | 0 | 2016-10-04 22:58:17 | 2016-10-04 22:58:17 245439 | users | Skipped | 49984 | 1982 | 2016-10-04 23:00:13 | 2016-10-04 23:00:13 (5 rows)