Oracle index compression

You can set the index-compression attribute of the <ora-compression> and <ora-index-ddl> elements to true or false.

An index-compression value of true specifies:

  • Compression for all columns but the last for unique indexes
  • Compression for all columns for non-unique indexes

Depending on which element you set, you can override compression for all indexes in a database, for all indexes on a specific table, or for specific indexes.

  • You can override compression options for all indexes in a database by specifying the index-compression attribute of the <ora-compression> element. For general syntax, see the example in the preceding topic, Oracle database compression.
  • You can override compression options for all indexes on a specific table by including the index-compression attribute on the <ora-table-compression> element. For example:
    <database>
      ...
      <upgrade>
        <ora-db-ddl>
          <ora-table-ddl table-name="pc_tableName">
            <ora-table-compression index-compression="true|false" />
          </ora-table-ddl>
        </ora-db-ddl>
      </upgrade>
    </database>
  • You can override options for a specific index by adding an <ora-index-ddl> element within the <ora-table-ddl> element for the table that has the index. For example:
    <database>
      ...
      <upgrade>
        <ora-db-ddl>
          <ora-table-ddl table-name="pc_tableName">
            <ora-index-ddl index-compression="true|false" key-columns="column1,column2" />
          </ora-table-ddl>
        </ora-db-ddl>
      </upgrade>
    </database>

    Specify an index by setting the key-columns attribute of the <ora-index-ddl> element to a comma-delimited list of key columns in order. Specify DESC after a column name for descending sort order on that column.

The following example specifies the following overrides:

  • Index compression for the entire database
  • No compression for the pc_Activity index that contains key columns PublicID and Retired in key positions one and two, respectively.
  • No compression for any indexes on the pc_Workflow table.
    <database>
      ...
      <upgrade>
        <ora-db-ddl>
          <ora-compression index-compression="true">
          <ora-table-ddl table-name="xx_Activity">
            <ora-index-ddl key-columns="PublicID,Retired" index-compression="false" />
          </ora-table-ddl>
          <ora-table-ddl table-name="xx_Workflow">
            <ora-table-compression index-compression="false" />
          </ora-table-ddl>
        </ora-db-ddl>
      </upgrade>
    </database>
Important: Oracle spatial indexes are not compressible. If you use the key-columns attribute to specify a spatial index to compress, PolicyCenter reports an error. If the index is implied to be compressed by the compression configuration of the database or table, PolicyCenter ignores the compression setting for a spatial index.

See also