Step 1: Calculate the data row size

Rows that store variable-length data require more overhead than rows that contain only fixed-length data, so there are two separate formulas for computing the size of a data row.


Fixed-length columns only

Use this formula if the table contains only fixed-length columns, and all are defined as NOT NULL.

Formula

   4

(Overhead)

+

Sum of bytes in all fixed-length columns

= Data row size


Some variable-length columns

Use this formula if the table contains any variable-length columns or columns that allow null values.

The table in the example contains variable-length columns, so the computations are shown in the right column.

Formula

Example

    4

(Overhead)

     4

+

Sum of bytes in all fixed-length columns

+

 100

+

Sum of bytes in all variable-length columns

+

   50

= Subtotal

 154

+

(Subtotal / 256) + 1 (Overhead)

     1

+

Number of variable-length columns + 1

     3

+

    2

(Overhead)

     2

= Data row size

 160