Exadata Hybrid Columnar Compression (HCC): How It Works
Exadata Hybrid Columnar Compression (HCC): How It Works
Introduction
Data storage and compression play an important role in Oracle Database performance, especially when organizations manage large volumes of business data. As databases grow, storing and accessing data efficiently becomes a major challenge for Database Administrators (DBAs).
Oracle provides several compression technologies to reduce storage consumption and improve database efficiency. One of the most powerful technologies is Hybrid Columnar Compression (HCC).
Hybrid Columnar Compression is an advanced data compression technology designed to achieve significantly higher compression ratios, particularly for large databases, data warehouses, and historical data.
HCC is widely associated with Oracle Exadata and other supported Oracle storage platforms. It combines the benefits of row-based and column-based storage techniques to reduce storage requirements while maintaining efficient database access.
In this blog, we will explore what HCC is, how it works internally, its architecture, compression methods, advantages, limitations, and how DBAs can implement and monitor it.
What Is Hybrid Columnar Compression (HCC)?
Hybrid Columnar Compression (HCC) is an Oracle Database compression technology that stores data in a hybrid format combining row-based and column-based organization.
In traditional row-based storage, Oracle stores all column values belonging to a particular row together. However, many analytical workloads frequently access only a few columns from a large table.
HCC addresses this requirement by organizing data into Compression Units (CUs).
A Compression Unit is a logical storage structure containing multiple rows organized into column groups. Instead of storing complete rows together, Oracle groups similar column values together and compresses them.
This approach provides better compression because similar data values are stored together, making it easier to identify repeating patterns.
Example:
Consider an employee table:
| EMP_ID | EMP_NAME | DEPARTMENT | LOCATION |
|---|---|---|---|
| 101 | Amit | IT | Pune |
| 102 | Rahul | IT | Pune |
| 103 | Sneha | HR | Mumbai |
| 104 | Priya | IT | Pune |
In traditional row-based storage, each employee’s complete record is stored together.
With HCC, Oracle organizes values by column within a Compression Unit. Repeated values such as IT and Pune can be compressed more efficiently.
This reduces the amount of physical storage required.
Why Does Oracle Introduce HCC?
Traditional compression techniques are useful, but large enterprise databases often require higher compression ratios.
Consider an organization maintaining several years of transaction history, financial records, customer information, and reporting data.
Over time, these tables can grow to hundreds of gigabytes or even terabytes.
Without effective compression, organizations may face:
-
Increased storage consumption.
-
Higher storage infrastructure costs.
-
Longer backup and recovery operations.
-
Increased I/O requirements.
-
Challenges managing historical data.
-
Additional storage capacity requirements.
Oracle introduced Hybrid Columnar Compression to address these challenges by providing advanced compression capabilities for suitable workloads.
HCC is particularly beneficial for data warehouse environments, historical records, and tables that are frequently queried but rarely modified.
How Does HCC Work Internally?
Understanding the internal working of HCC is important for Oracle DBAs, especially when managing large tables on Exadata.
HCC works through a combination of column-based organization, compression algorithms, and Compression Units.
Let’s understand the process step by step.
Step 1: Data Loading
When data is loaded into an HCC-enabled table, Oracle collects multiple rows and organizes them into a Compression Unit.
HCC achieves its highest compression levels through direct-path loading operations.
Examples include:
-
Direct-path INSERT.
-
SQL*Loader direct path.
-
CREATE TABLE AS SELECT (CTAS).
-
INSERT /*+ APPEND */.
These operations allow Oracle to organize data efficiently before compressing it.
Step 2: Column-Based Organization
After collecting rows, Oracle reorganizes the data based on individual columns.
For example, consider the following employee records:
| EMP_ID | DEPARTMENT | LOCATION |
|---|---|---|
| 101 | IT | Pune |
| 102 | IT | Pune |
| 103 | HR | Mumbai |
| 104 | IT | Pune |
Instead of keeping all values together row by row, HCC organizes the values belonging to each column together within a Compression Unit.
This makes repeated values easier to identify.
Step 3: Data Compression
Once the column values are organized, Oracle applies suitable compression algorithms.
The compression process considers factors such as:
-
Column data types.
-
Repeated values.
-
Data cardinality.
-
Selected compression level.
-
Data patterns.
For example, if a column contains the same department name thousands of times, Oracle can represent repeated values more efficiently rather than storing the complete value repeatedly.
This significantly reduces the amount of storage required.
Step 4: Creating Compression Units
After compression, Oracle stores the compressed column data inside a logical structure called a Compression Unit.
A Compression Unit can span multiple Oracle data blocks.
Each Compression Unit contains a set of rows, and the column values for those rows are organized and compressed together.
An important point is that each row remains logically accessible to Oracle Database, even though its physical representation is column-oriented.
Step 5: Query Execution
When a user executes a SELECT statement against an HCC-enabled table, Oracle Database transparently accesses the compressed data.
On Exadata, Smart Scan can offload eligible query processing to the Exadata Storage Servers.
This allows storage servers to perform operations such as filtering and column projection, reducing unnecessary data transfer to database servers.
Exadata can also use its storage processing capabilities to decompress HCC data efficiently.
As a result, analytical queries can benefit from reduced physical I/O and less data movement between storage and database servers.
Oracle’s Exadata architecture is designed to take advantage of these capabilities.
Oracle Documentation+1
Understanding Compression Units (CUs)
Compression Units are the foundation of Hybrid Columnar Compression.
Unlike traditional row-based storage, where individual rows are organized together, HCC groups multiple rows into a single logical compression structure.
Consider a table containing 10,000 sales records.
Without HCC, Oracle stores the records using its conventional row-based format.
With HCC:
-
Oracle collects a group of rows.
-
Column values are organized together.
-
Repeated values are identified.
-
Compression algorithms are applied.
-
Compressed data is stored in a Compression Unit.
-
Multiple Compression Units make up the compressed table data.
Important points about Compression Units:
-
A Compression Unit can contain multiple rows.
-
Column values are compressed together.
-
A Compression Unit can span multiple Oracle data blocks.
-
A single row can span multiple blocks physically.
-
Oracle manages access to the compressed data transparently.
-
DML operations can have different locking and rowid implications compared with conventional row storage.
This architecture makes HCC particularly effective for large analytical tables.
Oracle Documentation+1
Types of Hybrid Columnar Compression
Oracle provides four main HCC compression options.
These options are divided into two major categories:
-
Warehouse Compression (Query Compression).
-
Archive Compression.
Each category provides LOW and HIGH compression levels.
Query Low Compression
Query Low is designed for data warehouse workloads where query performance and loading speed are important.
Characteristics:
-
Provides good compression.
-
Requires comparatively less compression processing than Query High.
-
Suitable for frequently queried analytical data.
-
Offers faster data loading than Query High in typical scenarios.
Example:
CREATE TABLE sales_query_low
COMPRESS FOR QUERY LOW
AS
SELECT * FROM sales;
Query High Compression
Query High is designed for analytical workloads that require higher storage savings.
Characteristics:
-
Provides higher compression than Query Low in typical scenarios.
-
Suitable for large data warehouse tables.
-
Reduces physical storage requirements.
-
Helps reduce the amount of data read during eligible full scans.
-
Can require more CPU and loading time.
Example:
CREATE TABLE sales_query_high
COMPRESS FOR QUERY HIGH
AS
SELECT * FROM sales;
Archive Low Compression
Archive Low is designed for historical data that is accessed occasionally but must remain available online.
Characteristics:
-
Provides high compression.
-
Suitable for historical records.
-
Reduces storage consumption.
-
Appropriate for infrequently modified data.
Example:
CREATE TABLE sales_archive_low
COMPRESS FOR ARCHIVE LOW
AS
SELECT * FROM sales;
Archive High Compression
Archive High is designed for data that is rarely accessed and requires maximum storage savings.
Characteristics:
-
Provides the highest compression level among the four HCC options in typical scenarios.
-
Suitable for long-term historical data.
-
Reduces storage requirements significantly.
-
Can introduce additional CPU overhead during compression and access.
Example:
CREATE TABLE sales_archive_high
COMPRESS FOR ARCHIVE HIGH
AS
SELECT * FROM sales;
Comparison of HCC Compression Types
| Compression Type | Primary Purpose | Suitable Workload |
|---|---|---|
| Query Low | Balanced compression and loading performance | Data warehouse |
| Query High | Higher compression with analytical performance | Data warehouse |
| Archive Low | High storage savings | Historical data |
| Archive High | Maximum storage savings | Rarely accessed data |
The actual compression ratio depends on the data, workload, and selected compression method. Oracle’s published examples show that compression ratios can vary significantly.
HCC vs Traditional Row-Based Compression
Understanding the difference between HCC and traditional row-based compression helps DBAs select the right compression technology.
| Feature | Row-Based Compression | Hybrid Columnar Compression |
|---|---|---|
| Storage organization | Row-oriented | Column-oriented within CUs |
| Compression method | Compresses repeated values within rows/blocks | Compresses similar column values together |
| Compression ratio | Generally lower | Generally higher |
| DML performance | Better for frequent modifications | Less suitable for frequent modifications |
| Analytical queries | Depends on workload | Optimized for scan-oriented workloads |
| Storage savings | Moderate | Potentially very high |
| Best use case | OLTP and mixed workloads | Data warehouses and historical data |
HCC is not intended to replace every compression method. It is designed for workloads where storage efficiency and analytical query performance are important.
How to Enable HCC in Oracle Exadata
Now let’s understand how an Oracle DBA can implement Hybrid Columnar Compression.
For demonstration, assume that we have an existing table named SALES.
Step 1: Check Existing Table Compression
First, check the current compression settings of the table.
SELECT
table_name,
compression,
compress_for
FROM
user_tables
WHERE
table_name = 'SALES';
This query displays the compression status and compression type of the table.
Step 2: Create a Table with HCC
You can create a new table using Query High compression.
CREATE TABLE sales_hcc
COMPRESS FOR QUERY HIGH
AS
SELECT *
FROM sales;
This creates a new table using HCC Query High compression.
Step 3: Enable HCC on an Existing Table
If you already have a table and want to enable HCC for its data, you can use:
ALTER TABLE sales
MOVE COMPRESS FOR QUERY HIGH;
This operation reorganizes the existing table data using the specified compression method.
For partitioned tables, compression can also be configured at the partition level.
Step 4: Verify Compression Settings
After creating or modifying the table, verify its compression attributes.
SELECT
table_name,
compression,
compress_for
FROM
user_tables
WHERE
table_name IN ('SALES', 'SALES_HCC');
You should see the relevant compression settings for the tables.
Step 5: Check Table Size
To understand the storage savings, compare the segment sizes.
SELECT
segment_name,
segment_type,
ROUND(bytes / 1024 / 1024, 2) AS size_mb
FROM
user_segments
WHERE
segment_name IN ('SALES', 'SALES_HCC');
This query helps compare the allocated segment sizes of the original and compressed tables.
Note: HCC availability depends on the underlying storage platform and supported configuration. Always validate the environment before implementing it.
How to Measure HCC Compression Ratio
One of the important responsibilities of an Oracle DBA is measuring how much storage is saved after enabling compression.
Oracle provides the DBMS_COMPRESSION package to estimate the compression ratio before applying compression.
Using DBMS_COMPRESSION
Example:
SET SERVEROUTPUT ON;
DECLARE
blkcnt_cmp PLS_INTEGER;
blkcnt_uncmp PLS_INTEGER;
row_cmp PLS_INTEGER;
row_uncmp PLS_INTEGER;
cmp_ratio NUMBER;
comptype_str VARCHAR2(100);
BEGIN
DBMS_COMPRESSION.GET_COMPRESSION_RATIO(
scratchtbsname => 'USERS',
ownname => USER,
objname => 'SALES',
subobjname => NULL,
comptype => DBMS_COMPRESSION.COMP_FOR_QUERY_HIGH,
blkcnt_cmp => blkcnt_cmp,
blkcnt_uncmp => blkcnt_uncmp,
row_cmp => row_cmp,
row_uncmp => row_uncmp,
cmp_ratio => cmp_ratio,
comptype_str => comptype_str
);
DBMS_OUTPUT.PUT_LINE('Compression Type: ' || comptype_str);
DBMS_OUTPUT.PUT_LINE('Compressed Blocks: ' || blkcnt_cmp);
DBMS_OUTPUT.PUT_LINE('Uncompressed Blocks: ' || blkcnt_uncmp);
DBMS_OUTPUT.PUT_LINE('Compression Ratio: ' || cmp_ratio);
END;
/
This procedure estimates the compression ratio using a representative sample of the table.
The DBA can use this information to evaluate whether HCC is suitable before implementing it.
Understanding Compression Ratio
For example:
Suppose a table occupies 100 GB before compression.
After applying HCC, its size becomes 10 GB.
The compression ratio is:
This means the table has achieved a 10:1 compression ratio, representing approximately 90% storage savings.
Actual results depend on the data and compression method.
What Happens When You UPDATE or DELETE HCC Data?
This is an important topic for Oracle DBAs.
HCC is optimized for read-intensive workloads rather than frequent data modifications.
When data is inserted using conventional DML operations or existing compressed rows are updated, Oracle may store the affected rows in a less-compressed row format instead of maintaining the original highly compressed columnar representation.
Let’s understand the impact.
UPDATE Operations
When a DBA updates a row in an HCC-compressed table:
-
Oracle handles the update transparently.
-
The affected data may be stored in a less-compressed row format.
-
Updates can cause rowids to change.
-
Locking can involve a larger portion of the Compression Unit.
-
Frequent updates can reduce compression efficiency.
INSERT Operations
HCC achieves its best compression through direct-path loading.
Conventional INSERT operations do not generally achieve the same HCC compression level as direct-path loads.
For better compression, DBAs should consider suitable bulk-loading strategies.
DELETE Operations
DELETE operations are supported, but frequent modifications can affect compression efficiency and may increase the need for table reorganization.
Therefore, HCC is generally recommended for historical and read-intensive data rather than highly transactional tables.
Best Practices for Oracle DBAs
When implementing HCC in an Oracle Exadata environment, DBAs should follow these best practices:
Choose the correct compression level: Use Query compression for frequently accessed analytical data and Archive compression for historical data.
Use direct-path loading: Prefer suitable direct-path operations to achieve better compression.
Avoid frequent updates: Keep highly active transactional tables on appropriate row-based compression methods.
Monitor storage usage: Regularly compare compressed and uncompressed segment sizes.
Evaluate query performance: Test SQL execution time, physical reads, CPU consumption, and I/O statistics.
Use partitioning: Consider partitioning large tables so historical partitions can use Archive compression while newer partitions use a suitable compression method.
Test before production implementation: Validate compression ratios and application behavior in a test environment.
Check platform support: Confirm that the storage platform supports the required HCC features.
Common HCC Interview Questions for Oracle DBAs
What is Hybrid Columnar Compression?
HCC is an Oracle Database compression technology that organizes multiple rows into Compression Units and stores column values together to achieve higher compression ratios.
What is a Compression Unit?
A Compression Unit is a logical storage structure containing multiple rows organized and compressed by column.
What are the four types of HCC compression?
-
Query Low
-
Query High
-
Archive Low
-
Archive High
Why is HCC suitable for Exadata?
Exadata provides storage-side processing capabilities, including Smart Scan and decompression offload, which help improve the performance of eligible analytical queries on HCC-compressed data.
Is HCC suitable for OLTP workloads?
HCC is generally not recommended for frequently updated OLTP tables because its compression architecture is optimized for read-intensive workloads.
What happens when we update an HCC-compressed row?
Oracle supports updates, but modified rows may be stored in a less-compressed row format. Updates can also change rowids and involve larger locking units.
Which SQL statement enables HCC?
For example:
CREATE TABLE emp_hcc
COMPRESS FOR QUERY HIGH
AS
SELECT * FROM employees;
How do you check whether a table uses HCC?
You can check the USER_TABLES or DBA_TABLES views using the COMPRESSION and COMPRESS_FOR columns.
Conclusion
Hybrid Columnar Compression is one of the important storage optimization technologies in Oracle Exadata. By combining column-based organization with compression algorithms, HCC helps organizations reduce storage consumption while improving the efficiency of analytical workloads.
Understanding Compression Units, Query Low, Query High, Archive Low, and Archive High is essential for Oracle DBAs working with large databases.
For DBAs, the key is selecting the correct compression method based on workload requirements, monitoring compression efficiency, and understanding how DML operations affect compressed data.
Learnomate Technologies provides technical learning opportunities for aspiring and working Oracle DBAs to understand Oracle Database architecture, Exadata, RAC, ASM, performance tuning, and advanced database technologies through practical learning.

