I have query that takes a lot time to execute (distinct operation). But that query is not listed in v$session_longops. How can I force query to be put to v$session_longops.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Unfortunately, if you’re talking about a single SQL query, you probably can’t force it to show up in
V$SESSION_LONGOPS. Oracle writes a query toV$SESSION_LONGOPSwhen one step takes more than 6 seconds. But you can have a very long-running query that is composed of many very short steps. A nested loop join where both inner and outer queries are using an index to fetch the data, for example, can run for a long time but no individual operation may take more than a small fraction of a second. If that’s the case, it is generally worth comparing the optimizer’s estimated cardinality against the actual cardinality. It is quite possible that Oracle is executing a large number of short operations because it is underestimating the cardinality of various steps of the operation. Getting better estimates for the optimizer may result both in a more efficient query plan and the longer operations being tracked inV$SESSION_LONGOPS.If you are talking about a PL/SQL process that happens to issue one or more SQL queries, Rajesh’s comment is spot on. You can use the DBMS_APPLICATION_INFO.SET_SESSION_LONGOPS method to have the progress of your PL/SQL process tracked in
V$SESSION_LONGOPS.