Entering content frame

Background documentation EXPLAIN Statement for Joins Locate the document in its SAP Library structure

The following information is displayed if the EXPLAIN statement is used for joins:

·        The order in which the tables are processed when the SELECT statement is executed

·        Whether the rows of a new table can be accessed directly from the values in the join columns of the old temporary results table or whether they can be accessed through an inversion

·        The strategy used to search the new table, if the rows of this table cannot be accessed directly or using an inversion

Example

EXPLAIN SELECT one.key ten1.keyft1, ten2.keyft2
FROM one, ten1, ten2
WHERE ten1.keyft1 < 100
  AND ten1.ft1    = one.keyf
  AND one.indf    = ten2.keyft2
  AND ten2.keyft2 < 100;

This EXPLAIN statement returns the following result:

TABLE NAME

COLUMN_
OR_INDEX

STRATEGY

PAGE COUNT

TEN1

ONE

TEN2

KEYFT1

KEF

KEYFT2

RANGE CONDITION FOR KEY

JOIN VIA KEY COLUMN

JOIN VIA KEY COLUMN

RESULT IS COPIED, COSTVALUE IS

1250

125

1463

97

This result should be interpreted as follows:

§         The joins of the tables are performed in the order TEN1, ONE, TEN2.

§         The table TEN1 has a total of 1250 pages, the table ONE has 125 pages, and the table TEN2 has 1463 pages.

§         The I/O costs for executing the SQL statement are 97 pages.

§         The table TEN1 is selected with the key keyft1. The table ONE is accessed with the primary key KEF. The table TEN2 is accessed with the primary key KEYFT2.

See also:

Explanations of the examples

 

Leaving content frame