Update sys.job$ set this_date=:1 where job=:2 as one of the most time-consuming queries – oracle

Posted on

Question :

I am currently helping some organization with their Oracle database performance. They are using Oracle 11gR2 Standard Edition in Windows 2008. As there are no enterprise performance packages available on this standard edition, I’ve had to use v$sql to query longest-running ones to identify performance bottlenecks. Using the query below :

SELECT *
FROM   (
              SELECT sql_text,
                     sql_id,
                     elapsed_time,
                     plsql_exec_time,
                     cpu_time,
                     executions,
                     fetches,
                     loads,
                     buffer_gets,
                     elapsed_time / executions
              FROM   v$sql -- order by elapsed_time / executions)         )  where rownum <= 10;

It returned some queries which I will look into, but there are two rows in the results that I cannot understand the reason why they should exist here:

Results for two queries

As you can see, the query executes on sys.job$, so it should be related to oracle jobs set on this database. My questions are :

1) What does these two rows mean? Should I query dba_jobs table for more information? How should I query them and what should I look for?

2) Both of the queries look identical, why they are echoed twice in the query result?

Answer :

If that is your most time consuming query, then your database does almost nothing.

That is 0.211599 and 0.002923 seconds per execution with a total runtime of 39.9 and 1.7 seconds.

order by elapsed_time / executions) ) where rownum <= 10;

This returns the shortest running queries, not the longest-running ones. Use order by ... desc.

  1. No. This is an internal statement that updates the dictionary with the start time of a job on starting it. There is nothing to investigate about it.

  2. You should find this information in V$SQL_SHARED_CURSOR. Look for the column with a value of Y, and the name of that column specifies the reason for having another child cursor.

Leave a Reply

Your email address will not be published. Required fields are marked *