HANA News Blog

HANA HotNews 3849542 - Unexpected Results

Matthias Sander • 13. November 2026

XLC Investigates - When ALTER TABLE Moves the Decimal Point in SAP HANA

If you’ve attended one of my SAP HANA training courses, you probably know that I sometimes have more fun running experiments in HANA than watching streams. SAP Note 3849542 gave me a good reason to spend another evening in the SQL console. How can an ALTER TABLE succeed, leave the row count unchanged, and turn 219 into 0.000219?

 

At XLC, this is the kind of work we do behind the scenes when an SAP Note raises a question for a customer system. I wanted to reproduce the symptom, find out which changes made it disappear, and see what evidence a HANA team could use to assess an upgrade that had already happened.

 

The results and timings below come from SAP HANA 2.00.089.04. I verified the functional test results on 2.00.089.06. I designed and ran the tests myself and used AI to help draft and edit this article.

 

The findings reflect XLC’s analysis and the test setups described here. The exact mapping to the internal FIXED formats is an interpretation of the observed results and remains unconfirmed for this issue.

 

How a successful ALTER TABLE changes stored values

SAP Note 3849542 describes an error when an ALTER TABLE changes the scale of a DECIMAL column in a column table while its internal representation stays the same. HANA can skip the required value conversion, and the statement can finish successfully. For example, a scale change can occur during an S/4HANA upgrade when Software Update Manager (SUM) executes the relevant DDL. Another example is an ABAP table conversion triggered by importing a transport that changes the definition of a custom Z table. Other operations can also trigger the relevant DDL. The note includes a separate reproduction scenario and identifies its short SQL example as an illustration of the symptom. SAP Note 3849542



The arithmetic explains the symptom. A fixed-point decimal can be thought of as an integer with an implied decimal point. At scale 6, 219 corresponds to the integer 219000000. To preserve 219 at scale 12, the integer must grow by a factor of one million. If the same integer is interpreted at scale 12, the value becomes 0.000219. In the failing tests below, the observed divisor was exactly 10^(target scale − source scale).

 

Here is the DDL at the center of one test. I ran it against a populated column table whose UNITS column started as DECIMAL(22,6), after committing the inserts and merging the delta.

What changed at precision 19 and 29?

At XLC, we wrote a SQLScript test procedure specifically for this investigation. I ran RUN_DECIMAL_SCALE_TESTS(0) to test each transition against a fresh table. The procedure compared the exact values and their frequencies before and after the DDL. A row count alone would have missed every scaling error in the run.

What if only the precision changes? Widening DECIMAL(5,3) to DECIMAL(8,3) would increase the number of available integer digits from two to five while keeping three fractional digits. A stored value such as 9.291 would still be 9.291. In the test run, I used DECIMAL(5,3) → DECIMAL(7,3) as a precision-only control, and all 1,006 values remained unchanged. With DECIMAL(5,3) → DECIMAL(7,4), the same target precision and an increase in scale from 3 to 4 produced values one-tenth of their original size.

 

For DECIMAL(12,6), raising the target precision from 18 to 19 changed the outcome with the target scale held at 8. For DECIMAL(22,6), the same happened from 28 to 29 with the target scale held at 12. The boundaries line up with the capacity of signed fixed-width integers.

A signed 8-byte integer can hold every 18-digit decimal integer and only part of the 19-digit range. The same relationship holds for 28 and 29 digits at 12 bytes. That gives us a hypothesis: crossing one of these boundaries changes the internal representation and takes a conversion path that preserves the value. The tests establish where the behavior changed in this matrix. The exact format and conversion path taken by each statement remain unconfirmed.

 

Compression changed the outcome in the lab

I ran DECIMAL(22,6) → DECIMAL(28,12) on two loaded column tables with the same 11,005 rows. Each contained 10,000 copies of 42. HANA chose SPARSE for one table. For the other, I disabled automatic compression optimization before inserting the data and verified that the loaded column reported DEFAULT immediately before the ALTER TABLE.

The column’s compression state at the time of the change matters for an investigation. When checking a test column in M_CS_COLUMNS, inspect LOADED alongside COMPRESSION_TYPE. HANA can also report DEFAULT for an unloaded column. SAP Help on checking column compression

 

What did the workaround cost in one timing test?

SAP’s workaround for the applicable HANA 2 SPS08 revisions disables the direct import optimization via the internal parameter direct_import_with_up. The note warns that this can affect ALTER TABLE performance. I timed the same change, DECIMAL(22,6) → DECIMAL(23,12), with the optimization disabled and active. I rebuilt the table from scratch between runs. The loaded column reported DEFAULT and contained 100,001,005 rows, including 100 million copies of 42. SAP Note 3849542

Execution took about 59 times as long with the optimization disabled in this pair of runs. This was a timing comparison on one deliberately skewed dataset, with one measurement per setting. How the workaround affects other tables and upgrade runtimes remains open.

 

Our working hypothesis is that the slowdown is limited to ALTER TABLE operations that change a DECIMAL column and would otherwise use the direct import optimization. In my tests, I observed no slowdown for delta merges, compression optimization, or partitioning.

 

How to assess a system and brief management

Start with the HANA revision and the effective configuration when the DDL ran. Then build a list of candidate column changes from the HANA audit log, any available executed_statement trace, and the SUM phase logs. For each candidate, recover the physical HANA column definition before and after the change. Look for a scale change and establish the column’s compression state at that time where historical evidence is available.

 

For ABAP-managed tables, compare DD02L (table metadata) and DD03L (field metadata) with a pre-change copy, if available. This helps identify changes in the ABAP Dictionary. Verify the actual source and target DECIMAL definitions against historical HANA metadata or DDL before deciding whether a column change is in scope.

 

Once the physical column definitions are known, you can narrow the candidate list:

 

  • DECIMAL(14,3) → DECIMAL(15,3) can be excluded for this issue because the scale remains 3.
  • DECIMAL(5,3) → DECIMAL(19,5) crosses the precision-19 boundary. Under our proposed mapping, this would switch from FIXED8 to FIXED12, putting the change outside the scenario described in the note if that representation change is verified. This exact transition was outside the published test matrix.


Apply these exclusions to individual column changes. A table can be removed from the candidate list once every relevant column change has been ruled out.



Details: FIXED8

A FIXED8 is sent as an 8-byte signed integer in little-endian format.

The field has a length of 9 bytes if the value is not NULL and 1 byte if the value is NULL. 



Details: FIXED12

A FIXED12 is sent as a 12 byte signed integer in little-endian format.

The field has a length of 13 bytes if the value is not NULL and 1 byte if the value is NULL.     

         

In my lab, the audit record showed SUCCESSFUL and included the target DECIMAL(28,12) definition. I knew the source definition from the setup and had measured compression separately. The before-and-after data comparison established that the values had changed. On a customer system, a pre-change backup restored to a comparison system or a trusted historical extract can provide that baseline. Account for legitimate business updates between the two snapshots when comparing values.

 

The management question is usually straightforward: Can we say with certainty whether this happened to our data? Without a reliable comparison point, the team can identify candidate changes and investigate suspicious values, but cannot conclusively confirm or rule out historical changes across the affected data. Report which changes you found, which columns you verified against a baseline, and where the evidence is still missing. If the comparison confirms affected rows, use the correction guidance in the note and establish the affected row set before applying any update. SAP Note 3849542

SAP HANA News by XLC

von Jens Gleichmann • 27. Oktober 2026
The topic of HANA performance is one of the most discussed topics in nearly every single SAP project we are involved. Performance has always been an important aspect in general; however, particularly when switching databases or application releases - whether moving from anyDB to HANA or, more specifically, from ERP on
Orientation in DMO scenarios
von Dominik Fiedler • 21. Oktober 2026
There are multiple DMO scenarios and use cases. We heard of many confusions and mixed up statements which we want to order: SUM can not only update software components, but can also execute a database migration (for ABAP based systems)
DMOVE2S4 and Homogeneous option for SAP SUM DMO
von Jens Gleichmann • 21. Oktober 2026
DMO used to be heterogeneous (change of DB). Now you can use DMO with system move (also on-prem to target on-prem) to migrate and convert ECC on HANA to S/4 or just update/upgrade S/4 and move it to another location like other DC or other instance in one step. The DMOVE2S4 is just to move and convert to the cloud in one step. This includes also anyDB source systems and downtime-optimization techniques (doDMO and doC).
von Dominik Fiedler • 7. August 2026
SAP HANA Monitoring Views Cheat Sheet
HANA OS maintenance
von Jens Gleichmann • 27. Juli 2026
Please notice that when you want to run HANA 2.0 SPS07, you need defined OS levels. As you can see RHEL7 and SLES12 are not certified for SPS07. The SPS07 release of HANA is the basis for the S/4HANA release 2023 which is my recommended go-to release for the next years. Keep in mind that you have to go to SPS07 when you are running SPS06 because it will run out of maintenance end of 2023.
von Jens Gleichmann • 14. April 2026
KVM as alternative with low TCO
inverted individual index is a special type of SAP HANA index wich can save memory
von Jens Gleichmann • 6. April 2026
An inverted individual index is a special type of SAP HANA index which can only cover unique indexes. This includes all primary key structures. Unlike traditional column store indexes on more than one column (inverted value, inverted hash) an inverted individual index (Inv Idv Idx) doesn't need a dedicated concat.
Total NSE savings
von Jens Gleichmann • 5. April 2026
This blog presents the results of a customer case which can be used as a reference for other implementations
SAP HANA performance issues with THP on multi-NUMA node systems
von Jens Gleichmann • 30. März 2026
SAP HANA systems may experience high swap usage, hangs, or performance issues when THP (Transparent Huge Pages) is enabled with "madvise". This occurs on multi-NUMA node systems where one or more NUMA nodes are close to full memory usage while others have plenty of free memory, and counters for THP allocations, direct
Transparent Huge Pages (THP) with madvise can trigger high swap usage and performance issues
von Matthias Sander • 26. Januar 2026
Transparent Huge Pages (THP) with madvise can trigger high swap usage, performance issues, or even system hangs on multi-NUMA systems.
more