← All posts

SAP HANA Performance Optimization

Rank by Runtime Times Frequency: Find Your Top SAP Fixes

Rank by Runtime Times Frequency: Find Your Top SAP Fixes

Fixing what feels slow is not the same as fixing what costs the most. A report that takes four minutes once a month annoys one finance manager. A 300-millisecond lookup that fires two million times a day quietly eats your database. Teams chase the first and ignore the second. Measurement-led SAP HANA Performance Optimization flips that habit, and 2isolutions US, an SAP partner delivering since 2005, builds its method around it.

What does ranking by runtime times frequency actually mean?

Ranking by runtime times frequency means multiplying how long a piece of code takes by how often it runs, then sorting the results from highest to lowest total cost. The top of that list shows where your system spends its time. Everything below it matters far less.

The idea sounds simple. In practice, most teams never do it. Instead, they fix whatever users complain about loudest, or whatever a developer remembers being slow.

Consider two examples. A custom report runs for 240 seconds and executes twice a week. Its weekly cost is 480 seconds. A small pricing routine runs for half a second but fires 800,000 times a day. Its daily cost is 400,000 seconds. The routine costs far more, yet nobody complains about it because each call feels instant.

That gap explains why user complaints make a poor priority list. Users notice latency. They don't notice load. Your database notices only load.

Why perception misleads

Human attention locks onto the single long wait. Aggregate cost stays invisible without tooling. As a result, teams spend weeks tuning dramatic but rare slowdowns while the real drain runs untouched in the background.

Why does the first week of measurement deliver the biggest gain?

The first week delivers the largest gain because cost is never spread evenly across your code. A small group of objects usually accounts for most of the total runtime. Measurement finds that group fast, so early fixes remove the biggest burden before effort starts to taper off.

Think of it as a steep curve. The first few items on a ranked list carry enormous weight. By the thirtieth item, you are polishing code that barely registers in your workload traces.

This is the core argument behind our approach. You don't need months of analysis to find the heavy hitters. Still, a focused week of measurement, ranked correctly, points to the changes that move the numbers.

Teams that skip measurement often work the other way around. They start with a long wish list, assign it by seniority or noise, and burn the first month on low-yield items. Then the budget thins out right when the real problems surface.

Here is what a measured first week usually produces:

  • A ranked list of the most expensive programs, functions and SQL statements
  • Clear evidence of which anti-patterns drive that cost
  • A baseline runtime for every candidate fix
  • A defensible order of work that finance and IT leaders can both read

That baseline matters most. Without it, you cannot prove any later improvement.

How does the five-step method work in practice?

The method has five steps: Measure, Analyse, Rank by runtime times frequency, Rewrite with HANA pushdown, and Prove with row-by-row parity and before and after runtimes. An architect reviews every change before it moves to transport. Each step feeds the next, so nothing gets rewritten without evidence.

Here is the sequence in order:

  1. Measure: Capture real runtimes and call counts from your production-like workload, not from a developer's test run.
  2. Analyse: Trace the expensive objects to the exact statements and loops that cause the cost.
  3. Rank by runtime times frequency: Sort every candidate by total cost, not by how slow it feels.
  4. Rewrite with HANA pushdown: Move the heavy logic into the database, where it runs on the engine built for it.
  5. Prove: Compare output row by row against the original, then record before and after runtimes.

Step five is where many projects fall short. A faster program that returns slightly different numbers is a defect, not an improvement. Row-by-row parity shows the business result stays identical.

The architect review gate

Before any change reaches transport, an architect reviews it. Therefore, this catches side effects that automated checks miss, such as a changed sort order that a downstream job relied on. The gate costs little and prevents expensive rollbacks.

Which anti-patterns hide the highest costs?

The three anti-patterns that most often top a ranked list are database calls inside loops, full-table scans, and aggregation in ABAP instead of the database. Each one multiplies cost because it repeats work or moves too much data. Fixing them usually delivers the largest single gains.

Let's take them one at a time.

Database calls inside loops

A loop that reads one record per iteration sends a separate request to the database each time. Ten thousand iterations mean ten thousand round trips. Each trip looks harmless alone, yet together they dominate the runtime.

The fix is usually one set-based read before the loop. The program then works from memory. Frequency drops from thousands to one, and that is exactly the variable the ranking method targets.

Full-table scans

A full-table scan reads every row to find a few. On a small table, nobody notices. On a table with years of transaction history, it becomes a constant tax. Missing selection criteria or poorly chosen filters cause most of these.

Aggregation in ABAP instead of the database

Developers often pull raw rows into the application server, then sum and group them in ABAP. That moves huge volumes across the network to do work HANA handles in-memory. Pushing the aggregation down lets the database return only the answer.

These patterns often sit in older custom code. A thorough SAP custom code assessment surfaces them early, and it shows which objects deserve a rewrite first.

How does AI speed up finding the highest-impact fixes?

AI speeds up this work by scanning large volumes of runtime data and code at once, then surfacing the costliest patterns without manual sifting. It correlates call counts, runtimes and code structure faster than a human reviewer can. Engineers then spend their time on judgment, not on data wrangling.

Manual ranking works on a small system. It breaks down when you have tens of thousands of custom objects and months of trace data. That is where machine assistance earns its place, and Oxford Economics AI value research shows why more enterprises are investing in it.

Modern SAP AI Solutions can read execution traces, group similar statements and flag loops that hide database calls. They can also draft candidate rewrites for engineers to test. The human still decides what ships.

The same logic applies to wiring these tools into your existing stack. SAP AI Integration works best when it feeds a measured process rather than replacing one. Likewise, if the model suggests a fix, the baseline and the parity check still decide whether it counts.

A newer pattern is gaining attention as well. Agentic Ai SAP workflows let software agents run a chain of tasks, such as pulling traces, ranking objects and preparing test cases, with an engineer approving each gate. These agents save hours of repetitive work. However, they don't remove the architect review, and they shouldn't.

Where AI stops and engineers start

AI ranks and drafts. Engineers validate and approve. Treat model output as a strong lead, never as proof. The row-by-row parity step exists precisely because a fast answer that looks right can still be wrong.

What does this mean for S/4HANA migration and custom code?

For S/4HANA projects, ranking by total cost tells you which custom code to fix first and which to retire. Code that runs rarely and cheaply can wait or disappear. Code that runs constantly and slowly deserves immediate rewriting before and during the move.

Migration programs create a natural moment for this work. Teams must touch custom code anyway, so S/4HANA custom code remediation and performance work can share one backlog. As a result, that avoids fixing the same object twice.

Pair ranking with a clear view of your SAP ABAP performance optimization needs. Some objects need only a small change to a select statement. Others need a full pushdown rewrite using HANA-native capabilities. Ranking separates the two.

The same discipline supports SAP HANA performance tuning at the database layer. Index choices, table design and memory use all matter, but they matter most when you know which workloads hit them hardest. Tuning without a ranked workload is guesswork.

You can review SAP's own overview of the platform on the SAP S/4HANA product page to see how the database and application layers fit together.

Here is a practical checklist for leaders planning this work:

  • Ask for a measured baseline before approving any tuning budget
  • Require a ranked list, not a list sorted by complaints
  • Insist on row-by-row parity proof for every rewrite
  • Confirm an architect reviews each change before transport
  • Track total cost saved, not only the single slowest report

How should consultants and hiring leaders approach this skill set?

Consultants who can measure, rank and prove their work stand out, and hiring leaders should screen for exactly that. Tool knowledge matters less than method. Someone who can explain why they fixed object A before object B shows real performance judgment.

For SAP professionals, this is a practical way to build value. Learn to read traces. Learn to calculate total cost. Practice HANA pushdown patterns until rewriting a loop into a set-based query feels routine. Consequently, these skills transfer across clients and projects.

For IT directors, the interview question is simple. Ask a candidate how they decide what to fix first. If the answer starts with "whatever users complain about," keep looking. If it starts with "I measure and rank by total cost," you have found someone who thinks like an engineer.

Teams in the US market often face tight go-live dates and thin benches. Experienced performance specialists are scarce, so many organizations bring in outside help for the measurement phase and keep the long-term ownership in house. That model works well when the outside team documents everything.

Frequently Asked Questions

Q. What is runtime times frequency in SAP performance work?

A. It is the total cost of a code object, found by multiplying its runtime by how often it executes. Sorting by this number shows where your system truly spends its time. It often differs sharply from the list of reports users complain about.

Q. How long does it take to find the highest-impact fixes?

A. A focused measurement and ranking effort can surface the top candidates within the first week. The exact timing depends on system size and trace data quality. Early ranking gives you the largest gains before effort tapers off.

Q. Do I need AI to rank performance fixes?

A. No, but it helps on large systems with many custom objects. AI scans traces and code faster than manual review. Engineers still validate every result, and 2isolutions US pairs automated ranking with architect review before transport.

Q. What proves a performance fix did not break anything?

A. Row-by-row parity compares the output of the rewritten code against the original. Recorded before and after runtimes then show the speed gain. Together they prove the change is both faster and correct.

Q. Which anti-patterns should we look for first?

A. Start with database calls inside loops, full-table scans, and aggregation done in ABAP instead of the database. These patterns repeat work or move too much data. They commonly sit near the top of a ranked list.

Start with the numbers, then fix in order

Performance work succeeds when it follows evidence. Slow-feeling reports grab attention, but total cost tells the truth. Ranking by runtime times frequency turns a vague complaint into an ordered plan, and the first week of measurement captures the largest share of the benefit.

The five steps keep the work honest. Measure first, analyse the cause, rank by total cost, rewrite with HANA pushdown, then prove the result with parity checks and before and after runtimes. Meanwhile, an architect review closes the loop before anything moves to transport.

2isolutions US has delivered SAP work since 2005, and this measurement-led method sits at the center of how its team approaches performance. If your system feels slow and nobody can say why, a ranked baseline is the right place to begin.

Email us at [email protected] to request a demo of AI performance optimization.

Want this applied to your SAP estate?

Tell us where you are and we'll come back with a concrete next step.

Talk to our team