Reputation: 25
I have two similar queries and I want to compare time they take to execute. However I cant figure out what is the right way to get query execution time and also how do I compare them fairly if each time you run a query its time gets lower?
Upvotes: 0
Views: 1162
Reputation: 12169
you can get an average execution times from the v$sqlarea view. Replace with whatever sql text to find your query. Note that the rows in v$sqlarea are transient. Average times are in units of microseconds.
select sql_text, executions,
elapsed_time/executions average_exec_time,
cpu_time/executions average_cpu_time
from v$sqlarea
where sql_text like 'SELECT blah blah FROM%'
Note that this is just a "ballpark" figure.
Upvotes: 3