Slow SQL

You might also like

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 1

Slow SQL 1) the first thing you need to check is the STATE column in V$SESSION: select sid st!

te from "$session where usern!me # $%&'($) SI* S+%+E ,,,, ,,,,,,,,,,,,,,,,,, --./ 0%I+IN1 23-2 0%I+E* 4NO0N +I5E 2) Session --./ indic!tes th!t it is w!iting for something !nd therefore not working let6s study the st!te of session 23-2 in the out7ut which shows th!t it w!ited for some known !mount of time e!rlier8 +he im7ort!nt 7oint is th!t session 23-2 is not waiting for !nything right now me!ning th!t it6s working 7roducti"ely8 let6s see wh!t the session 9--./) is w!iting for8 +h!t inform!tion is re!dily !"!il!:le in the EVENT column in the s!me V$SESSION "iew8 select sid st!te e"ent from "$session where usern!me # $%&'($) SI* S+%+E EVEN+ ,,,,, ,,,,,,,,,,,,,,,,, ,,,,,,,,,,,,,,,,,,,,,,,,,,,, 23-2 0%I+E* 4NO0N +I5E SQL;Net mess!ge from client --./ 0!iting en<: += > row lock contention .) session --./ is w!iting right now for !n e"ent:?en<ueue? +he session is w!iting :ec!use it w!nts to lock one or more rows :ut !nother session h!s !lre!dy 7l!ced locks on the row or rows8 @ou must look !t the S+%+E column first to determine whether the session is w!iting or working !nd then ins7ect the EVEN+ column Bow long the session is w!iting CSECONDS_IN_WAIT,WAIT_TIME tells the inform!tion 8 Output: SI* S+%+E *escri7tion

-)

A)

,,,,, ,,,,,,,,,, ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, ,,,,,,,,,,,,,,,,,,,, 23-2 0orking L!st w!ited 2D2E secs for SQL;Net mess!ge from client --./ 0!iting So f!r F.- secs for en<: += > row lock contention .2D3 0!iting So f!r A.E3 secs for SQL;Net mess!ge from client

/) Gheck for :locking session from the column BLOCKING_SESSION , BLOCKING_INSTANCE.


select :lockingHsession IHSI* :lockingHinst!nce IHInst from "$session where sid # --./) IHSI* IHINS+ ,,,,,, ,,,,,,, 23-2 1 > is :locking other sessions F) 3) E) +o know the o:Ject ROW_WAIT_OBJ# Joining this "!lue with o:JectHid in d:!Ho:Jects gi"es o:JectHn!me !nd know more inform!tion from columns 5%GBINE +E&5IN%L SE&VIGEHN%5E LO1ONH+I5E L%S+HG%LLHE+ 4nowing the s<l select s<lHid from "$session where sid # -D3E) select s<lHfullteKt from "$s<l where s<lHid#6!:o"e out7ut6)

You might also like