0

My users are launching an ugly UPDATE with linked sub-selects, an online query coexisting in a very agressive online environment.

In the trace, I saw an estimation of the UNDO retention needed, which is roughly 10x our current retention for UNDO.

As a newbie DBA, my instinct tells me optimizing the query might help and resolve the UPDATE with no ORA-01555.

Am I completely wrong?

Thank you so much!

1 Answer 1

1

Oracle database [uniquely] runs all queries AS OF the timestamp when the query / transaction started. To achieve this, it effectively "flashes back" every Data Block it uses, in memory, to that timestamp, using the available Undo segments. If there isn't enough in the Undo buffers to achieve that, Bang! You get error ORA-01555.
So this is a query that's using lots of data and taking a long time to do it, so that it needs lots of Undo to get all that data "back" to a consistent timestamp.
Ouch!

My users are launching an ugly UPDATE with linked sub-selects ...

Just to be clear; are your Users logged into the Production database and executing update queries? If so, you have far, far bigger problems, waiting in the wings.

Hopefully, this is something that they're running through an Application.
If so, then this issue should have been found during Testing of this application and its query, specifically Performance Testing.
If your Developers aren't doing this, they d***ed well should be.

... my instinct tells me optimizing the query might help ...

Good Instinct!
Tune your Workload, not your Database.

  • You can fiddle about for a couple of days with database and server parameters and get, maybe, 2 or 3 percentage points improvement.
  • Spend the same couple of days sorting out table structures and indexing and you could get 2 or 3 Orders of Magnitude improvement.
2
  • THANKS for your answer, Phill! just to clarify, "my users" == Dev team, and this issue is happening on a non-prod environment. The query is run through an app, not manually. Far most, the query is in the shape of UPDATE mytable X SET X.col = ( SELECT ... FROM A JOIN B JOIN C WHERE B.col = X.col )
    – glezo
    Commented Aug 23 at 12:03
  • Hopefully there are some "ON" clauses in there as well!
    – Phill W.
    Commented Aug 23 at 13:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.