Skip to main content

Oracle Advance Compression: Compress to improve performance

One of the most useful tools in order to improve a SAP systems with Oracle Database is Advance Compression. I don’t usually see much Basis Teams using this feature of Oracle in order to tune up a little bit their databases saving space and improving performance. I want to give you some information about how useful it is and I’m going to use this and this written by Steve Somah in the SAP SCN. He performed a database compression on a SAP ECC 6.0 EHP3 and these were the results:

  • The data was reduced by about 46% less:
Data save before and after database compression
Data save before and after database compression
  • The dialog response time improved around 38%. The database time improved by more than 50%:
Dialog Response Time before and after database compression
Dialog Response Time before and after database compression
  • The overall response time improved by 55%:
Overall Response Time before and after database compression
Overall Response Time before and after database compression

Those are impressing numbers, right? Before you jump up to compress your whole database I would like to give you some tips so you won’t mess it up.

How to start

The main SAP Notes about Oracle Advance Compression are:

Those notes explain a lot of concepts about data compression on Oracle database, different types of compression and how to do it. If you read the note for your Oracle version you’ll see that requirements are something like this:

  • To have an Oracle Database with version 11.2.0.2 or higher.
  • Have the Advanced Compression Option (ACO) purchased from Oracle. It is usually included in the license agreement for Oracle Database on SAP Systems but you better check this before starting.
  • SAP Kernel 6.40 or higher.
  • SAP BRSPACE 7.20 or higher.

As you can see the requirements aren’t difficult to achieve. You can compress using the BRTOOLS if you execute the following command with the ORASID user and follow the menus:

It is not difficult, just follow the BRSPACE menus and the SAP Note. If you have any question before or after the table compression check the SAP Note 1847870 – Oracle 11g: Advanced Compression – Known issues and solution. One last thing to keep in mind: Don’t use the OLTP compression on a SAP BW database. For BW systems you can check SAP Note 701235 – Usage of Oracle compression and BW, it is quite old but it will work.

Before starting there is a big question you should ask yourself…

What should I compress? I want to compress the whole world!

The most important question before starting is what we want to compress. It is completely unnecessary and not recommended to compress the whole database since we won’t benefit from the Oracle compression if we do so. For deciding which tables we want to compress we will look for the following characteristics:

  • Tables with a compression ratio above 2.0. For doing to I wrote a small SQL script you can execute and it will tell you the compression ratio for a specific table. The SQL code is not my creation and I don’t remember where I found it, probable on Julian Dontcheff’s Blog:

On the line DBMS_COMPRESSION you have to write the tablespace, user that owns the table and the table name. The output will be something like this:

Compression Script output
Compression Script output

If the compression ratio is above 2 then the table is an interesting one to compress in the database.

  • Tables high a high number of Logical Reads, Physical Reads and UnOptimized reads. We can get this information on transaction ST04 using the AWR Report in Workload Reporting:
AWR Report in ST04
AWR Report in ST04

Over there you will find some data like this one:

AWR Report - UnOptimized Reads
AWR Report – UnOptimized Reads

Just check the top tables in each section.

Little example for great people

Using the last screenshot as example we can see that the BALHDR table has a high UnOptimized Reads (about 15% of the whole database). If we execute the script from the last point we will see that the ratio is 3,2 so it makes this table an interesting option in order to compress it. Keep in mind that the CPU use  by the database will be higher when working with this table after the compression but the database response time will be lower.

In the screenshot I posted about the script output I executed it for the BSIS table. The compression ratio was 6.47 which was great and the table appeared on the UnOptimized Reads as a LOB Segment instead with a table name. If you “convert” that object name from LOB to table name you will see that the table name is the BSIS. Another good option for compressing!

Conclusion

As you can see table compression on Oracle is quite easy to do and it can improve a lot your databases. People usually don’t keep in mind this feature and they just focus on improving the queries, memory, buffer, etc. on the database in order to improve the performance. Remember to use all the tools available when fighting against a performance issue. Check your database to see if there is any interesting table to compress!

2 thoughts to “Oracle Advance Compression: Compress to improve performance”

    1. Hi Yke,

      The SQL code wasn’t created by me, I found it on Internet but I don’t remember if it was on Julian’s page or other site. I will clarify it on the article 😉

      Sorry for the misunderstanding!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.