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 597<br />

they will not run at all or they will run without the benefit of the index. All of the data must be<br />

scanned <strong>and</strong> the entire index reconstructed from the table data. If the table is many hundreds<br />

of gigabytes in size, this will take considerable resources.<br />

“Live” Global Index Maintenance<br />

Starting in <strong>Oracle</strong>9i, another option was added to partition maintenance: the ability to maintain<br />

the global indexes during the partition operation using the UPDATE GLOBAL INDEXES clause.<br />

This means that as you drop a partition, split a partition, perform whatever operation necessary<br />

on a partition, <strong>Oracle</strong> will perform the necessary modifications to the global index to<br />

keep it up to date. Since most partition operations will cause this global index invalidation to<br />

occur, this feature can be a boon to systems that need to provide continual access to the data.<br />

You’ll find that you sacrifice the raw speed of the partition operation, but with the associated<br />

window of unavailability immediately afterward as you rebuild indexes, for a slower overall<br />

response time from the partition operation but coupled with 100 percent data availability. In<br />

short, if you have a data warehouse that cannot have downtime, but must support these common<br />

data warehouse techniques of sliding data in <strong>and</strong> out, then this feature is for you—but<br />

you must underst<strong>and</strong> the implications.<br />

Revisiting our previous example, if our partition operations had used the UPDATE GLOBAL<br />

INDEXES clause when relevant (in this example, it would not be needed on the ADD PARTITION<br />

statement since the newly added partition would not have any rows in it),<br />

ops$tkyte@ORA10G> alter table partitioned<br />

2 exchange partition fy_2004<br />

3 with table fy_2004<br />

4 including indexes<br />

5 without validation<br />

6 UPDATE GLOBAL INDEXES<br />

7 /<br />

Table altered.<br />

ops$tkyte@ORA10G> alter table partitioned<br />

2 drop partition fy_2004<br />

3 UPDATE GLOBAL INDEXES<br />

4 /<br />

Table altered.<br />

ops$tkyte@ORA10G> alter table partitioned<br />

2 add partition fy_2006<br />

3 values less than ( to_date('01-jan-2007','dd-mon-yyyy') )<br />

4 /<br />

Table altered.<br />

ops$tkyte@ORA10G> alter table partitioned<br />

2 exchange partition fy_2006<br />

3 with table fy_2006<br />

4 including indexes

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

Saved successfully!

Ooh no, something went wrong!