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 17 SQL TUNING 387<br />

<br />

<br />

<strong>Database</strong> designers have several kinds of indexes at their disposal; the most common<br />

are listed here:<br />

b*tree (balanced tree) type and are best suited for online<br />

transaction processing environments. Index entries are s<strong>to</strong>red in a structure that<br />

has a root node, branches, and leaves, hence the name.<br />

Reverse key indexes are a specialized type of b*tree index in which the key values<br />

are reversed (for example, IGGY becomes YGGI) <strong>to</strong> prevent concentrations of similar<br />

entries in index blocks and consequent contention for blocks.<br />

Function-based indexes and indexes on virtual columns (columns defined in terms<br />

of other columns) are indexes not on the data values contained in columns—but<br />

on combinations of these values. For example, an index on would be<br />

an example of a function- based index.<br />

Bitmap indexes are a specialized kind of index used in data warehouses for columns<br />

that contain only a few values—for example, model, year, and color. Each<br />

value is represented by a bitmap (an array of 0s and 1s), and each element of the<br />

bitmap represents one record in the table.<br />

In addition <strong>to</strong> indexes, database designers have other data structures at their disposal.<br />

Examples include clusters, index- organized tables, and partitioned tables.<br />

Tip <strong>Oracle</strong> does not use an index unless the query optimizer perceives a benefit in doing so. You can<br />

verify that an index is being used by issuing the clause of the command<br />

and reviewing the contents of the view after a suitable time has passed. If <strong>Oracle</strong> is not<br />

using an index, you can use the techniques in the following sections <strong>to</strong> increase the chances that it will do<br />

so. If an index is never used, you should consider whether it can be removed safely because indexes slow<br />

down insert, update, and delete operations and occupy valuable space within the database.<br />

Hints<br />

Hints for the optimizer can be embedded inside an SQL statement if the optimizer does<br />

not find an acceptable query plan for the statement. Each hint partially constrains the<br />

optimizer, and a full set of hints completely constrains the optimizer. In fact, a desirable<br />

query plan can be preserved by capturing the complete set of hints that describes it in<br />

a s<strong>to</strong>red outline. For details, refer <strong>to</strong> <strong>Oracle</strong> <strong>Database</strong> <strong>11g</strong> Performance Tuning Guide.

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

Saved successfully!

Ooh no, something went wrong!