05.11.2015 Views

Apress.Expert.Oracle.Database.Architecture.9i.and.10g.Programming.Techniques.and.Solutions.Sep.2005

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

CHAPTER 10 ■ DATABASE TABLES 345<br />

logs are sized appropriately, indexes won’t be slowing things down, <strong>and</strong> I’m running on a<br />

machine with two hyperthreaded Xeon CPUs—this should run fast. What I discovered afterward,<br />

however, is the following:<br />

Snap Id Snap Time Sessions Curs/Sess Comment<br />

--------- ------------------ -------- --------- -------------------<br />

Begin Snap: 793 29-Apr-05 13:45:36 15 3.9<br />

End Snap: 794 29-Apr-05 13:46:34 15 5.7<br />

Elapsed:<br />

0.97 (mins)<br />

Top 5 Timed Events<br />

~~~~~~~~~~~~~~~~~~ % Total<br />

Event Waits Time (s) Call Time<br />

-------------------------------------------- ------------ ----------- ---------<br />

CPU time 165 53.19<br />

buffer busy waits 368,698 119 38.43<br />

log file parallel write 1,323 21 6.86<br />

latch: cache buffers chains 355 2 .67<br />

enq: HW - contention 2,828 1 .24<br />

I collectively waited 119 seconds, or about 24 seconds per session, on buffer busy waits.<br />

These waits are caused entirely by the fact that there are not enough freelists configured on<br />

my table for the type of concurrent activity that is taking place. I can eliminate most of that<br />

wait time easily, just by creating the table with multiple freelists:<br />

ops$tkyte@ORA10GR1> create table t ( x int, y char(50) )<br />

2 storage( freelists 5 ) tablespace MSSM;<br />

Table created.<br />

or by altering the object:<br />

ops$tkyteORA10GR1> alter table t storage ( FREELISTS 5 );<br />

Table altered.<br />

You will find that the buffer busy waits goes way down, <strong>and</strong> the amount of CPU needed<br />

(since you are doing less work here; competing for a latched data structure can really burn<br />

CPU) also goes down along with the elapsed time:<br />

Snap Id Snap Time Sessions Curs/Sess Comment<br />

--------- ------------------ -------- --------- -------------------<br />

Begin Snap: 809 29-Apr-05 14:04:07 15 4.0<br />

End Snap: 810 29-Apr-05 14:04:41 14 6.0<br />

Elapsed:<br />

0.57 (mins)<br />

Top 5 Timed Events<br />

~~~~~~~~~~~~~~~~~~ % Total<br />

Event Waits Time (s) Call Time<br />

-------------------------------------------- ------------ ----------- ---------<br />

CPU time 122 74.66

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!