Just want to share few interesting points on the CDS view performance Annotation for CDS view performance. SAP has released some guidelines to improve the performance of CDS views.
The best way to learn these guidelines is to learn from standard CDS views and apply in our custom views.
In most of the standard CDS views, we have seen below 3 annotations being used by SAP in order to improve performance. But I have seen we are not using it in our custom views which might impact performance while fetching data. Hence it would be good practice to use these annotations properly and benefit with performance.
( Note : In case where we want to see list of CDS view doesn’t have these annotations, SAP has provided a standard table : DDHEADANNO. This table will have information of all the annotations being used in CDS views present in the system. So you can create a report program on this table where we can find out CDS views which doesn’t have above annotations with %usagetype% keyword. )
Valid values for serviceQuality: #A, #B, #C, #D, #X, #P
Valid values for sizeCategory: #S, #M, #L, #XL, #XXL
Valid values for dataClass: #TRANSACTIONAL, #MASTER, #ORGANIZATIONAL, #CUSTOMIZING, #META, #MIXED
Now will see below charts where we will see in what cases we should use these annotations :
Combination of Characteristics to be used for annotations in CDS views
Test Results :
Keep CDS views simple (in particular service-Quality A and B = #BASIC views)
Amount of data persisted in S4 CDS views should not exceed 20% of the overall data volume of the system.
In transactional processing, only use simple CDS views accessed via CDS key
Expose only required fields –define associations to reach additional fields when requested