Databases
cancel
Showing results for 
Search instead for 
Did you mean: 

How can I get how long the informix SPL routine or SQL statement runs?

renx
Occasional Advisor

How can I get how long the informix SPL routine or SQL statement runs?

How can I get how long the informix SPL routine or SQL statement runs?
rx
2 REPLIES
leochen
Occasional Visitor

Re: How can I get how long the informix SPL routine or SQL statement runs?

Two different situations :

Situation 1 : You want to know the execution time for spl:xx, you can :
1.1 create a shell yy like this :
echo "execute procedure xx(arg1,arg2,...)"|dbaccess your_db_name
1.2 timex yy
then you can get the answer.

Situation 2 : You want to know the execution time for some sql statements in spl:xx, you can :
2.1 create a small execution file, with cur.c attached, to show out the current timestamp
2.2 add the following clauses after the definition section in you spl yy :
set explain on;
SET DEBUG FILE TO "/tmp/yy.log" WITH APPEND;
TRACE "****************************";
2.3 Show the timestamp before and after the sql staement you want:
system(" cur.exe 'Start ..' >> Leo_c02s.log " );
....
your sql here
....
system(" cur.exe 'Start ..' >> /tmp/yy.log " );
2.4 Then you can figure out how long does your sql statement take.

Hope it helps !!

Regards,
Leo


Steve Lewis
Honored Contributor

Re: How can I get how long the informix SPL routine or SQL statement runs?

$ time dbaccess measureware << EOF

> select count(*) from diskinfo;
> EOF

Database selected.

(count(*))

1325365

1 row(s) retrieved.


Database closed.

real 0m0.29s
user 0m0.04s
sys 0m0.03s