Rule Definition
Usually the result of joining the two tables will be a set of data consisting of Order Headers and their Items. The select will gather all the requested data from both tables. That means, even if a business user is interested only in header information the view still fetch data from both tables. This will impact application performance mainly when perform join on large set of tables
Remediation
Use "association" instead of "left outer join".
Violation Code Sample
define view demo_cds_join
as select from spfli
left outer join scarr on
spfli.carrid = scarr.carrid
{
scarr.carrname as carrier,
spfli.connid as flight,
spfli.cityfrom as departure,
spfli.cityto as arrival
}
Fixed Code Sample
define view demo_cds_join
as select from spfli
association to scarr as _scarr on
spfli.carrid = _scarr.carrid
{
_scarr.carrname as carrier,
spfli.connid as flight,
spfli.cityfrom as departure,
spfli.cityto as arrival
}
Reference
https://www.alexfediuc.com/cds-views-associations-vs-joins/
https://blogs.sap.com/2016/08/12/from-open-sql-joins-to-cds-associations/
https://blogs.sap.com/2018/12/20/safeguard-performance-of-abap-cds-views-part-3-rules-for-good-performance-of-cds-views/
Related Technologies
Technical Criterion
Efficiency - SQL and Data Handling Performance
About CAST Appmarq
CAST Appmarq is by far the biggest repository of data about real IT systems. It's built on thousands of analyzed applications, made of 35 different technologies, by over 300 business organizations across major verticals. It provides IT Leaders with factual key analytics to let them know if their applications are on track.