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.

CHAPTER 13 ■ PARTITIONING 571<br />

PART_1<br />

PART_2<br />

Figure 13-2. Hash partition insert example<br />

As noted earlier, hash partitioning gives you no control over which partition a row ends<br />

up in. <strong>Oracle</strong> applies the hash function <strong>and</strong> the outcome of that hash determines where the<br />

row goes. If you want a specific row to go into partition PART_1 for whatever reason, you<br />

should not—in fact, you cannot—use hash partitioning. The row will go into whatever partition<br />

the hash function says to put it in. If you change the number of hash partitions, the data<br />

will be redistributed over all of the partitions (adding or removing a partition to a hash partitioned<br />

table will cause all of the data to be rewritten, as every row may now belong in a<br />

different partition).<br />

Hash partitioning is most useful when you have a large table, such as the one shown in<br />

the “Reduced Administrative Burden” section, <strong>and</strong> you would like to “divide <strong>and</strong> conquer” it.<br />

Rather than manage one large table, you would like to have 8 or 16 smaller “tables” to manage.<br />

Hash partitioning is also useful to increase availability to some degree, as demonstrated in the<br />

“Increased Availability” section; the temporary loss of a single hash partition permits access to<br />

all of the remaining partitions. Some users may be affected, but there is a good chance that<br />

many will not be. Additionally, the unit of recovery is much smaller now. You do not have a<br />

single large table to restore <strong>and</strong> recover; you have a fraction of that table to recover. Lastly,<br />

hash partitioning is useful in high update contention environments, as mentioned in the<br />

“Enhanced Statement Performance” section when we talked about OLTP systems. Instead of<br />

having a single “hot” segment, we can hash partition a segment into 16 pieces, each of which<br />

is now receiving modifications.

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

Saved successfully!

Ooh no, something went wrong!