15.00 - Data Block - Teradata Database

Teradata Database Design

Product
Teradata Database
Release Number
15.00
Content Type
User Guide
Publication ID
B035-1094-015K
Language
English (United States)

Data Block

The data block is a disk‑resident file system structure that contains one or more rows from the same subtable. Depending on the configuration of your system, the file system aligns data blocks on either 4K boundaries (aligned configurations) or on 512 byte boundaries (unaligned configurations). Rows from different subtables are never mixed within the same data block, and rows are wholly contained within a single data block. Rows are never split between multiple data blocks. If an entire row does not fit within an existing data block, the file system splits the block into as few new data blocks as are required so that no rows span data blocks. This data block splitting process is automatic.

This blocking strategy ensures the following things.

  • No more than 511 bytes (or 4095 bytes for aligned configurations) ever remain unused within a data block.
  • This assumes that the DBS Control parameter PermDBAllocUnit is not altered from its default value.

  • A data block with logically adjacent rows can be located immediately by looking in the cylinder index without searching through any chains.
  • No reorganization because of block split fragmentation is ever required.
  • Block splits never create overflow blocks, so all blocks are always immediately addressable from the cylinder index.

    The data block is the physical I/O unit for the Teradata file system. Data block sizes range between 512 bytes and approximately 1MB.

    You can set the default maximum multirow data block size in several ways.

  • Set a system-wide default using the DBS Control utility.
  • Set or change the block size at the individual table level by establishing a value using the DATABLOCKSIZE parameter of the CREATE TABLE and ALTER TABLE statements, respectively.
  • If a row being stored is larger than the effective maximum size for a data block, the row is stored in a data block of its own. But a row cannot exceed the absolute maximum size data block supported by the Teradata Database.

    Blocks within an individual table can vary in size, and the file system adjusts their sizes dynamically as required. You can also define a merge block ratio for each table that enables the file system to merge small data blocks into a single large data block when a full‑table modification operation occurs on a table. If a specific merge block ratio is not defined for a table, the system default merge block ratio is used unless the merge block feature has been disabled using DBS Control.

    Data blocks have a standard header identifying the rows in the data block, the table the rows belong to and information about the space available in the block. The header for data blocks that are compressed at the block level is not compressed. Such data blocks also contain the following additional information:

  • The first rowid(16 bytes)
  • The last rowid (16 bytes)
  • The compressed size of the data block (2 bytes)
  • The compression algorithm used (1 byte)
  • The checksum produced by the compression process (4 bytes)
  • See SQL Data Definition Language for syntax and usage of the ALTER TABLE and CREATE TABLE statements. The MERGEBLOCKRATIO option for the ALTER TABLE and CREATE TABLE statements is only valid for permanent tables and permanent journal tables. It does not apply to volatile tables or to global temporary tables.

    Although the rows within a data block are not stored in any particular physical order, a structure called the Row Reference Array, which contains 2-byte pointers to the first word in each row, stores its data in ascending order of rowID.

    The logical storage sequence for rows in an employee file might look something like the following table, assuming that employee is an NPPI table.

     

    Partition Number

     

    RowID

    User Data

    Rowhash

    Uniqueness ID

    Emp Number

    Last Name

    First Name

    0

    7332

    0001

    6149

    Smith

    John

    0

    7332

    0002

    6171

    Chang

    Wei-hee

    0

    7332

    0003

    7777

    Misawa

    Mitsuharu

    0

    8431

    0001

    6333

    Messiaen

    Jean-Luc

    0

    9758

    0001

    5010

    Wanz

    Hans

    0

    9758

    0002

    6214

    Kulthum

    Muhammad