CDS Views: performance
annotation
Table of Contents
Table of Contents 2
Overview 3
CDS views: performance annotations 3
Performance Recommendation 5
Test result 6
Conclusion 6
2
Overview
Core data services has many complexities:
● CDS views stacking can get so complex that it results in performance
degradation.
● By using layered CDS views, formerly fast accesses to buffered tables
and application caches on ABAP server might be replaced by complex
database accesses.
● 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.
CDS views: performance annotations
In most of the standard CDS views, there are, below, 3 annotations being
used by SAP in order to improve performance. But, mostely, they are not
used in the custom views which might impact performance while fetching
data.
3
➔ Hence it would be good practice to use these annotations properly and
benefit with performance.
@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 which has to be searched through in order to compute the
result set.
4
Performance Recommendation
1. Keep CDS views simple (in particular service-Quality A and B = #BASIC
views).
2. Expose only required fields –define associations to reach additional fields
when requested.
3. Perform expensive operations (e.g. calculated fields) after data reduction
(filtering, aggregation).
4. Avoid joins and filters on calculated fields.
5. Test performance of CDS views. Test with reasonable (= realistic) test data.
5
Test result
Conclusion
It would be good practice to use these annotations properly and benefit with performance.
1. @ObjectModel.usageType.serviceQuality
2. @ObjectModel.usageType.sizeCategory
3. @ObjectModel.usageType.dataClass