title: High query execution time
body: <pre><code>SELECT T.xhrs, T.eq_id, mt.CATEGORY, mt.MODEL_NAME,
         ROUND((SUM (T.TOT_AVAIL_TIME-T.maintenance_TIME) / SUM(T.TOT_AVAIL_TIME))*100) AVAILABILITY,
         ROUND((SUM(UTIL_TIME) / nullif(SUM(T.TOT_AVAIL_TIME-T.maintenance_TIME ),0) )*100) UTILIZATION,
         ROUND(SUM(T.failedcmds)/
         SUM(T.total_failedcmds),2)*100 failedcmds,
         AVG(MAX_QL) MAX_QL,
         AVG(AVG_QL) avg_ql
  FROM db1 T,
       db2 mt
  WHERE T.eq_model = mt.eq_model
    and TOT_AVAIL_TIME != 0
    AND TOT_AVAIL_TIME  IS NOT NULL
  GROUP BY T.xhrs, T.eq_id, mt.CATEGORY, mt.MODEL_NAME
  </code></pre>
  
  <p>This query returns 2550 records and takes 12-15 s to run in SQL Developer and in mybatis it takes 30-35 secs. Is there any thing wrong with existing query? Is there any way to optimize above query and bring down the execution time to &lt;5 secs in sql developer and &lt;15 secs in ORM?</p>
  
  <p>Explain Plan</p>
  
  <p><a href="https://i.stack.imgur.com/ZllX6.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ZllX6.png" alt="enter image description here"></a></p>