ERPClimb logoERPClimb
CDS Views
Architect / Cross-trackadvanced 9 min read

CDS Views Part 10: Performance and Troubleshooting

Lessons are open to try during our launch period. Some advanced content may move to Pro later. AI practice limits apply separately.

Key takeaway

Keep CDS pushdown fast: understand how view stacks become one SQL statement, avoid expensive patterns (functions in joins, to-many paths, early currency conversion, deep stacks, unused joins), and analyse slow views with the SQL CREATE statement, ST05, SQL Monitor, the ADT dependency analyzer and HANA PlanViz.

In this lessonShow sections

Visual overview

CDS Views Part 10: Performance and Troubleshooting — learning sheetFlow: Take a slow custom view and open its Dependency Analyzer → Run the consumer with ST05 active; record runtime → Move a currency conversion after aggregation, or replace a function-based join with a key join → Re-trace and compare. Key ideas: HOW A STACK EXECUTES; EXPENSIVE PATTERNS; DESIGN RULES; ANALYSIS TOOLS. Watch out: Pushdown is not automatically fast: moving a bad algorithm into the database still makes a bad algorithm — just harder to debug.ERPClimb.com / ARCH / LESSON 10/10 / LEARNING SHEETCDS Views Part 10: Performance and Troubleshooting1 · HOW IT FLOWS1Take a slowcustom view andopen its…2Run the consumerwith ST05active; record…3Move a currencyconversion afteraggregation, or…4Re-trace andcompare2 · KEY IDEAS EXPLAINEDHow A Stack ExecutesConsumer SELECT + all views below = one statement.Unused associations are not joined (join ondemand).Expensive PatternsFunctions/casts in ON conditions (concat, cast onkey fields) — no index use.To-many paths in field lists — row explosion, thenaggregation on top.Design RulesFilter early: selective fields available as plaincolumns so consumer WHERE reaches the base table.Aggregate before converting where business allows;convert on the reduced set.Analysis ToolsADT: open the view → Show SQL CREATE Statement tosee the generated SQL.ADT Dependency Analyzer: shows the full viewstack, join count and complexity.3 · REMEMBER · WATCH OUTRememberA CDS view stack is compiled into one SQL statement; HANA optimizesthe whole stack — but only what it can see and simplify.Most slow CDS views come from a few patterns: functions or casts injoin conditions, to-many paths, calculations/conversions on all rows…Tools: ADT "Show SQL CREATE Statement", Dependency Analyzer,ST05 SQL trace, SQL Monitor (SQLM), and HANA PlanViz for the execution…!Watch outPushdown is not automatically fast:moving a bad algorithm into thedatabase still makes a bad algorithm— just harder to debug.4 · IN A REAL PROJECTA group-currency sales dashboard took 90 seconds to open. ST05 showed one statement reading 30 millionVBAK/VBAP rows; PlanViz showed currency conversion running on every row before the filter on salesorganization was applied, because the filter field was a CASE-derived value. The team exposed sales…Original ERPClimb learning sheet • Verify against your SAP release and edition

Expert visual walkthrough

RAP · CDS · ODATA ACADEMY · Integration pathERPClimb.com

Performance and Troubleshooting

CDS Views · Chapter-specific technical teaching map

Integration path

1Concept

Reproduce symptoms

2Concept

Check metadata / logs

3Concept

Inspect backend

4Concept

Correct and retest

Tutor's chapter takeaway

Keep CDS pushdown fast: understand how view stacks become one SQL statement, avoid expensive patterns (functions in joins, to-many paths, early currency conversion, deep stacks, unused joins), and analyse slow views with the SQL CREATE statement, ST05, SQL Monitor, the…

In a real project

A group-currency sales dashboard took 90 seconds to open. ST05 showed one statement reading 30 million VBAK/VBAP rows; PlanViz showed currency conversion running on every row before the filter on sales organization was…

Watch out for

• Assuming "it's CDS, so it's fast" without measuring. • Currency conversion on every row before filtering or aggregation. • Consumers filtering on calculated fields instead of base columns. • Functions or casts in join…

Conceptual study map, not an SAP configuration screenshot or a guaranteed runtime sequence. Consult the lesson for implementation prerequisites and exceptions.

The situation: a real project scenario

A group-currency sales dashboard took 90 seconds to open. ST05 showed one statement reading 30 million VBAK/VBAP rows; PlanViz showed currency conversion running on every row before the filter on sales organization was applied, because the filter field was a CASE-derived value.
The team exposed sales organization as a plain column so the filter reached the base table, aggregated per currency before conversion, and removed two joins that no consumer used. The dashboard opened in 3 seconds, with totals reconciled against the old version.

Explanation

Parts 1 through 9 built a full CDS model; this final part is about keeping it fast in production. A CDS view stack compiles into a single SQL statement — the consumer's SELECT plus every view beneath it — and HANA optimizes that whole statement, but only what it can actually see and simplify.

Unused associations aren't joined at all (join on demand), but joins written directly into a view's definition stay part of the statement unless HANA can prove they're removable, which requires correct cardinality and no usage of the joined fields.

Pushdown is not automatically fast: moving a bad algorithm into the database still leaves you with a bad algorithm, just a harder one to debug.

Most slow CDS views trace back to a handful of recurring patterns: functions or casts inside ON conditions (such as concat or a cast on key fields), which prevent index use; to-many paths pulled into the field list, which explode rows before any aggregation happens on top; currency_conversion or unit_conversion applied to millions of rows before filtering; CASE expressions or other calculated fields used in a consumer's WHERE clause, which can't be pushed down to the base table's index; deep stacks of ten or more levels with repeated joins to the same table; and UNION views where one branch reads a huge table with no filters at all.

A few design rules follow from this. Filter early, keeping selective fields available as plain columns so a consumer's WHERE clause can actually reach the base table. Aggregate before converting currency or units wherever the business allows it, converting only the reduced result set. Join on key fields with matching types, and declare cardinality honestly. Keep consumption views thin, and avoid building consumption views on top of other consumption views. And in consumers, select only the fields you actually need, since fields from unused joins may then get pruned.

A set of tools support this analysis. In ADT, opening a view and choosing "Show SQL CREATE Statement" reveals the generated SQL, while the Dependency Analyzer shows the full view stack along with join count and complexity. ST05 gives you an SQL trace of the consumer, including duration and records per statement, plus an Explain function for the execution plan.

SQL Monitor (SQLM) shows which statements cost the most in production over time, and HANA PlanViz gives an operator-level plan showing exactly where rows explode or where filters get applied too late.

A practical troubleshooting workflow follows these tools in sequence: reproduce the problem with the exact consumer SELECT and data volume, trace it with ST05 and note duration and row counts, check the stack in the Dependency Analyzer, look for the patterns described above and test by removing one join or calculation at a time, then re-measure and compare row counts and totals after each change.

To put this into practice: take a slow custom view and open its Dependency Analyzer, run the consumer with ST05 active and record the runtime, move a currency conversion to after aggregation or replace a function-based join with a key join, then re-trace and compare. By the end you should be able to find and fix the typical causes of slow CDS views using measurements rather than guesses.

Code example

ABAP Code
// ===== STEP 1: SLOW - convert every row, then consumers filter/aggregate =====@AccessControl.authorizationCheck: #NOT_REQUIRED@EndUserText.label: 'Slow: conversion on all rows'define view entity ZI_SalesEurSlow  as select from vbak{  key vbeln as SalesOrder,      kunnr as SoldToParty,      erdat as CreationDate,      @Semantics.amount.currencyCode: 'TargetCurrency'      currency_conversion( amount             => netwr,                           source_currency    => waerk,                           target_currency    => cast( 'EUR' as abap.cuky ),                           exchange_rate_date => erdat,                           error_handling     => 'SET_TO_NULL' ) as NetAmountEur,      cast( 'EUR' as abap.cuky ) as TargetCurrency} // ===== STEP 2: FASTER - aggregate per currency first (Part 3 view), =====// =====         then convert only the few aggregated rows            =====@AccessControl.authorizationCheck: #NOT_REQUIRED@EndUserText.label: 'Faster: convert after aggregation'define view entity ZI_SalesEurFast  as select from ZI_SalesByCustomer{  key SoldToParty,  key TransactionCurrency,      @Semantics.amount.currencyCode: 'TargetCurrency'      currency_conversion( amount             => TotalNetAmount,                           source_currency    => TransactionCurrency,                           target_currency    => cast( 'EUR' as abap.cuky ),                           exchange_rate_date => $session.system_date,                           error_handling     => 'SET_TO_NULL' ) as TotalNetAmountEur,      cast( 'EUR' as abap.cuky ) as TargetCurrency}// Note: rate date changes from order date to today - confirm with business. * ===== STEP 3: classic consumer - select only needed fields =====REPORT zcds_perf_check. DATA: lv_t0    TYPE i,      lv_t1    TYPE i,      lv_ms    TYPE i,      lv_lines TYPE i. TYPES: BEGIN OF ty_row,         soldtoparty       TYPE kunnr,         totalnetamounteur TYPE netwr_ak,       END OF ty_row.DATA lt_row TYPE STANDARD TABLE OF ty_row. START-OF-SELECTION.* ===== STEP 4: measure (run with ST05 for the SQL detail) =====  GET RUN TIME FIELD lv_t0.  SELECT soldtoparty totalnetamounteur    FROM zi_saleseurfast    INTO TABLE lt_row.  GET RUN TIME FIELD lv_t1.   lv_ms = ( lv_t1 - lv_t0 ) / 1000.  DESCRIBE TABLE lt_row LINES lv_lines.  WRITE: / 'Rows:', lv_lines, / 'Runtime (ms):', lv_ms.

Watch out

Common mistakes

  • Assuming "it's CDS, so it's fast" without measuring.
  • Currency conversion on every row before filtering or aggregation.
  • Consumers filtering on calculated fields instead of base columns.
  • Functions or casts in join conditions.
  • Tuning without comparing row counts and totals afterwards.

Do this

Best practices

  • Measure first: ST05, SQLM, PlanViz.
  • Keep filter fields as plain columns; filter early.
  • Aggregate before converting where the business rule allows.
  • Review stacks with the Dependency Analyzer; remove unused joins.
  • After every tuning change, verify results against the original.

In the interview

Interview angle

Questions: "A CDS-based Fiori app is slow — how do you analyse it?", "Which CDS patterns hurt performance?", "Does pushdown always improve performance?"
Strong answer: reproduce, trace with ST05, check the stack in the Dependency Analyzer and the generated SQL, use PlanViz for the plan and SQLM for production hotspots. Typical causes: functions in joins, to-many paths, conversions on all rows, filters on calculated fields, deep stacks and unused joins. Pushdown helps only when the logic is set-based and filters early; a bad design in the database stays slow.

Practice this lesson

Quick check

0 of 3 questions attempted

Question 1 of 3

A dashboard view applies currency_conversion to every order row, then consumers filter by sales org and aggregate. What is the best improvement?

Practise this in an interview

Answer in your own words and get instant feedback, the way an interviewer would judge it.

1A CDS view is slow in production. How would you analyze and improve it?

2A Fiori consumption view exposes many associations and path fields and takes 90 seconds to load. How do you analyse and speed it up?

Try a related Code Lab

This published exercise covers the same SAP topic. Apply the ideas in a hands-on scenario, then return to review your answers.

Open: Slow CDS View Due to Too Many Joins and No Filters →

Was this lesson helpful?

Keep exploring

Referenced SAP objects

Reviewed reference pages for the objects this page mentions.

Check before use: lesson examples are educational, not a guarantee of correctness for your SAP edition or release. Sample code has not been executed on your SAP system. Confirm API availability, syntax, authorizations and business impact in an approved development or test environment.