Yellow Result lines & Memory consumption
This article provides some basis information on how the yellow result lines calculation is done. The article is based on SAP BW 7.40
As described in Sample Query 1a the output result size might heavenly depends on whether yellow result lines are hidden or not in a specific query scenarios (especially when many characterisics are in the drilldown).
This subsequently can have a large impact on how much memory is required for executing a query.
Below you will find a very simple example demonstrating this:
System BZH (SAP BW 740)
- In case of hidden yellow result lines 25 lines are displayed.
- In case of displayed yellow result lines 149 lines are displayed.
The calculation of the yellow result lines is taking place in method AGGREGATE_SPID (Class CL_RSR_RRK0_RESULT_SET) within DATA_GET.
For each characteristic with active yellow result lines an aggregation level is to be calculated and entry exists in table N_TS_SUBTOTAL_LEVEL.
Each aggregation level corresponds to the combination of all characteristics left to this corresponding infobject.
- In case of hidden yellow result lines N_TS_SUBTOTAL_LEVEL = [1x2(12)]Sorted Table
-> representing the SP: All 6 characteristics in the drilldown
- In case of displayed yellow result lines N_TS_SUBTOTAL_LEVEL = [7x2(12)]Sorted Table
-> 0 characteristics in the drilldown, 1 characteristic in the drilldown, 2 characteristics in the drilldown.., all 6 characteristics in the drilldown
Calculation of the aggregation levels:
- Initialization of the aggregation levels
METHOD GET_DATA CL_RSR_RRK0_QUERY_RUNTIME
-> METHOD INITIALIZE CL_RSR_RRK0_RESULT_SET_STL
-> METHOD AGGREGATE_SPID CL_RSR_RRK0_RESULT_SET
=> Here the required aggregation levels can be found: see table n_ts_subtotal_level
- Filling of the aggregation levels METHOD GET_DATA CL_RSR_RRK0_QUERY_RUNTIME
-> METHOD FETCH CL_RSR_RRK0_RESULT_SET_STL
=> Here the required aggregation levels are actually filled one after another (LOOP)
-> METHOD FILL_INTO_SETXX CL_RSR_RRK0_SUBTOTAL_LEVEL
-> METHOD DO_FILLING CL_RSR_RRK0_SUBTOTAL_LEVEL
Performance and Memory impact
As demonstrated in the example above displaying yellow result lines can easily multiply the output lines of a query. In our example 149 lines will be displayed instead of 25 lines (6 times more lines). This has got the following impact on the memory required for executing the query.
- In case of hidden yellow result lines the required memory for the tables containing the result is as follows:
C_TA_SETXX Standard Table[25x8(124)] 3.604 MB
C_TH_DAT_N Hashed Table[25x18(96)] 3.268 MB
- In case of displayed yellow result lines the required memory for the tables containing the result is as follows:
C_TA_SETXX Standard Table[149x8(124)] 20.036 MB
C_TH_DAT_N Hashed Table[149x18(96)] 17.660 MB
As demonstrated above the memory of a query can be easily multiplied dependent on whether yellow result lines are to be displayed or not. In case of queries having huge result outputs it might happen that they are still executable in case that yellow result lines are hidden but terminates in case that yellow result lines are displayed. In case that the memory limits of a system are exceeded a memory dump such as TSV_TNEW_PAGE_ALLOC_FAILED will occur.