CDS Views
Architect / Cross-trackAdvanced

CDS Performance: Pushdown Without Overloading

Tune CDS performance using selective filters, correct joins, limited fields and realistic tracing.

Explanation

CDS performance depends on data volume, join design, filters, cardinality, associations, calculations and consumer behavior. HANA is powerful, but a poorly designed CDS can still be slow if it joins many large tables without selective filters or exposes too much data to the UI. Performance tuning starts with measuring generated SQL and execution plan. Avoid SELECT * style modeling. Push aggregation and filtering to the database, but keep the model understandable. Do not create one monster CDS for every requirement. Layer the model and test with production-like volume.

Code example

ABAP Code
// Weak design idea:// A CDS view that joins many large tables and exposes every field without filters// can become slow for UI and analytics consumers. // Better design principles:// 1. Select only required fields.// 2. Use meaningful WHERE filters.// 3. Use correct association cardinality.// 4. Keep reusable layers small.// 5. Aggregate at DB level when needed.// 6. Measure generated SQL and runtime. @EndUserText.label: 'Aggregated Revenue by Customer'define view entity ZI_RevenueByCustomer as select from vbrk{ kunag as Customer, waerk as Currency, sum( netwr ) as TotalRevenue}where fkdat >= '20240101'group by kunag, waerk // Purpose:// Aggregate in DB instead of moving all billing rows to ABAP.

Real project scenario

A consumption CDS used for Fiori loaded slowly because it exposed many associations and had no default filter. Adding mandatory selection fields and reducing unnecessary associations improved response time drastically.

Common mistakes

- Creating one monster CDS view. - Exposing too many associations. - No selective filters. - Ignoring generated SQL and execution plan.

Best practices

- Use selective filters. - Avoid unnecessary fields and associations. - Aggregate in DB where suitable. - Measure with realistic volume. - Keep CDS layers maintainable.

Interview angle

Architect-level answer should mention pushdown, cardinality, filters, data volume and trace-based validation.