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 11 ■ INDEXES 427<br />

We then create an IDX_STATS table in which to save INDEX_STATS information, <strong>and</strong> we label<br />

the rows in the table as “noncompressed”:<br />

ops$tkyte@ORA10G> create table idx_stats<br />

2 as<br />

3 select 'noncompressed' what, a.*<br />

4 from index_stats a;<br />

Table created.<br />

Now, we could realize that the OWNER component is repeated many times, meaning that a<br />

single index block in this index will have dozens of entries, as shown in Figure 11-2.<br />

Figure 11-2. Index block with OWNER column repeated<br />

We could factor the repeated OWNER column out of this, resulting in a block that looks<br />

more like Figure 11-3.<br />

Figure 11-3. Index block with OWNER column factored out<br />

In Figure 11-3, the owner name appears once on the leaf block—not once per repeated<br />

entry. We run the following script, passing in the number 1, to re-create the scenario whereby<br />

the index is using compression on just the leading column:<br />

drop index t_idx;<br />

create index t_idx on<br />

t(owner,object_type,object_name)<br />

compress &1;

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

Saved successfully!

Ooh no, something went wrong!