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.

CHAPTER 13 ■ PARTITIONING 583<br />

In the case of a globally partitioned index, note that the number of index partitions may,<br />

in fact, be different from the number of table partitions.<br />

Since global indexes may be partitioned by range or hash only, you must use local indexes<br />

if you wish to have a list or composite partitioned index. The local index will be partitioned<br />

using the same scheme as the underlying table.<br />

■Note Hash partitioning of global indexes is a new feature in <strong>Oracle</strong> 10g Release 1 <strong>and</strong> later only. You may<br />

only globally partition by range in <strong>Oracle</strong>9i <strong>and</strong> before.<br />

Local Indexes vs. Global Indexes<br />

In my experience, most partition implementations in data warehouse systems use local<br />

indexes. In an OLTP system, global indexes are much more common, <strong>and</strong> we’ll see why<br />

shortly—it has to do with the need to perform partition elimination on the index structures<br />

to maintain the same query response times after partitioning as before partitioning them.<br />

■Note Over the last couple of years, it has become more common to see local indexes used in OLTP<br />

systems, as such systems have rapidly grown in size.<br />

Local indexes have certain properties that make them the best choice for most data warehouse<br />

implementations. They support a more available environment (less downtime), since<br />

problems will be isolated to one range or hash of data. Since it can point to many table partitions,<br />

a global index, on the other h<strong>and</strong>, may become a point of failure, rendering all partitions<br />

inaccessible to certain queries.<br />

Local indexes are more flexible when it comes to partition maintenance operations. If the<br />

DBA decides to move a table partition, only the associated local index partition needs to be<br />

rebuilt or maintained. With a global index, all index partitions must be rebuilt or maintained<br />

in real time. The same is true with sliding window implementations, where old data is aged<br />

out of the partition <strong>and</strong> new data is aged in. No local indexes will be in need of a rebuild, but<br />

all global indexes will be either rebuilt or maintained during the partition operation. In some<br />

cases, <strong>Oracle</strong> can take advantage of the fact that the index is locally partitioned with the table<br />

<strong>and</strong> will develop optimized query plans based on that. With global indexes, there is no such<br />

relationship between the index <strong>and</strong> table partitions.<br />

Local indexes also facilitate a partition point-in-time recovery operation. If a single partition<br />

needs to be recovered to an earlier point in time than the rest of the table for some<br />

reason, all locally partitioned indexes can be recovered to that same point in time. All global<br />

indexes would need to be rebuilt on this object. This does not mean “avoid global indexes”—in<br />

fact, they are vitally important for performance reasons, as you’ll learn shortly—you just need<br />

to be aware of the implications of using them.

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

Saved successfully!

Ooh no, something went wrong!