Previous |
Next |
Time model statistics measure the time spent in the database by operation type. The most important time model statistic is database time (DB time). Database time represents the total time spent in database calls, and is an indicator of the total instance workload. As shown in Figure: DB Time in Overall User Response Time, database time makes up a portion of an application's overall user response time.
A session is a specific connection of a user to an Oracle Database instance through a user process. Database time is calculated by aggregating the CPU time and wait time of all user sessions that are not idle. For any database request, the CPU time is the sum of the time spent working on the request, while the wait time is the sum of all the waits for various database instance resources. DB time does not include time spent on background processes such as PMON.
For example, a user session may involve an online transaction made at an online bookseller consisting of the actions shown in Figure: DB Time in User Transaction.
Query for novels by author
The user performs a search for novels by a particular author. This action causes the application to perform a database query for novels by the author.
Browse results of query
The user browses the returned list of novels by the author and accesses additional details, such as user reviews and inventory status. This action causes the application to perform additional database queries.
Add item to cart
After browsing details about the novels, the user decides to add one of the novels to the shopping cart. This action causes the application to make a database call to update the shopping cart.
Checkout
The user completes the transaction by checking out, using the address and payment information previously saved at the bookseller's Web site from a previous purchase. This action causes the application to perform various database operations to retrieve the user's information, add a new order, update the inventory, and generate an e-mail confirmation.
For each of the preceding actions, the user makes a request to the database, as represented by the down arrow in Figure: DB Time in User Transaction. The CPU time spent by the database processing the request and the wait time spent waiting for the database are considered DB time, as represented by the shaded areas. After the request is completed, the results are returned to the user, as represented by the up arrow. The space between the up and down arrows represents the total user response time for processing the request, which contains other components besides DB time, as illustrated in Figure: DB Time in Overall User Response Time.
Note: DB time is measured cumulatively from when the instance started. Because DB time combines times from all non-idle user sessions, DB time can exceed the time elapsed since the instance started. For example, an instance that has run 5 minutes could have four active sessions whose cumulative DB time is 20 minutes.
The objective of database tuning is to reduce the time that users spend performing actions on the database, or reducing database time. In this way, you can improve the overall response time of user transactions on the application.