Trafodion会保存已执行的Query语句及相关执行信息在”REPOS“下面的METRIC_QUERY_TABLE
SQL>set schema "_REPOS_";
--- SQL operation complete.
SQL>get tables;
Tables in Schema TRAFODION._REPOS_
==================================
METRIC_QUERY_AGGR_TABLE
METRIC_QUERY_TABLE
METRIC_SESSION_TABLE
METRIC_TEXT_TABLE
--- SQL operation complete.
关于上述表的定义和作用,详情请参考:https://cwiki.apache.org/confluence/display/TRAFODION/Examples+and+Guidelines+for+Creating+Repository+Queries
假设我希望查看最近执行的3条语句及执行时间,则可以这样查询,
SQL>select query_text,query_elapsed_time from metric_query_table order by exec_start_utc_ts desc limit 3;
QUERY_TEXT QUERY_ELAPSED_TIME
-------------------------------------------------------------------------------------------------------------------------------- --------------------
select * from trafodion.pksaas.eboxdata_30m; 1328175084
select * from trafodion.pksaas.eboxdata_30m; 441625092
select * from trafodion.pksaas.eboxdata_30m; 460971249
--- 3 row(s) selected.
不过,默认设置下,Trafodion只会保存并记录时长超过1分钟的那些Query语句,如果希望调整设置,可以修改dcs-site.xml添加以下配置,然后重启dcs(dcsstop;dcsstart)
<property>
<name>dcs.server.user.program.statistics.limit.time</name>
<value>0</value>
</property>