Temperature-based block-level compression, also known as "Compress on Cold" was introduced in Teradata Database 14.0. Temperature-based block-level compression (TBBLC) automatically compresses infrequently accessed data and decompress frequently accessed data. The access frequency is determined by statistics collected by TVS. TBBLC may be applied on a table-by-table basis or by default on all user tables.
This blog posting provides a little background and describes the easiest way to enable TBBLC on just a few selected tables in your database.
Teradata Virtual Storage (TVS) provisions free space for the file system and keeps track of cylinder locations. TVS serves as an abstraction layer between each AMP’s file system and the actual physical location of the data on physical storage.
When TBBLC is enabled, TVS is queried for the temperature of the data being held in disk storage. Temperature is an indication of how often the data is accessed. A cold temperature indicates the data is accessed less often than other data on the system, whereas a hot temperature indicates the data is accessed more often. This temperature determination is used by the AutoTempComp, a TBBLC background task, to decide which cylinders to compress or to uncompress.
The AutoTempComp task, as is true with all file system activity, runs independently on each AMP. This means that until a steady state is reached across the system, different portions of the same table will be compressed or not compressed on different AMPs.
This blog posting only offers a brief explanation of TBBLC. To fully understand how TBBLC works, and to get familiar with the variety of options and settings involved, please read the orange book titled: Block-Level Compression, With Selected Enhancements Through Teradata Database 16.0, dated April 2017. Chapters 5, 6, and 7 covers most of the relevant detail about TBBLC.
Simple Steps to Enable TBBLC
Below are the required changes to DBS Control parameters you will want to make if you wish to apply TBBLC on selected tables, with a brief explanation of each. These parameters are all part of DBS Control Compression Fields. Compression takes place after making the appropriate changes to these parameters without the need of a system restart.
BlockLevelCompression = ON
This is setting # 1 and is the big switch for enabling block level compression on the system. This parameter mandates whether BLC of any type is allowed to take place. The default is OFF.
EnableTempBLC = TRUE
This is setting #32 and must be turned on in order for temperature data to be collected by TVS for use by TBBLC. Combined with the BlockLevelCompression setting, EnableTempBLC will allow temperature-based compression to take place either on selected tables or the entire system.
DefaultTableMode = MANUAL
This setting #33 specifies what the default approach to compression for all tables will be. Setting the mode to MANUAL means that each table will use the system defaults, TLA, or Query Band overrides.
BLOCKLEVELCOMPRESSION = AUTOTEMP on selected tables
This is not a DBS Control parameter, but rather the table-level attribute that you will need to add onto each table you wish use temperature-based compression. Compression table level attributes allow you to override what the DefaultTableMode specifies, when different tables are to be treated differently.
The following graphic illustrates the relationship among these parameters and settings.
Don't expect immediate changes when you begin to use TBBLC. Temperature changes are driven by access frequency or lack thereof and takes time depending on access patterns. For that reason, the system may need to be running for several days or a week for the TVS statistics to see the results of TBBLC.