01.09.2016 Views

Beginning Oracle Database 11g Administration From Novice to Professional

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

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

CHAPTER 7 PHYSICAL DATABASE DESIGN 137<br />

Advanced Topics<br />

Two advanced indexing methods are worth knowing about but are beyond the scope of<br />

this book: bitmap indexing and reverse key indexing. Information on those methods can<br />

be found in <strong>Oracle</strong> <strong>Database</strong> <strong>11g</strong> Concepts Manual or the other references listed at the<br />

end of this chapter.<br />

bitmap index uses a single bit (0 or 1) <strong>to</strong><br />

represent each row; a “bitmap” is generated for each distinct value contained in<br />

the indexed column.<br />

increasing values, <strong>Oracle</strong> will attempt <strong>to</strong><br />

insert the index information in<strong>to</strong> the same leaf block each time. This dramatically<br />

increases the frequency of splitting and balancing operations. The solution is <strong>to</strong><br />

create a reverse key index.<br />

Partitions<br />

Because <strong>Oracle</strong> tables are s<strong>to</strong>red as heaps, with no discernible internal organization, new<br />

rows of data are simply appended <strong>to</strong> the end of the table or anywhere else in the table<br />

there happens <strong>to</strong> be room. The strategy of using indexes <strong>to</strong> find the required rows of data<br />

quickly works well up <strong>to</strong> a point. But it begins <strong>to</strong> reveal its limitations as the amounts<br />

of data and the numbers of users approach the levels that we see in modern data warehouses<br />

and in online s<strong>to</strong>res such as Amazon.com.<br />

To understand the problem with heaps, imagine a his<strong>to</strong>ry book containing facts like<br />

the following: “The Declaration of Independence was adopted by the Second Continental<br />

Congress on July 4, 1776.” Suppose that these facts are not naturally organized in<strong>to</strong> separate<br />

chapters for, say, individual countries but are randomly scattered throughout the book. We<br />

can still use the alphabetical index at the back of the book <strong>to</strong> discover facts about the United<br />

States relatively easily but, each time we retrieve a fact, we might have <strong>to</strong> visit a different<br />

page; this would obviously not be an efficient process.<br />

A page of a book is analogous <strong>to</strong> a data block on a s<strong>to</strong>rage disk, and a chapter of related<br />

information in a book is analogous <strong>to</strong> an <strong>Oracle</strong> partition. Partitions divide data tables in<strong>to</strong><br />

separate s<strong>to</strong>rage pools; rows of data can be allocated <strong>to</strong> each s<strong>to</strong>rage pool using some criterion.<br />

Suppose we have a very large table of credit- card transactions, and they are randomly<br />

s<strong>to</strong>red throughout the table without regard <strong>to</strong> date. To process the transactions completed<br />

in the last month, <strong>Oracle</strong> will have <strong>to</strong> retrieve more blocks of data from the s<strong>to</strong>rage disks<br />

than if transactions were s<strong>to</strong>red with regard <strong>to</strong> date. The solution is <strong>to</strong> create a separate<br />

partition for each month. If a query spans partitions, <strong>Oracle</strong> need only visit the appropriate<br />

partitions; this is called partition pruning.

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

Saved successfully!

Ooh no, something went wrong!