Oracle Database

Exploring Oracle Hybrid Columnar Compression (HCC): A Hands-On Lab with Real Results (Repost)!

Introduction:

Hybrid Columnar Compression (HCC) is a powerful feature in Oracle Database that significantly reduces storage footprint while optimizing performance for different workloads. In this blog post, will walk through a practical lab exercise that demonstrates how various HCC compression methods perform in terms of load time and storage efficiency.

Sales Table Setup:

We begin by using a sample table SALES with 20 million rows. Our goal is to test different compression methods and compare their performance and space savings.

1. OLTP Compression:

create table comp_oltp compress for oltp as select * from sales where 1=2;
insert into comp_oltp select * from sales;
commit;

Comment: OLTP compression is optimized for DML operations. It took 2 minutes and 16 seconds to load the data.

2. Query Low Compression:

create table comp_query_low compress for query low as select * from sales where 1=2;
alter table comp_query_low nologging;
insert /*+ append */ into comp_query_low select * from sales;
commit;

Comment: This method is designed for data warehousing queries. It loaded in just 27 seconds, showing excellent performance.

3. Query High Compression:

create table comp_query_high compress for query high as select * from sales where 1=2;
alter table comp_query_high nologging;
insert /*+ append */ into comp_query_high select * from sales;
commit;

Comment: Aimed at maximizing compression for query workloads. Load time was 34 seconds—slightly slower but still efficient.

4. Archive Low Compression:

create table comp_archive_low compress for archive low as select * from sales where 1=2;
alter table comp_archive_low nologging;
insert /*+ append */ into comp_archive_low select * from sales;
commit;

Comment: Suitable for infrequently accessed data. Load time was 35 seconds.

5. Archive High Compression:

create table comp_archive_high compress for archive high as select * from sales where 1=2;
alter table comp_archive_high nologging;
insert /*+ append */ into comp_archive_high select * from sales;
commit;

Comment: This method prioritizes maximum compression. As expected, it had the slowest load time at 4 minutes and 13 seconds, but the best compression ratio.

Results: Segment Size Comparison

select segment_name, bytes/1024/1024 as mb from user_segments order by 1;
Segment NameSize (MB)
COMPARCHIVEHIGH5
COMPARCHIVELOW8
COMPQUERYHIGH8
COMPQUERYLOW304
COMP_OLTP864
COMP_CLASSIC736
SALES1535.5

Comment: The ARCHIVE HIGH method compressed 1.5 GB of data down to just 5 MB—a dramatic reduction!

ARCHIVE_HIGH Shows Much space saving.

Trade Off with Load Time and Conclusion

ARCHIVE HIGH Shows Higher load time Compared to QUERY LOW and QUERY HIGH

This lab clearly demonstrates the trade-offs between load time and compression ratio across different HCC methods. While ARCHIVE HIGH offers the best space savings, QUERY LOW and QUERY HIGH strike a great balance between performance and compression. HCC proves to be a valuable tool for optimizing storage in Oracle databases.

Saumya

Share
Published by
Saumya

Recent Posts

Oracle 19c Automatic Indexing: A Hands-On Workshop (Repost!)

Revisit my popular, hands-on workshop guiding you through Oracle 19c's Automatic Indexing! I'll show you…

2 weeks ago

Seamless Transition: Converting Oracle 19c Non-CDB to Pluggable Database (PDB)

Unlock the power of Oracle 19c's multitenant architecture by converting your existing non-CDB databases into…

2 weeks ago

Refine Permissions with Precision: Mastering Privilege Analysis in Oracle 19c – A Revision

Learn how Oracle 19c simplifies privilege management with its built-in analysis tools, ensuring a 'least…

2 weeks ago

The Simple, Reliable Way to Back Up Your WordPress Blog: A DIY Script for Peace of Mind

Struggling with WordPress backups? Learn how to set up an automated, custom shell script for…

2 weeks ago

My Journey Through Oracle Database World and Cloud world 2025: A Dive into the Future of Data and AI – And a Fresh Start!

After 18 enriching years in the tech world, I recently took a deliberate break, a…

2 weeks ago

Cleared 1Z0-997 Oracle Cloud Infra. Certified Architect Professional…

Cleared following 3 Oracle Cloud Infrastructure exams in a row in three days. Thanks to…

5 years ago