05.11.2015 Views

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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

608<br />

CHAPTER 13 ■ PARTITIONING<br />

<strong>and</strong> you execute your typical OLTP queries you know you run frequently:<br />

variable o varchar2(30)<br />

variable t varchar2(30)<br />

variable n varchar2(30)<br />

exec :o := 'SCOTT'; :t := 'TABLE'; :n := 'EMP';<br />

select *<br />

from t<br />

where owner = :o<br />

<strong>and</strong> object_type = :t<br />

<strong>and</strong> object_name = :n<br />

/<br />

select *<br />

from t<br />

where owner = :o<br />

<strong>and</strong> object_type = :t<br />

/<br />

select *<br />

from t<br />

where owner = :o<br />

/<br />

but you notice that when you run this with SQL_TRACE=TRUE <strong>and</strong> review the resulting TKPROF<br />

report the following performance characteristics:<br />

select * from t where owner = :o <strong>and</strong> object_type = :t <strong>and</strong> object_name = :n<br />

call count cpu elapsed disk query current rows<br />

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

total 4 0.00 0.00 0 34 0 1<br />

Rows Row Source Operation<br />

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

1 PARTITION HASH ALL PARTITION: 1 16 (cr=34 pr=0 pw=0 time=359 us)<br />

1 TABLE ACCESS BY LOCAL INDEX ROWID T PARTITION: 1 16 (cr=34 pr=0<br />

1 INDEX RANGE SCAN T_IDX PARTITION: 1 16 (cr=33 pr=0 pw=0 time=250<br />

You compare that to the same table, only with no partitioning implemented, <strong>and</strong> discover<br />

the following:<br />

select * from t where owner = :o <strong>and</strong> object_type = :t <strong>and</strong> object_name = :n<br />

call count cpu elapsed disk query current rows<br />

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

total 4 0.00 0.00 0 5 0 1

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

Saved successfully!

Ooh no, something went wrong!