Hitachi

Hitachi Advanced Database Setup and Operation Guide


6.25.2 Estimating the number of pages in the buffer for local work tables

This section explains how to estimate the number of pages in the buffer for local work tables. A local work table is a work table specific to each real thread and is created for each real thread.

Once you have determined the number of pages in the buffer for local work tables, specify a value that is equal to it or greater in the adb_dbbuff_wrktbl_clt_blk_num operand in the server definition. For details, see the explanation of the adb_dbbuff_wrktbl_clt_blk_num operand in 7.2.2 Operands related to performance (set format).

As needed, also specify the following operand and option:

The formula for determining the number of pages in the buffer for local work tables follows.

Formula (pages)

[Figure]

Explanation of variables

A: Number of work tables created when executing an SQL statement × 2

B: Value of the adb_sys_uthd_num operand in the server definition

Determine the number of work tables that are created when SQL statements are executed, see Considerations when executing an SQL statement that creates work tables in Designs Related to Improvement of Application Program Performance in the HADB Application Development Guide. Note the following when determining the number of work tables:

The following is a calculation example of the number of work tables to be created when executing an SQL statement:

Example

This example determines the number of work tables to be created when executing the SQL statement shown.

SELECT "C1","C2","C3" FROM "T1"
  WHERE "C1"=ANY(                                         ...1
                SELECT COUNT(DISTINCT "C3") FROM "T2"
                  WHERE "T1"."C1"="C2" GROUP BY "C1")     ...2
                  ORDER BY "C1","C2","C3"                 ...3
Explanation
  1. Creates a work table for a quantified predicate. However, because this is a subquery that includes an external reference column ("T1"."C1"), use the following formula to determine the number of work tables to be created:

    [Figure]

  2. Creates a work table to be used for sort processing by the GROUP BY clause. However, because this is a subquery that includes an external reference column ("T1"."C1"), use the following formula to determine the number of work tables to be created:

    [Figure]

  3. Creates a work table to be used for sort processing by the ORDER BY clause. In this case, a single work table is created.

The number of work tables to be created when executing the above SQL statement is the combined total of steps 1 through 3.