Data Base Joins part two

Sort merge join

When a join is processed using the sort merge join access strategy, the following steps are performed:

The table records that correspond to the WHERE clause are selected

The tables in the join are sorted according to the JOIN condition

The table records are merged

For the SQL statement above, the selective WHERE condition for field CUOBJ, table VVBAP, and the selective WHERE condition for field OBJNR, table VVBAK are evaluated. The resulting sets are sorted according to VBELN. The results are then merged.

n If selective WHERE conditions exist for the relevant tables, a sort merge join is very effective. If the JOIN conditions are not selective for any of the relevant tables, the sort merge join access strategy is more effective than a nested loop. If there are more than two tables in the join, you can combine the nested loop and sort merge join access strategies.

Access staginess for data base joins

Nested loop: This strategy is relevant for database views and ABAP JOINs. First, the WHERE clause is used as a basis for selecting the (outer) table to be used for access. Next, starting from the outer table, the table records for the inner tables are selected according to the JOIN condition.

Sort merge join: First, the WHERE clause is evaluated for all tables in the join, and a resulting set is produced for each table. Each resulting set is sorted according to the JOIN conditions and then merged, also according to the JOIN conditions.


RELATED POST

DATA BASE JOINS PART ONE

SAP ABAP SAMPLE CODE 1 REPLACE COMMENTARY IN ALV REPORT

SAP ABAP SAMPLE CODE FOR ALV EXECUTABLE PROGRAM

SAP ABAP SAMPLE CODE FOR HIRACHICAL REPORT

SAP ABAP SAMPLE CODE FOR ALV LIST DISPLAY REPORT

SAP ABAP SAMPLE CODE FOR ALV LAYOUT DISPLAY REPORT

No comments:

Post a Comment