Oracle查询执行时间 [英] Oracle query execution time
问题描述
我想获取Oracle中的查询执行时间.我不希望Oracle需要打印结果的时间-只是执行时间.
I would like to get the query execution time in Oracle. I don't want the time Oracle needs to print the results - just the execution time.
在MySQL中,很容易从shell中获取执行时间.
In MySQL it is easy to get the execution time from the shell.
如何在 SQL * Plus 中执行此操作?
推荐答案
一个人可以发出SQL * Plus命令SET TIMING ON
来获取挂钟时间,但是例如,一个人不能从中获取时间琐碎的.
One can issue the SQL*Plus command SET TIMING ON
to get wall-clock times, but one can't take, for example, fetch time out of that trivially.
AUTOTRACE设置(用作SET AUTOTRACE TRACEONLY
时)将禁止输出,但仍将执行所有工作来满足查询并将结果发送回SQL * Plus,从而将其禁止.
The AUTOTRACE setting, when used as SET AUTOTRACE TRACEONLY
will suppress output, but still perform all of the work to satisfy the query and send the results back to SQL*Plus, which will suppress it.
最后,人们可以跟踪SQL * Plus会话,并手动计算花费在等待客户端等待的事件上的时间,例如向客户端发送的SQL * Net消息",来自客户端的SQL * Net消息".
Lastly, one can trace the SQL*Plus session, and manually calculate the time spent waiting on events which are client waits, such as "SQL*Net message to client", "SQL*Net message from client".
这篇关于Oracle查询执行时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!