Oracle – Query Performance Degradation from Seconds to Minutes

oracle

We have an Oracle query in a report that use to run in less than 1 second. Now takes 8 minutes.

  • I've tried rebuilding all the indexes it uses. No impact.
  • The query has not been changed in months.
  • I personally tested the query on both an older clone of the production db and a new clone. It ran fast on the one and slow on the other. So it's real.
  • The explain plan on the query is perfect. No reason why it shouldn't be lightning fast.

I'm running out of ideas. Any suggestions?

Best Answer

Justin Cave, I think you are right. It's using something other than the explain plan.

I added the hint /*+ LEADING (table_alias, table_alias) */ referencing the first two tables in the explain plan and boom, it's running like lightning again.