Question

I'm running queries in PL/SQL Developer. How to find out the running time of sql query in PL/SQL. I am querying specific tables. Like

select * from table_name where customer_id=1;

select * from movie_table where movie_id=8;

While i am using PL/SQL, i want to know the query running time.

Thanks, your help is very much appreciated.

Was it helpful?

Solution

The simplest way to do this, courtesy of @Hamidreza's link, is like this:

set timing on;
select * from table_name where customer_id=1;

The execution time will appear below the records selected.

OTHER TIPS

I think you can use dbms_utility.get_time function.

l_start := dbms_utility.get_time;
select * from table_name where customer_id=1;
select * from movie_table where movie_id=8;
l_end := dbms_utility.get_time;
l_diff := (l_end-l_start)/100;
dbms_output.put_line('Overall Time: '|| l_diff);

Something like this, in brief.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top