Something has to be updating one of the tables
or you couldn 't get ORA-01555 (See ORA-01555.ora-code.com). I would check
to see if any of the code is doing 'select for update '
rather than a simple 'update '. There are versions
of Oracle where 'select for update ' can result in
large numbers of CR copies of blocks and produces
the symptoms you 've described.
Another possibility is that there is something about
the data and index on T3 with it "less than " clause
which results in identical access paths, but extremely
different amounts of work being done as the data
changes over discrete time intervals. The execution
path, index definitions, and column types might give
a clue.
Regards
Jonathan Lewis
http://www.jlcomp.demon.co.uk
The Co-operative Oracle Users ' FAQ
http://www.jlcomp.demon.co.uk/faq/ind_faq.html
June 2004 UK Manchester
July 2004 Iceland
July 2004 USA California
Aug 2004 USA North Carolina
Sept 2004 UK Manchester
Sept 2004 USA NYC
Oct 2004 USA Boston
-- -- Original Message -- --
From: "Daniel Fink " <Daniel.Fink@(protected) >
To: <oracle-l@(protected) >
Sent: Monday, May 03, 2004 9:05 PM
Subject: A Tale of Two SQLs
It was the best of sql executions; it was the worst of sql
executions.
We have a process that periodically slows down. So far, we have
not been able to pinpoint a root cause, but we continue to
pester the development/application support folks for more info.
I apologize for the limited information, but I 'm hoping that we
are aiming in the right direction.
We are smart enough that we captured a 10046 trace during a good
execution as a baseline. I have tagged the lines from this trace
file as (good). This morning, the query began slowing down
(eventually it will get a 1555 error). We turned on tracing and
those lines are tagged as (bad).
To make sure I am comparing apples to apples, the statements are
identical, even the bind variables are identical. I 'm not going
to post the 2 trace files (almost 500m), so I 'm including the
relevant parts. There are no waits in these execution/fetches
(you read it correctly, no db file waits, no sql*net waits).
I 've also changed the statments to remove any table/column
names.
What I have found is that the first FETCH of the bad execution
is significantly (300 - 700x) slower than the good execution. It
also performs significantly more (500x) consistent reads.
Subsequent FETCHes are nearly identical to each other (in terms
of good = bad). These FETCHes are performed tens of thousands of
times as this query is re-executed with different bind variables
(also note the time difference in the EXECs, but it pales in
comparison).
My theory is that the high number of crs in the first FETCH of
each execution are the result of building a read-consistent
version of the data. Again, we are working with the dev/app
folks to confirm that one of these tables is being modified, but
have not had a response yet.
Comments on my theory?
'Tis a far, far better thing I do...
Daniel
Bad SQL
=====================
PARSING IN CURSOR #10(bad) len=295 dep=1 uid=86 oct=3 lid=86
tim=746385804887 hv=3414111617 ad= '93b1bcf0 '
SELECT t1.col1
from table1 t1, table2 t2
where t2.col2 = :b1 and t2.col2 = t1.col2
union
select max(t3.col3)
from table3 t3
where t3.col4 = substr(:b1, 1, 6) and t3.col3 < :b1
END OF STMT
Good SQL
=====================
PARSING IN CURSOR #7(good) len=295 dep=1 uid=63 oct=3 lid=63
tim=26349629222266 hv=3414111617 ad= '8c9aee70 '
SELECT t1.col1
from table1 t1, table2 t2
where t2.col2 = :b1 and t2.col2 = t1.col2
union
select max(t3.col3)
from table3 t3
where t3.col4 = substr(:b1, 1, 6) and t3.col3 < :b1
END OF STMT