我遇到了一个简单的问题,就是找出哪些查询需要比平常更多的查询才能完成。我的脚本如下:
locking row for access
SELECT
username,
CollectTimeStamp,
((firstresptime - starttime ) HOUR TO second ) AS ElapsedTime,
((firstresptime - firststeptime ) HOUR TO second ) AS ExecutionTime,
CAST(((firstresptime - firststeptime) SECOND) AS INTEGER) AS ExecutionTimeInt,
(ElapsedTime - ExecutionTime) AS Delay,
-- other kpis here
FROM dbql_data.dbql_all
where username ='MyUser';
and dateofday> '2017-07-01'
and ExecutionTimeInt > 5
但是,我得到ExecutionTimeInt
小于5的记录。
问题:如何获取时间间隔大于某个值的记录?
额外信息:
select * from dbc.dbcinfo;
返回
InfoKey InfoData
1 VERSION 15.10.04.10
2 RELEASE 15.10.04.02
3 LANGUAGE SUPPORT MODE Standard
答案 0 :(得分:3)
ExecutionTimeInt
计算可能会因Interval overflow
而失败,因为其限制为9999秒。
ElapsedTime
是一个间隔,比较的正确方法是:
WHERE ElapsedTime > interval '5' second
或
WHERE ElapsedTime > interval '1' minute