15.00 - Byte Alignment - Teradata Database

Teradata Database Design

prodname
Teradata Database
vrm_release
15.00
category
User Guide
featnum
B035-1094-015K

Byte Alignment

Rows on packed64 format systems are always aligned on even‑byte boundaries. In other words, rows are never stored with an odd number of bytes. As a result, if a row has an odd byte length, the system adds a filler byte to the end of the row to make its length even. Filler bytes are included in the CurrentPerm total for each table column in DBC.DatabaseSpace.

During a SysInit operation, Teradata Database reads several flags to determine whether a system should be configured to format its data in a packed64 format or in an aligned row format. Consult your Teradata support representative if you want to change the current setting for your system. Depending on the settings of the row format flags, a freshly initialized system formats its rows in packed64 format by default, while an upgraded system continues to format its rows in aligned row format as the default.

See the table in “Row Structure for Aligned Row Format Systems” on page 755.

A data block contains rows from one table only, and any row from that table is completely contained within a given data block. In the packed64 row format, a row starts on a 2‑byte boundary relative to the start of a data block. This ensures alignment of columns only for those tables where the maximum alignment requirement for any column is 2.

In the aligned row format, the maximum alignment requirement for a column in a table can be 1, 2, 4, or 8 bytes. The size of each row must be a multiple of the maximum alignment requirement to ensure that each row starts on a valid boundary within a data block. For the sake of uniformity, all row sizes are multiples of 8, starting on an 8‑byte boundary relative to the start of a data block. This requires additional disk space for aligning data and the multiples of 8 filler applies to both small‑block‑sized systems and large‑block‑sized systems.

Write Ahead Logging (WAL) introduces a data block header size of 72 bytes. This increase causes 5.5% of existing data blocks to increase in size by one sector (512 bytes).

The 28 byte increase in size of the data block header plus the additional pad characters in the row data that are required to ensure 8‑byte boundary alignment decreases the number of rows that can be stored in a data block with respect to the same data stored on pre‑WAL systems.

The high level structure of a Teradata Database data block is as follows.

The size of the data block trailer is 2 bytes for small block‑sized systems and 4 bytes for large block‑sized systems. The size of the compression header is the same for small‑block‑sized systems and large‑block‑sized systems. The size of each element in the reference array is 2 bytes for all systems.

You should take this information into account when you undertake the various table sizing operations performed during capacity planning. This information can also be important if you need to determine the exact amount of compression you can achieve by compressing multiple column values (see “Byte Alignment Considerations for Multi-Value Compression” on page 721).