This video discusses the concept of cardinality in Core Data Services (CDS) views in SAP HANA. It provides a detailed explanation of how cardinality impacts the result of CDS.

After watching this video, you will learn:

  • The basic rules of cardinality: Cardinality always talks about the destination or target entity. It specifies the minimum and maximum number of entries that will be available in the target entity. The maximum value should always be greater than the minimum value. The maximum value cannot be zero, and the minimum value cannot be ‘*’. If you don’t define the cardinality, SAP defines it as either [0..1] or [1..1] by default based on the target entity.
  • The impact of cardinality on join creation: The cardinality defines the semantics or the relationship between the source and target. Some databases use cardinality to optimize the query. In SAP HANA, changing the cardinality can impact the result set. For example, if you define the cardinality as [1..1], it creates a “left outer join to ONE”, and if you define it as [1..*], it creates a “left outer join TO MANY”.
  • The behavior of cardinality when data from the target entity is not accessed: If no fields from the target entity are accessed, no join is formed. This is demonstrated by showing the native SQL statement that is executed when the CDS view is activated.
  • The behavior of cardinality when data from the target entity is accessed: If fields from the target entity are accessed, a join is formed. This is also demonstrated by showing the native SQL statement that is executed when the CDS view is activated.
  • The impact of cardinality on aggregation: When using aggregate functions in your select query, if the cardinality is [1..1], the join will not form. However, if the cardinality is [1..*], the join will always form.

Leave your comment

Your email address will not be published. Required fields are marked *