Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Automating SQL Query Execution Time Measurement

Hello everyone,

I’m working on a project where I need to measure the execution time of an SQL query automatically. The query has two parameters: a search term and a list of IDs that are used in the WHERE clause to narrow down the results.

Currently, I’m measuring the execution time by manually running the query in SQL*Plus with SET TIMING ON and recording the elapsed time from the output. While this method works, it’s not as automated as I’d like.

I tried writing a PL/SQL block using DBMS_UTILITY.GET_TIME to measure the time, but the results I’m getting are significantly shorter than the elapsed time I observe using SET TIMING ON in SQL*Plus.

Is there an automatic and reliable way to measure query execution time? Any insights or alternative approaches would be greatly appreciated!

Thanks in advance!

Comments
Post Details
Added on Aug 11 2024
3 comments
873 views