Entering content frame

Background documentation Join Locate the document in its SAP Library structure

Some background information about the processing of joins is required to understand how search strategies are found for joins.

Creating a Results Table for All Tables Linked by a Join

You can use a join to link up to 64 tables with each other. The system links the tables in steps; that is, one join is created from two tables. An additional table is then linked with the join result to form a new join.

  1. The first table is searched.
  2. The result is stored in a temporary results table.
  3. The temporary results table is sorted by the join columns of the following join step.
  4. The next table that still exists is searched.
  5. The existing temporary results table is linked with the new table.
  6. The result is stored in a new temporary results table.
  7. This temporary results table is sorted by the join columns of the following join step.
  8. The old temporary results table is deleted.
  9. If there are more tables, the procedure is repeated from step 4.

The last temporary results table is the results table that the user wants.

Optimization of the Tables Linked by a Join

You can only save time or space during the processing of tables linked by a join if the temporary results tables are as small as possible and that the system can access the lines of each of the new tables to be linked as directly as possible.

The Optimizer therefore attempts to place small tables with restrictive search conditions at the beginning of the series of tables to be processed, in order to maintain small temporary results tables.

The order in which the tables are specified in the FROM clause of the SELECT statement has no influence on the order of processing. The Optimizer determines the order of processing itself.

Search Strategies

You can display the search strategies using the EXPLAIN statement (EXPLAIN Statement for Joins).

The following search strategies can be used to access lines in the new table, starting from the join column values of the old temporary results table.

JOIN VIA INDEXED COLUMN

JOIN VIA KEY COLUMN

JOIN VIA KEY RANGE

JOIN VIA MULTIPLE INDEXED COLUMNS

JOIN VIA MULTIPLE KEY COLUMNS

JOIN VIA RANGE OF MULTIPLE INDEXED COL.

JOIN VIA RANGE OF MULTIPLE KEY COLUMNS

Multi-Column Key and Index Strategies

If two columns to be compared in a join step are not of the same length, not all of the search strategies can be used. We recommend that you define columns that are to be linked using a join with the same domain to avoid this restriction.

Leaving content frame