Hitachi

Hitachi Advanced Database Setup and Operation Guide


6.12.7 Determining the size of the user logs that are output during database updating (variable max_user_log)

This subsection explains how to calculate the size of the user logs that are output during the execution of an INSERT statement (row insertion), a DELETE statement (row deletion), and an UPDATE statement (row update).

First, determine the user log sizes based on (1) Determining the base row user log size through (6) Determining the user log size for allocating segments. Then, calculate the user log size by substituting the variables described in Formula 1 to Formula 3, as follows:

Formula 1: Size of user logs that are output when an INSERT statement is executed (bytes)

[Figure]

Formula 2: Size of user logs that are output when a DELETE statement is executed (bytes)

[Figure]

Formula 3: Size of user logs that are output when an UPDATE statement is executed (bytes)

[Figure]

Explanation of variables

BRWLOG

Base row user log size (bytes)

Determine the value for BRWLOG based on the explanation in (1) Determining the base row user log size.

VRWLOG

Branch row user log size (bytes)

Determine the value for VRWLOG based on the explanation in (2) Determining the branch row user log size.

COLUMN_DELLOG

Log size of the invalid row information pages of column store tables (bytes)

For details about COLUMN_DELLOG, see (5) Determining the log size of the invalid row information pages for column store tables.

IDXSLOG

Combined sizes of all the user logs for the B-tree indexes defined for the table (bytes)

Determine the value for IDXSLOG based on the explanation in (3) Determining the size of the B-tree index user log.

TIXSLOG

Combined sizes of all the user logs for the text indexes defined for the table (bytes)

Determine the value for TIXSLOG based on the explanation in (4) Determining the size of the text index user log.

SGMTLOG

User log size for allocating segments (bytes)

Determine the value for SGMTLOG based on the explanation in (6) Determining the user log size for allocating segments.

ins_row_num

Number of rows inserted by the INSERT statement

del_row_num

Number of rows deleted by the DELETE statement

upd_row_num

Number of rows updated by the UPDATE statement

Organization of this subsection

(1) Determining the base row user log size

The following table shows the base row user log size (variable BRWLOG).

Table 6‒22: Base row user log size (variable BRWLOG)

No.

Operation description

Base row user log size (bytes)

1

INSERT statement

92

2

DELETE statement

3

UPDATE statement

184

(2) Determining the branch row user log size

The following table shows the formulas for the branch row user log size (variable VRWLOG).

Table 6‒23: Branch row user log size (variable VRWLOG)

No.

Operation description

Branch row user log size (bytes)

1

INSERT statement

[Figure]

2

DELETE statement

Same as for row 1

3

UPDATE statement

[Figure]

Explanation of variables

var_num

Number of columns managed as branch rows (columns)

Determine the number of columns as described in the following.

If the BRANCH ALL table option is specified
  • Number of VARCHAR and VARBINARY columns

If the BRANCH ALL table option is not specified

Sum total of VARCHAR and VARBINARY columns that satisfy any of the following conditions:

  • Column for which YES is specified in the BRANCH column definition

  • Column whose definition length is 256 bytes or longer and for which AUTO is specified in the BRANCH column definition

  • Column whose definition length is 256 bytes or longer and for which the BRANCH column definition is omitted

var_num_upd

Number of columns updated out of those columns that are managed as branch rows (columns)

var_size

Average size of the data in the columns that are managed as branch rows (bytes)

Determine the value according to Table 5‒17: Data length of columns that become branch rows in (2) Determining the number of pages for branch rows (variable VP(i)) under 5.8.2 Determining the number of pages for storing each type of row.

page_size

Page size of data DB area (bytes)

(3) Determining the size of the B-tree index user log

Use the following formula to determine the size of the B-tree index user log (variable IDXSLOG).

Formula

[Figure]

Explanation of variables

idx_num

Number of B-tree indexes defined for the column to be updated

IDXLOG(i)

Size of the index user log related to the i-th B-tree index defined for the table to be updated (bytes)

Determine IDXLOG(i) from the following table:

No.

Update type

Number of duplicate update-target keys before updating

IDXLOG(i) value

1

INSERT statement

0 (new key)

[Figure]

2

1 to 254

Same as for row 1

3

255

[Figure]

4

256 or more

Same as for row 1

5

DELETE statement

[Figure]

6

UPDATE statement

[Figure]

#

Same log size as if the updated data is being inserted into the row that is the target of the update.

AFTERLOG(i)

For each update target row, updated logical log size for the updated data (bytes)

BEFORELOG(i)

For each update target row, updated logical log size for the original data (bytes)

Use the following formula to determine the sizes of AFTERLOG(i) and BEFORELOG(i).

Formula

[Figure]

idx_col_num

Number of columns indexed by the targeted index (columns)

KEYSZDB

Database storage length of the targeted index key (bytes)

The updated index key is used for AFTERLOG(i) and original index key is used for BEFORELOG(i).

SPLITLOG(i)

User log size when an index page split occurs (bytes)

Use the following formula to determine the user log size when an index page split occurs in the target index.

Formula (when the number of duplicate index keys in the update-target rows is 254 or fewer)

[Figure]

Formula (when the number of duplicate index keys in the update-target rows is 256 or more)

[Figure]

page_size

Page size of the data DB area in which the target B-tree index is defined (bytes)

idx_level

Number of levels in the target B-tree index (steps)

(4) Determining the size of the text index user log

Use the following formula to determine the size of the text index user log (variable TIXSLOG).

Formula

[Figure]

Explanation of variables

tix_num

Number of text indexes defined for the column to be updated

TIXLOG(i)

Size of the text index user log related to the i-th text index defined for the table to be updated (bytes)

Determine TIXLOG(i) from the following table:

Table 6‒24: TIXLOG(i) value

No.

Update type

TIXLOG(i) value

1

INSERT statement

SPLITLOG(i)

2

UPDATE statement

SPLITLOG(i)

SPLITLOG(i)

Log size in the event of a text index page split

Use the following formula to determine its value.

Formula (bytes)

[Figure]

page_size

Page size of the data DB area in which the target text index is defined (bytes)

(5) Determining the log size of the invalid row information pages for column store tables

Use the following formula to determine the value of variable COLUMN_DELLOG.

Note that if the processing-target table is a row store table, assume that this value is 0 during estimation.

Formula (bytes)

COLUMN_DELLOG = 332 + 2 × page_size

Explanation of the variables

page_size

Page size of the DB area in which the column store table is defined (bytes)

(6) Determining the user log size for allocating segments

If a row or index entry cannot be stored in the active page when an INSERT or UPDATE statement is executed to add a row or index entry, it is allocated to an unused page. Also, when rows that have been stored in column store format are invalidated by executing the UPDATE or DELETE statement, the information indicating that the rows became invalid sometimes cannot be stored on the invalid row information page. In such a case, the information is allocated to an unused page.

If all pages within a segment are being used, a new segment is allocated.

The table below shows the user log size for allocating new segments (variable SGMTLOG).

Based on the row data to be added by the INSERT statement and the row data to be updated by the UPDATE statement, determine the number of segments to be allocated as described in 5.8.1 Determining the total number of pages in the data DB area, 5.8.2 Determining the number of pages for storing each type of row, 5.8.3 Determining the number of storage pages for each B-tree index segment, and 5.8.5 Determining the number of storage pages for each text index segment.

If the processing-target table is a column store table, take into consideration the number of rows to be deleted by using the DELETE statement during estimation.

Table 6‒25: User log size for allocating new segments

No.

Operation description

User log size (bytes)

1

INSERT statement

[Figure]

2

UPDATE statement

3

DELETE statement#

#

Note that if the deletion-target table is a row store table, assume that this value is 0 during estimation.