Thursday, 5 July 2018

Performance Optimization for ABAP CDS view

The blog will discuss on the Topic of Performance optimization for CDS views.

General Architecture for S4HANA:

SAP ABAP CDS, SAP ABAP Learning, SAP ABAP Study Materials, SAP ABAP Tutorials and Materials
SQL Processing Steps :


SAP ABAP CDS, SAP ABAP Learning, SAP ABAP Study Materials, SAP ABAP Tutorials and Materials

CDS Views Complexities :

1. CDS views stacking can get so complex that it results in performance degradation

2. Number of execution plan variants raises according (#𝒕𝒂𝒃𝒍𝒆𝒔)πŸ“HANA optimizer could fail to find the optimal execution plan.

3. By using layered CDS views, formerly fast accesses to buffered tables and application caches on ABAP server might be replaced by complex database accesses

4. Declarative programming style of SQL can have a performance drawback since optimizer plans do not take into account the actual attributes of a statement. Cutting away unnecessary execution branches might not be done with the same efficiency as with imperative programming in ABAP

Display Complexity of the CDS views:

ADT > Open with Dependency Analyzer.

SAP ABAP CDS, SAP ABAP Learning, SAP ABAP Study Materials, SAP ABAP Tutorials and Materials


SAP ABAP CDS, SAP ABAP Learning, SAP ABAP Study Materials, SAP ABAP Tutorials and Materials

Note :

Separate transactional data, master data, org data, customizing, and other metadata This is important to leverage caches on the application server for meta data.

Classification of CDS views using performance annotations :

@ObjectModel.usageType.serviceQuality
quality of service with respect to the expected performance of the CDS view

@ObjectModel.usageType.dataClass
type of data in CDS view (transactional data, master data, …)

@ObjectModel.usageType.sizeCategory
set of data whichhas to be searched through in order to compute the result set

SAP ABAP CDS, SAP ABAP Learning, SAP ABAP Study Materials, SAP ABAP Tutorials and Materials

CDS views: performance annotations

SAP ABAP CDS, SAP ABAP Learning, SAP ABAP Study Materials, SAP ABAP Tutorials and Materials

service-Quality of CDS views: requirements and KPIs:

SAP ABAP CDS, SAP ABAP Learning, SAP ABAP Study Materials, SAP ABAP Tutorials and Materials

Generate SQL statement for CDS Views:

ADT > View SQL statement.

SAP ABAP CDS, SAP ABAP Learning, SAP ABAP Study Materials, SAP ABAP Tutorials and Materials

SQL Tips :

Exposed non NULL preserving calculated field

The blow example 2. Result  385% improvement of Query execution :

Example 1: The output time was 883 ms

SAP ABAP CDS, SAP ABAP Learning, SAP ABAP Study Materials, SAP ABAP Tutorials and Materials

Example 2: The output time was 34 ms

SAP ABAP CDS, SAP ABAP Learning, SAP ABAP Study Materials, SAP ABAP Tutorials and Materials

Limit push down and aggregation push down :

• Order by: first sort, then limit problem for calculated fields
• Distinct operator, any aggregation
• cardinality changing joins (e.g. LoJoin TO MANY)

Rounding (and other functions) stop optimizer from pushing down aggregations
Currency conversion and all arithmetic operations except +/-contain implicit rounding functions

Special Note on Performance Recommendation:-

1. Keep CDS views simple (in particular service-Quality A and B = #BASIC views)
2. Amount of data persisted in S4 CDS views should not exceed 20% of the overall data volume of  the system.
3. In transactional processing, only use simple CDS views accessed via CDS key
4. Expose only required fields –define associations to reach additional fields when requested
5. Perform expensive operations (e.g. calculated fields) after data reduction (filtering, aggregation)
6. Avoid joins and filters on calculated fields
7. Test performance of CDS views. Test with reasonable (= realistic) test data
8. Analyze accesses to more complex views with HANA PlanViz to see whether filters are pushed down to all brances.
9. Stay tuned on caching possibilities of SAP HANA and Fiori apps

1 comment:

  1. we provide a best modules in sap and (selenium) softwaare testing with real time scenarios.
    Our consultants are working professionals they will share our experience
    Who can learn in this module?
    Opportunities in this Module?
    Why Prefer Training with US?
    Training by Leading Architects
    Topic based Training
    Long-Term Technical Support
    Placement Assistance
    End to End – Project Support
    SAP HR Training in Chennai
    SAP Success Factors Training in Chennai
    SAP FICO Training in Chennai
    SAP MM Training in Chennai
    Sap Fiori Training in Chennai
    SAP HANA Training in Chennai
    software Testing modules
    Selenium Training in Chennaiss
    for more informations call 8122241286

    ReplyDelete