Rule Definition
If the cardinality MANY TO ONE is specified, any database that supports this addition assumes that the results set defined by the left outer join matches this cardinality and SQL Optimizer attempts to suppress any surplus joins.
For exemple, When defining outer joins as LEFT OUTER MANY TO ONE joins, if no field is requested from the joined table, the database can avoid executing the join at runtime.
Remediation
Add "MANY TO ONE" cardinality on "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
left outer many to one join scarr on
spfli.carrid = scarr.carrid
{
scarr.carrname as carrier,
spfli.connid as flight,
spfli.cityfrom as departure,
spfli.cityto as arrival
}
Reference
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.