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.

612<br />

CHAPTER 13 ■ PARTITIONING<br />

19<br />

22<br />

...<br />

139<br />

161<br />

5<br />

23<br />

...<br />

163<br />

167<br />

35<br />

37<br />

...<br />

75<br />

160<br />

38 rows selected.<br />

Execution Plan<br />

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

0 SELECT STATEMENT Optimizer=ALL_ROWS (Cost=4 Card=38 Bytes=494)<br />

1 0 PARTITION HASH (ALL) (Cost=4 Card=38 Bytes=494)<br />

2 1 INDEX (RANGE SCAN) OF 'T_IDX' (INDEX) (Cost=4 Card=38 Bytes=494)<br />

ops$tkyte@ORA10G> set autotrace off<br />

So, even though <strong>Oracle</strong> used the index in a range scan, the data is obviously not sorted. In fact, you<br />

might observe a pattern in this data. There are “four sorted” results here: the ... replaces values that were<br />

increasing in value; <strong>and</strong> between the rows with USER_ID = 34 <strong>and</strong> 81, the values were increasing in the<br />

output. Then the row with USER_ID = 19 appeared. What we are observing is <strong>Oracle</strong> returning “sorted<br />

data” from each of the four hash partitions, one after the other.<br />

This is just a warning that unless your query has an ORDER BY, you have no reason to anticipate the<br />

data being returned to you in any kind of sorted order whatsoever. (And no, GROUP BY doesn’t have to sort<br />

either! There is no substitute for ORDER BY.)<br />

Auditing <strong>and</strong> Segment Space Compression<br />

Not too many years ago, U.S. government constraints such as those imposed by the HIPAA<br />

act (http://www.hhs.gov/ocr/hipaa) were not in place. Companies such as Enron were still in<br />

business, <strong>and</strong> another U.S. government requirement for Sarbanes-Oxley compliance did not<br />

exist. Back then, auditing was considered something that “we might do someday, maybe.”<br />

Today, however, auditing is at the forefront, <strong>and</strong> many DBAs are challenged to retain online<br />

up to seven years of audit trail information for their financial, business, <strong>and</strong> health care<br />

databases.

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

Saved successfully!

Ooh no, something went wrong!