Blog - comments

I wish someone would demonstrate how they generated the graphs - seems to be a well-kept secret

tim carroll
Thank you for the very informative post. I've been researching why our DB generates so much redo at...
Gary F.

Hi Arnaud,

Can I hav english version of these document.

Rgds

Raffi

Mohammed Raffi
You may check also Valentina Studio 5.x: http://www.valentina-db.com/valentina-studio-overviewit ...
ahmad
Thanks a lot Pierre. This covers everything that would be necessary to upgrade the Enterprise Manage...
Seth with Firebox
Blog Pierre Sicot Oracle index compression: eliminating duplicate column values

dbi services Blog

Welcome to the dbi services Blog! This blog focuses on IT infrastructure - featuring news, troubleshooting, and tips & tricks. It covers database, middleware, and OS technologies such as Oracle, Microsoft SQL Server, Documentum, MySQL, PostgreSQL, Sybase, Unix/Linux, etc. The dbi services blog represents the view of our consultants, not necessarily that of dbi services. Feel free to comment on the postings!

  • Home
    Home This is where you can find all the blog posts throughout the site.
  • Categories
    Categories Displays a list of categories from this blog.
  • Tags
    Tags Displays a list of tags that has been used in the blog.
  • Bloggers
    Bloggers Search for your favorite blogger from this site.

Oracle index compression: eliminating duplicate column values

Index compression comes from Oracle 8i and has quite the same mechanism as table compression. Index compression eliminates duplicate column values in the leaf blocks. Let's see how it works:

We start by creating an index on an uncompressed table:

 

SQL> create index nocomp_i1 on nocomp (object_name,object_id);

Index created.

 

Let's have a look at how many leaf blocks the newly created index has:

 

SQL> select leaf_blocks from user_indexes where index_name = 'NOCOMP_I1'; 

LEAF_BLOCKS

        407

 

If you want to estimate the ideal compression factor and the percentage of leaf blocks that can be saved, you need to consult INDEX_STATS view after validating the newly created index (watch out, this will lock the index):

 

SQL> validate index nocomp_i1; 

Index analyzed. 

SQL> select opt_cmpr_count,opt_cmpr_pctsave from index_stats; 

OPT_CMPR_COUNT OPT_CMPR_PCTSAVE

-------------- ----------------

             1               15

 

"opt_cmpr_count" = number of columns to compress in the index to get maximum space savings in the leaf blocks. 

"opt_cmpr_pctsave" = percentage reduction in leaf block space used if we apply this compression count.

 

The previous result shows that the ideal compression factor is 1 and will reduce the number of leaf blocks by 15 %.

 

SQL> alter index nocomp_i1 rebuild compress 1; 

Index altered.

 

SQL> select leaf_blocks from user_indexes where index_name = 'NOCOMP_I1'; 

LEAF_BLOCKS

        345

 

The result is correct : 407 * 15 % = 61 and 407-61 = 346!

 

If we now validate the index again, we can verify that the compression factor of 1 is fine and no leaf blocks can be eliminated anymore:

 

SQL> validate index nocomp_i1;  Index analyzed.

 

SQL> select opt_cmpr_count,opt_cmpr_pctsave from index_stats; 

OPT_CMPR_COUNT OPT_CMPR_PCTSAVE

-------------- ----------------

             1                0

Rate this blog entry:
1

Pierre Sicot is Senior Consultant at dbi services. He has more than fifteen years of experience in Oracle database administration, engineering, and optimization. His specialty is the installation, migration, optimization, and security of Oracle databases in production environments. Prior to joining dbi services, Pierre was consultant at Trivadis in Lausanne. He also worked at ilem Group as a database administrator and also as a Consultant for different customers. Pierre holds a engineering diploma of ESME Sudria in France. His branch-related experience covers Energy, Banking, Public Administration, etc.

Comments

  • No comments made yet. Be the first to submit a comment

Leave your comment

Guest Friday, 24 May 2013
AddThis Social Bookmark Button