querytime

querytime

You can estimate your query time as follows.

SELECT CURRENT TIMESTAMP FROM SYSIBM.SYSDUMMY1;

-- Your query here…

SELECT CURRENT TIMESTAMP FROM SYSIBM.SYSDUMMY1;

-- Alternatively, for many queries:

DROP TABLE cse532.querytime;

CREATE TABLE cse532.querytime(

queryID VARCHAR (8),

starttime TIMESTAMP,

endtime TIMESTAMP);

INSERT INTO cse532.querytime VALUES(

'Q1'current timestamp, null);

UPDATE cse532.querytime

SET endtime = current timestamp

WHERE queryID = 'Q1';

SELECT TIMESTAMPDIFF(1, endtime - starttime)

FROM cse532.querytime;