Pages

Thursday, March 2, 2017

Find Transactions Per Second (TPS) in Oracle

Use following query to find TPS (overall) in Oracle.

WITH hist_snaps
     AS (SELECT instance_number,
                snap_id,
                round(begin_interval_time,'MI') datetime,
                  (  begin_interval_time
                   + 0
                   - LAG (
                        begin_interval_time + 0)
                     OVER (PARTITION BY dbid, instance_number
                           ORDER BY snap_id))
                * 86400      -- seconds per day
                   diff_time -- calculate difference in time from
                             -- previous snapshot
                   FROM dba_hist_snapshot),
     hist_stats      AS (SELECT dbid,
                instance_number,
                snap_id,
                stat_name,
                  VALUE
                - LAG (
                     VALUE)
                  OVER (PARTITION BY dbid,instance_number,stat_name
                        ORDER BY snap_id)
                  delta_value -- difference in value from previous
                              -- snapshot for each stat_name
           FROM dba_hist_sysstat
          WHERE stat_name IN ('user commits', 'user rollbacks'))
  SELECT datetime,
         ROUND (SUM (delta_value) / 3600, 2) "Transactions/Second"
     FROM hist_snaps sn, hist_stats st
   WHERE     st.instance_number = sn.instance_number
         AND st.snap_id = sn.snap_id
         AND diff_time IS NOT NULL
GROUP BY datetime
ORDER BY 1 desc;

5 comments:

  1. This comment has been removed by the author.

    ReplyDelete

  2. Thanks for sharing this great information I am impressed by the information that you have on this blog. Same as your blog i found another one Oracle Fusion HCM . Actually, I was looking for the same information on internet for
    Oracle Fusion HCM Interview Questions and Answers and came across your blog. I am impressed by the information that you have on this blog. It shows how well you understand this subject.


    ReplyDelete
  3. I would like to thank you for the efforts you have made in writing this article.
    We also provide same services of oracle database amd SQL etc.Kindly check below relates services of oracle database.
    sql performance tuning
    MySQL database and sql
    oracle database and sql
    oracle performance tuning tips
    sql query performance tuning
    optimization of sql queries
    oracle sql query
    sql performance monitoring
    database query optimization

    ReplyDelete