Hitachi

Hitachi Advanced Database Application Development Guide


5.8.2 Work table execution

If work table execution is used as the method for processing the set operation, HADB creates a work table for each query specification, and then sorts data. If the set operation does not contain an ALL specification, HADB performs deduplication of data in the work table. Then, HADB evaluates the set operation by matching data in each work table. If the set operation does not contain an ALL specification, HADB performs deduplication of the evaluation result of the set operation.

The following shows an example of work table execution.

■ SELECT statement to be executed
SELECT "T1"."C1" FROM "T1"
UNION
SELECT "T2"."C1" FROM "T2"
Figure 5‒18: Processing method for work table execution

[Figure]

Explanation:

  1. Creates work table 1 for storing the value resulting from query specification SELECT "T1"."C1" FROM "T1" (retrieves table T1, and then stores the value of column C1 of table T1 in work table 1).

  2. Performs data deduplication and sort processing for work table 1 created in step 1.

  3. Creates work table 2 for storing the value resulting from query specification SELECT "T2"."C1" FROM "T2" (retrieves table T2, and then stores the value of column C1 of table T2 in work table 2).

  4. Performs data deduplication and sort processing for work table 2 created in step 3.

  5. Fetches data from one row at a time, and then matches the values and performs deduplication.