sizes of compressed index (unique vs. non-unique)

Hello

I wonder if anyone can shed any light on what is happening internally in an index which explains the behavior I see when you do the compression tests. It's all about 11.2.0.3.8 on SLES11.

I have a simple table with about 12 columns, the initial size is 48 GB, I have that compress with compression OLTP and it comes down to 18 GB - that everything is perfect

The table has 4 clues in this respect everything I can rebuild with the option 'compress' (i.e. just old style compression - there is no advanced for the index compression) - and I see a strange behavior. I took just a hint an example here:

It's the creation command to original index - which creates an index of 14 GB

CREATE INDEXES 'RESET_INDEX' ON 'RESET' ('INS_NUM', 'PARAM_SEQ_NUM', 'PARAM_RESET_HEADER_SEQ_NUM', 'RESET_SEQ_NUM');

If I run the present

CREATE INDEXES 'RESET_INDEX' ON THE COMPRESS OF 'RESET' ('PARAM_SEQ_NUM', 'PARAM_RESET_HEADER_SEQ_NUM', 'INS_NUM', 'RESET_SEQ_NUM');

In fact, the index grows - it becomes 18 GB (because of the many column values that are only 1 or 0 according to me that end by expands when compression is enabled)

However - and this is the bit that confuses me

CREATE AN INDEX UNIQUE 'RESET_INDEX' ON THE COMPRESS OF 'RESET' ('PARAM_SEQ_NUM', 'PARAM_RESET_HEADER_SEQ_NUM', 'INS_NUM', 'RESET_SEQ_NUM');

By adding the 'unique' keyword, index is massively more small-, now only 8 GB!

What is happening here - when an index is unique fact that somehow ID stored inside it must also be compressed where, in a non-unique index, this is not possible?

Which seems very strange - but the question - if I add a surrogate key column to a table and add it to all my index finger and make it unique as all my index finger will then get more small when compressed...?

See you soon,.

Rich

The response of a Word is not.

The explanation lies in what happens in the article published in the 2 'compress' on the unique index producing an error.

For an index not unique 'compress' with no count of column means 'compress n', where n is the number of columns in the index. for an index unique 'compress' means "compress n - 1".

Your "change to single" index gets smaller on the compression, because it shows duplicates on the first 3 columns (of 4).

Concerning

Jonathan Lewis

Tags: Database

Similar Questions

  • Change the size of compression to ASO will do my Calc MDX results change?

    Merry Christmas / Happy Holidays!

    Change the size of compression to ASO will do my Calc MDX results change?

    Our EAS reported this: our dimension of reduction measures to the switching times will be half of our data file size.  Has anyone turn their dimensions of compression?  What are the problems that you have experienced?

    Thank you for the early Christmas present (with answers).

    This is not a duplicate, but it's largely the same question that a dynamic dimension to ASO stored passing Will do my Calc MDX results change?

    This is because the size of compression must be dynamic, so if you select a dimension that is currently stored in the size of the compression, it will be converted to dynamic.

    If you change the size of the compression of an already dynamic dimension, it has certainly no effect.

  • ORA-1683 cannot extend index - and too many size of the Index.

    Hello

    I took "ORA-1683: impossible to extend the index TS001." Partition TEMP_PK P20110925 of 64 in the TS001_TEMP_I_ tablespace 'in the alert.log. You can find system information on below;
    Size of the index = 140 GB (it's too big, I am open to any suggestion for the reduction of the size).
    Table size = 600 GB
    OS disk percentage is 85% usage.

    Thus, our performance very slowly. How can I solve our problems?


    Thank you...

    perhaps already reached TS001_temp_index.dbf can use max, you check?

    Select file_name, bytes/1024/1024, user_bytes/1024/1024, maxbytes/1024 CanGrow in dba_temp_files;

  • Index unique creation implicit or explicit?

    I read Steve O'hearn 1zo - 047 manual p.404 he mentions:

    A unique index is the one who makes sure that a column in a table will contain unique

    information. The syntax to create a unique index is:

    CREATE A UNIQUE IX_EMP_SSN ON EMPLOYEES (SSN) INDEX;

    This is different from the UNIQUE constraint that you can apply to a column on

    a table. However, note that if you create a PRIMARY KEY or UNIQUE constraint

    on a table, a unique index will be created automatically with the constraint.

    Note that the UNIQUE constraint is more auto-documentent be in the database.

    However, Oracle Corporation recommends that officially single

    index to enforce the uniqueness in a column, for best results in the performance of the queries.

    OK, so the area in bold has me a little confused.  Is it saying that the Unique constraint index are more oriented for thin self-documentation so that we should create the Unique Index explicitly?

    Or is it simply that because the UK/PK document constraints because mentioning if it is recommended to create these constraints/index.

    Sorry for what may seem like a vague question, I did have the chance to work on the optimization of the indexes, or I would be able to return effectively this task at this time, so I thought I would ask for advice on the forums...

    Thank you.

    It is difficult to comment on the intention of the author.

    But note:

    1. a unique constraint by default creates a unique index if a suitable index does not exist already.

    2. a unique constraint can be monitored through a non-unique index if needed/wanted

    3. a unique constraint or primary key is required if the creation of a foreign key.

    4. If the index is created implicitly and you remove the constraint of the index is also deleted.

    5. If the index is created explicitly and you remove the constraint of the index remains.

    6. If you want a constraint can be delayed, then you will need a unique constraint and a non-unique index.

    7. you can use a unique index with an expression to apply conditional oneness.

    The constraint is certainly better than just a unique index self-documentation - I definitely see developer get confused when uniqueness is violated and that they get an error and they do not find a corresponding constraint.

  • How to restore the image to the original size after compression of the file

    Compress the picture settings

    I compressed several photos from the emails and now when I open my photos on my computer, they are blurry - how do they return to the original? Do I have to change the size of the file? How can I change the size of the file (e-mail) to the documents? Any help would be appreciated...

    I compressed several photos from the emails and now when I open my photos on my computer, they are blurry - how do they return to the original? Do I have to change the size of the file? How can I change the size of the file (e-mail) to the documents? Any help would be appreciated...

    ===================================
    How_exactly_did you compress the files and are as follows
    your original files or copies?

    If the original files were crushed with the bass
    compressed resolution version that they are non-recoverable.

    Volunteer - MS - MVP - Digital Media Experience J - Notice_This is not tech support_I'm volunteer - Solutions that work for me may not work for you - * proceed at your own risk *.

  • Size of the index

    Hello

    Can someone help me find the size of the 100 superior of a user table, if the table has INDEXES, I need to know the index as well.

    TableName, Table_Size Index_size, Index_Name, Index_status for a user.

    Kind regards
    NGO.

    NGO says:
    Grosbois excellent...
    He was very helpful. This query, producing an output exactly as will answer that I am...
    Thank you very much...

    You are welcome. Please mark appropriate as correct/useful messages and the thread as closed. Thank you

    Concerning

    Grosbois

  • Size of the ViewObject extraction with non-oracle flavor?

    Hello

    I played with the fetch size / mode settings and I have noticed that SQL92 Builder seems to ignore the fetch size.
    When I run my page with the FETCH_AS_NEEDED recovery mode and the size of 1 and Builder of the Oracle, I get an extraction for each line. When I switch to SQL92 apparently fetch size is 10 and there is nothing I can do about that parameters are ignored.

    With the generator of the Oracle TKProf
    select *
    from
     order_items
    
    
    call     count       cpu    elapsed       disk      query    current        rows
    ------- ------  -------- ---------- ---------- ---------- ----------  ----------
    Parse        1      0.00       0.00          0          0          0           0
    Execute      1      0.00       0.00          0          0          0           0
    Fetch       98      0.01       0.00          0        102          0          97
    ------- ------  -------- ---------- ---------- ---------- ----------  ----------
    total      100      0.01       0.00          0        102          0          97
    TKProf SQL92 Builder
    call     count       cpu    elapsed       disk      query    current        rows
    ------- ------  -------- ---------- ---------- ---------- ----------  ----------
    Parse        1      0.00       0.00          0          0          0           0
    Execute      1      0.00       0.00          0          0          0           0
    Fetch       10      0.00       0.00          0         16          0          97
    ------- ------  -------- ---------- ---------- ---------- ----------  ----------
    total       12      0.00       0.00          0         16          0          97
    Is this documented somewhere? So far I've found nothing on the subject.
    What happens with the other databases?

    Edit: it seems to fetch size is ignored for MS sql server. All rows are retrieved and cached from what I can tell.

    Hello

    I think that it is not supported for the non-oracle flavor:
    http://www.Oracle.com/technetwork/developer-tools/jdev/multidatabaseapp-085183.html

    concerning
    Peter

  • Can merge increase in size of the index?

    Hello
    I'm trying to understand how changes in the use of space after coalesce an index.
    I use Tom Kyte show_space procedure.
    DB is 9.2.0.8.
    before Coalesce:
    Unformatted Blocks .....................               0
    FS1 Blocks (0-25)  .....................               0
    FS2 Blocks (25-50) .....................           1,811
    FS3 Blocks (50-75) .....................               0
    FS4 Blocks (75-100).....................               0
    Full Blocks        .....................           2,969
    Total Blocks............................           4,864
    Total Bytes.............................      39,845,888
    Total MBytes............................              38
    Unused Blocks...........................               0
    Unused Bytes............................               0
    Last Used Ext FileId....................             149
    Last Used Ext BlockId...................       2,979,081
    Last Used Block.........................             128
     
     
    After Coalesce
    Unformatted Blocks .....................               0
    FS1 Blocks (0-25)  .....................               0
    FS2 Blocks (25-50) .....................           4,142
    FS3 Blocks (50-75) .....................               0
    FS4 Blocks (75-100).....................               0
    Full Blocks        .....................             638
    Total Blocks............................           4,864
    Total Bytes.............................      39,845,888
    Total MBytes............................              38
    Unused Blocks...........................               0
    Unused Bytes............................               0
    Last Used Ext FileId....................             149
    Last Used Ext BlockId...................       2,979,081
    Last Used Block.........................             128
    Look like only two values changed:
    before:
    FS2 Blocks (25-50)... 1 811

    After:
    FS2 Blocks (25-50)... 4 142

    front
    Complete blocks... 2 969

    After:
    Complete blocks... 638

    So, we've got several blocks 25-50% free space
    and less complete blocks.
    And it's strange, how we can have less complete blocks after merger?

    Second question is there a reason my index may grow after the merger, when that would happen?

    Please explain :).
    Concerning
    GregG

    You can also read http://richardfoote.wordpress.com/2008/02/08/index-rebuild-vs-coalesce-vs-shrink-space-pigs-3-different-ones/

    Concerning
    Karan

  • Unique and non-unique indexes


    Hello

    I have a unique index associated with no doubt. Unique and not unique indexes are used B tree architecture. But I want to know if I create a non-unique index on a column that contains unique data.

    When I query this table using this column, it scans each sheet or times found that value it scan stops and give us the result?

    00125 wrote:

    In a non-unique index, scans all the leaves... so what's the difference between full table scan and index ull. I went through a few articles they mentioned that a non-unique index to check with rowid. How she treated? I have clear knowledge in it.

    Please help me with this.

    Thanks in advance

    If you go through architecture index B-tree you could easily understand how indexing works. The picture here shows how a look of column datatype NUMBER indexed as / stored internally. You can imagine that your indexed column TST_COLA this will look like in the internal process. In the B-tree indexes, you have 3 main structures 1. 2 root. Branch 3. Leaves and the database retrieves lines by browsing through the root of index-> branch-> leaves. If the photo if we wanted to retrieve the row whose value indexed column = 25. First data goes to the root and finds that plugs is set to 25, then he Stoops to this particular branch of find what block sheet retains the value 25. More far away after finding the leaves block then goes to this block of sheets and research the special value of 25.

    If the index is UNIQUE, the database knows that there must be only one value, where it performs INDEX UNIQUE SCAN. If the index is NOT UNIQUE it should check all values in this block of leaves to find who all are 25 - in this case INDEX RANGE SCAN is done - as you must check not only value, but all values in this block of sheets - given that the values are not unique. As you can see it that the sheet block contains the long side of the value of the column ROWID, using this database rowid, then goes to the table to retrieve that particular line.

    Full table scan is a method of access where the database just to access the table directly (bypassing index structure) and analyze the ENTIRE table to satisfy the request.

  • UNIQUE compared to a NON-UNIQUE INDEX

    Hello SQL gurus.

    Can you tell me the difference between UNIQUE and NON-UNIQUE index?

    Thank you
    Dave

    The fact that a UNIQUE index will not allow duplicate values in the columns in Index key so that NO SINGLE index will allow duplicates.

    If I CREATE an INDEX UNIQUE MY_TABLE_UK ON MY_TABLE (NAME_COLUMN);

    I can't insert the value "HEMANT" twice in the NAME_COLUMN.

    If I CREATE INDEX MY_TABLE_IDX ON MY_TABLE (NAME_COLUMN);

    I can "HEMANT" insert multiple lines.

    NOTE: If I insert NULL values, a UNIQUE INDEX will allow several NULL values as, by definition "NULL! = NULL ". However, a definition of primary key does not allow nulls.

  • Why choose wrong explain plan when there is a unique index

    SQL > create table test in select * from dba_objects;

    Table created.

    SQL > create table test1 in select * from user_objects;

    Table created.

    SQL > create index unique i_test_1 on test (object_id);

    The index is created.

    SQL > exec dbms_stats.gather_table_stats (user, 'TEST');

    PL/SQL procedure successfully completed.

    SQL > exec dbms_stats.gather_table_stats (user, 'TEST1');

    PL/SQL procedure successfully completed.

    SQL > set autot trace
    SQL > select test1.* from test, test1 where test.object_id = test1.object_id;

    23037 selected lines.


    Execution plan
    ----------------------------------------------------------
    Hash value of plan: 3995284093

    -------------------------------------------------------------------------------
    | ID | Operation | Name | Lines | Bytes | Cost (% CPU). Time |
    -------------------------------------------------------------------------------
    | 0 | SELECT STATEMENT | 23038 | 2114K | 77 (12) | 00:00:01 |
    | 1. NESTED LOOPS | 23038 | 2114K | 77 (12) | 00:00:01 |
    | 2. TABLE ACCESS FULL | TEST1 | 23038 | 2002K | 70 (3) | 00:00:01 |
    |* 3 | INDEX UNIQUE SCAN | I_TEST_1 | 1. 5. 0 (0) | 00:00:01 |
    -------------------------------------------------------------------------------

    Information of predicates (identified by the operation identity card):
    ---------------------------------------------------

    3 - access("TEST".") OBJECT_ID '= 'TEST1'.' OBJECT_ID')


    Statistics
    ----------------------------------------------------------
    494 recursive calls
    0 db block Gets
    26457 consistent gets
    0 physical reads
    0 redo size
    1090589 bytes sent via SQL * Net to client
    17270 bytes received via SQL * Net from client
    1537 SQL * Net back and forth to and from the client
    5 kinds (memory)
    0 sorts (disk)
    23037 rows processed


    SQL > drop index i_test_1;

    The index is deleted.

    SQL > create index i_test_1 on test (object_id);

    The index is created.

    SQL > set autot trace
    SQL > select test1.* from test, test1 where test.object_id = test1.object_id;

    23037 selected lines.


    Execution plan
    ----------------------------------------------------------
    Hash value of plan: 845425162

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

    | ID | Operation | Name | Lines | Bytes | Cost (% CPU). Time
    |

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

    | 0 | SELECT STATEMENT | 23038 | 2114K | 99 (6) | 00:00:02
    |

    |* 1 | HASH JOIN | 23038 | 2114K | 99 (6) | 00:00:02
    |

    | 2. FULL RESTRICTED INDEX SCAN FAST | I_TEST_1 | 49887 | 243K | 27 (4) | 00:00:01
    |

    | 3. TABLE ACCESS FULL | TEST1 | 23038 | 2002K | 70 (3) | 00:00:01
    |

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


    Information of predicates (identified by the operation identity card):
    ---------------------------------------------------

    1 - access("TEST".") OBJECT_ID '= 'TEST1'.' OBJECT_ID')


    Statistics
    ----------------------------------------------------------
    1 recursive calls
    0 db block Gets
    1936 complies
    411 physical reads
    0 redo size
    1090589 bytes sent via SQL * Net to client
    17270 bytes received via SQL * Net from client
    1537 SQL * Net back and forth to and from the client
    0 sorts (memory)
    0 sorts (disk)
    23037 rows processed

    I think the hash join is the real plan, why choose nest loop where there is a unique index.

    Jinyu wrote:
    I think that thought cbo cost single scan index is 0, so loop nest is less expensive than the hash join, but I do not know why here costs 0

    Jinyu,

    You are right - in a nested loop, the CBO gives unique access by unique index value slightly cheaper than the same access by a non-unique index--essentially subtracting 1 of the normal cost.

    It is one of the reasons why you only need to create a no unique index to support a unique constraint, if you have a very good reason - if you modify a unique index that is not unique, change of costs and execution of some paths may change.

    Concerning
    Jonathan Lewis

  • Name of the PK, unique constraints and to support the index

    I want to have my primary key constraint and index support share of the same name, IE:
    CREATE UNIQUE INDEX MYTABLE_PK ON MYTABLE(...);
    ALTER TABLE MYTABLE ADD CONSTRAINT MYTABLE_PK PRIMARY KEY(...);
    Without definition explicit a unique index using the relational model, the generated DDL added 'X' for the name of the index:
    CREATE UNIQUE INDEX MYTABLE_PKX ON MYTABLE(...);
    ALTER TABLE MYTABLE ADD CONSTRAINT MYTABLE_PK PRIMARY KEY(...);
    I tried to add an index unique explicit to the table, but he changed the name (adds "v1") when I leave the table editor:
    CREATE UNIQUE INDEX MYTABLE_PKv1 ON MYTABLE(...);
    ALTER TABLE MYTABLE ADD CONSTRAINT MYTABLE_PK PRIMARY KEY(...);
    I have the same problem with index & unique constraints.

    Issues related to the:
    Can I generate DDL with name matching? "v1" thing seems unlikely, he doesn't want not myself save the definition as I want.
    Where are the transformations of naming for this location? I found tools, preferences, and Data Modeling/naming Standards/Templates but this nugget does nto seem to be there.

    Thank you.

    Hi Mike,.

    The Production data release model 3.1 has been updated to allow constraints unique and primary and their indexes share the same name.

    David

  • Additional logging on unique indexes

    Hello
    I enabled logging on a unique index on an extra table...
    Table emp (id number, name varchar2 (20), varchar2 (20)) of the grid;

    create an index unique emp_id on emp (id, name);

    change the emp table add extra newspaper group emp_supp (id, name);

    Now if I update the column in the grid for a record will it produce data of additional journal for the unique index columns?

    Hello

    Yes, he does.
    refer to the doc: http://download.oracle.com/docs/cd/B13789_01/server.101/b10823/create_ls.htm

    -Pavan Kumar N

  • unique index on two columns

    Hi all
    I want a unique index on two columns, but when I try this it will show me
      1  CREATE UNIQUE INDEX sale_order_no
      2*   ON sale_order (sale_order_no, season_year)
    SQL> /
      ON sale_order (sale_order_no, season_year)
         *
    ERROR at line 2:
    ORA-01452: cannot CREATE UNIQUE INDEX; duplicate keys found
    I want to do not overlap with the combination of these two

    Plaese Guide
    Thanks and greetings
    Vikas

    You would this behavior if SALE_ORDER_NO has NULL values. If it contains NULL values, a unique single-column index will succeed but an index unique multi-column will fail when it finds duplicates in SEASON_YEAR.

    See:

    SQL> create table dummy_objects (object_id  number, object_owner varchar2(30), object_name varchar2(30));
    
    Table created.
    
    SQL> insert into dummy_objects values (0,'HEMANT','TABLE_A');
    
    1 row created.
    
    SQL> insert into dummy_objects values (1,'HEMANT','TABLE_B');
    
    1 row created.
    
    SQL> insert into dummy_objects values (NULL,'HEMANT','NULL_1');
    
    1 row created.
    
    SQL> insert into dummy_objects values (NULL,'HEMANT','NULL_2');
    
    1 row created.
    
    SQL> create unique index dummy_objects_u1 on dummy_objects(object_id);
    
    Index created.
    
    SQL> drop index dummy_objects_u1;
    
    Index dropped.
    
    SQL> create unique index dummy_objects_u2 on dummy_objects(object_id, object_owner);
    create unique index dummy_objects_u2 on dummy_objects(object_id, object_owner)
                                            *
    ERROR at line 1:
    ORA-01452: cannot CREATE UNIQUE INDEX; duplicate keys found
    
    SQL>
    

    Hemant K Collette
    http://hemantoracledba.blogspot.com

  • Two columns must be UNIQUE if the second is not NULL.

    Two columns must be UNIQUE if the second is not NULL. If the second is NULL, the first has no need to be UNIQUE.

    CREATE TABLE Moo
    (
    Prima        INT PRIMARY KEY,
    Secunda    INT NOT NULL,
    Tertia        VARCHAR2(1)
    );
    
    CREATE UNIQUE INDEX Cow ON Moo(Secunda, NVL(Tertia, TO_CHAR(Prima)));
    
    INSERT INTO Moo(Prima, Secunda, Tertia)
    SELECT 1, 1, NULL FROM Dual UNION ALL
    SELECT 2, 1, NULL FROM Dual;
    
    DROP TABLE Moo;
    
    

    Is there another way to do it?

    Added 'SINGLE '.

    I had a little trouble at matches your description to your example, but if you want to apply the uniqueness on (secunda, tertia) only for lines where tertia is not null, then the following should work:

    create an index unique xxx on moo)

    cases when is not null, then end of secunda, tertia

    Tertia

    );

    Concerning

    Jonathan Lewis

    P.S. When do a quick test of the best way to define this index, I found what seems to be a bug in 11.2.0.4 (and maybe other versions) with the expression:

    Tertia case if no then cast (null as an int) to another end secunda

    Update: now blog at: Easy & #8211; Oops. | Notebook of the Oracle

Maybe you are looking for

  • Migration of all files to new Mac

    I will receive a 2015 iMac refurb. My current computer is a Mac Pro 2009. Two Macs will have installed El Capitan. I have a Time Machine backup and a Superduper clone available on external drives. When I launch the new iMac, I'll copy all the files t

  • Upgrade memory to the end of 2011 MBP

    Please can someone advise what is the maximum memory possible for a MBP (late 2011 model) 17IN.  Thank you

  • HP compaq 8200 elite sff: Add the second hard drive to 8200 elite sff

    I installed a second hard drive, but the system does not reqagnize it.  I connected the blue sata port.  Any help?

  • Satellite L300-1AQ - how much of the necessary recovery discs?

    Dear all I would like to know how many drives recovery requires my laptop L300-1AQ (model number PSLB8E). I have a disc I made when I bought the computer but I can't start using up to this I make sure that only the disk is necessary (if more than one

  • Problem with keyboard on Satellite L500-128

    Hi all I'm having some problems with the keyboard on my Satellite L500-128 - essentially; 8, 9, i, o, k, l and comma and period keys do not work. All other keys are working perfectly fine (I use an external keyboard if people wonder!) I'm technically