有没有办法将 teradata show stats 值的结果加载到 table 中?

Is there a way to load the results of a teradata show stats values into a table?

我知道您可以通过对统计值执行显示命令来确定 table 是否为块级压缩:

show stats values on DBname.TABLEname
-- BLCPctCompressed >0 means yes

我的问题是是否有办法以程序或批量方式访问这些结果?我正在研究在我的 Teradata 系统上保存 space 的方法,如果你按 table 去 table,寻找非 BLC 的 table 可能会很耗时。在做一些更复杂的事情之前,比如构建一个导出 show stats values on <table> 结果到一个文件并运行 perl 脚本来评估 Y/N 的 BLC 行。或许有办法把显示的结果插入一个table?类似于 create volatile table vt_stat_rslt as (show stats values on db.table) with data on commit preserve rows

不可以,HELP 或 SHOW 的输出只能返回给客户端。它不能用作子查询/CTE 或在存储过程中访问。

考虑直接在数据库节点上使用 运行 ferret 实用程序(一个命令可以列出许多 table 的信息)。

您还可以查看 CreateFsysInfoTable / PopulateFsysInfoTable 宏(请参阅 SQL 函数、运算符、表达式和谓词 手册) 一次获取和存储一个 table 的信息。

收集统计信息通常存储在dbc.columnstatsvdbc.indexstatsv中。您可以检查这两个 dbc 视图,看看是否有帮助。

如果您只查找 BLC 信息,可以在 dbc.StatsVBLCCompRatio 列中找到:

 select * from dbc.STatsV where StatsId = 0