In Oracle AWR reports, the “Time Model Statistics” section greatly simplifies a DBA’s task by revealing where the database spends its time from the user’s perspective. It complements top timed events section, which presents a similar view but from the database’s internal perspective.

In this example, it states that SQL accounts for 68% of DB Time, while PL/SQL constitutes only 3%.

However, when we scroll down to the “SQL Statistics” section, we find that the captured PL/SQL SQL statements account for 67.5% of the total DB Time (s), suggesting that most SQL is actually executed within PL/SQL.

At first glance, this seems contradictory—if most SQL is executed inside PL/SQL, shouldn’t PL/SQL time be higher? The answer lies in how Oracle defines and measures these statistics.

Although PL/SQL code primarily consists of SQL statements, “sql execute elapsed time” and “PL/SQL execute elapsed time” do not overlap.

  • SQL executed inside PL/SQL is counted in “sql execute elapsed time”, not in “PL/SQL execute elapsed time”.
  • PL/SQL execute elapsed time measures only the time spent running the PL/SQL engine itself—loops, conditionals, variable assignments, and so on.
  • It does not include time spent executing embedded SQL statements within that PL/SQL block.

In other words, the 3% PL/SQL time represents interpreter overhead, while the 68% SQL time includes the actual execution time of SQL inside PL/SQL blocks.

Leave a comment

I’m Yuan

Welcome to the blog of a performance maven in Oracle & MySQL. Feel free to contact me to share and discuss database knowledge.

My 20 Oracle Certifications

A screenshot from certview.oracle.com

My Book

MySQL 8.0 Operations and Optimization

Let’s connect