Understand RLV Memory Initial Requirements and Usage

Each RLV table requires an in-memory store to hold its RLV data. The memory requirements of the store change during the life of the table while it is RLV enabled.

The initial RLV memory requirement of the store, the first time it is needed can be approximated as:

#COLS_FIXED = # fixed size columns + 1 (pseudo column)

#COLS_VAR = # variable sized columns

Base RLV store (BRS) = #COLS_FIXED * default_fixed_size + #COLS_VAR * default_variable_size

where:
  Datatype Default Size
default_fixed_size fixed 16MB
default_variable_size variable 512KB

The default size value pertains to columns of all supported RLV datatypes except bit. Each version of the store is referred to as a table fragment. Each table fragment contains a column fragment for each column plus one extra column fragment for internal management. Each column fragment is subdivided into subfragments to facilitate larger amounts of data and parallel operations.

The base RLV store size (BRS) is based on a table having only the initial version and one subfragment per column fragment.

Since the initial RLV memory requirement is a function of the number of columns in the table, the overall RLV memory usage of inserting a few rows into a wide (many column) table can have the same net RLV memory usage as inserting many rows into a narrow (few column) table.

The RLV memory usage of the store grows when:
Reason Description
New column subfragments are added. As a column subfragment becomes full, a new subfragment is created, using memory equal to the default_fixed_size or default_variable_size value.
Multiple column subfragments are added. Created to accommodate parallel operations. Each new subfragment uses memory equal to the default_fixed_size or default_variable_size value.
Multiple versions of the store (table fragments) are created. Required to handle multiple transactions. Memory usage of each new version is at least equal to the initial memory requirements of the BRS.

Multiple column subfragments are children of a particular table version. When a table version is no longer needed, its child column subfragments are also no longer required. Removal of unnecessary table versions reduces RLV memory usage. If newer table versions do not initially need multiple column subfragments, they are not created until they are needed.