0% found this document useful (0 votes)
140 views2 pages

2375917___How_To__Converting_SAP_HANA_VARBINARY_columns_to_LOB_v11

This document provides guidance on converting SAP HANA VARBINARY columns to LOB to optimize memory usage, particularly for large values. It outlines the necessary steps for conversion, including considerations for downtime, backup, and verification of results. The document also highlights important restrictions and recommendations to ensure a successful conversion process.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
140 views2 pages

2375917___How_To__Converting_SAP_HANA_VARBINARY_columns_to_LOB_v11

This document provides guidance on converting SAP HANA VARBINARY columns to LOB to optimize memory usage, particularly for large values. It outlines the necessary steps for conversion, including considerations for downtime, backup, and verification of results. The document also highlights important restrictions and recommendations to ensure a successful conversion process.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

SAP Knowledge Base Article

2375917 - How-To: Converting SAP HANA VARBINARY columns to LOB


Component: HAN-DB (SAP HANA > SAP HANA Database), Version: 11, Released On: 25.03.2025

Symptom
Tables with VARBINARY columns occupy a lot of memory and you are interested in optimizing the memory footprint.

Environment
SAP HANA, ABAP

Cause
Columns with large values (e.g. attachments, spool lists or ABAP sources) are typically stored in LOB fields on SAP HANA side (see SAP Note 2220627). This can significantly reduce the memory requirements, because disk LOBs aren't loaded into the row store / column store and instead
remain on disk. A typical threshold for disk LOBs is 1000 byte (see SAP Note 1994962), so all values with a size of more than 1000 byte are stored on disk and not loaded into memory.
In ABAP environments with SAP_BASIS <= 7.52 fields with large values with a maximum size of up to 5000 byte will be mapped to the VARBINARY type on SAP HANA side. VARBINARY values are generally loaded into memory. With SAP_BASIS >= 7.53 a LOB data type is used, but it will
only take effect for new tables or in case of a table conversion. For tables with VARBINARY columns containing a lot of large values between 1000 and 5000 byte it can be beneficial from a memory perspective to convert them to a LOB data type. With SAP_BASIS >= 7.53 this is possible via
transaction SE14 -> enter table name -> "Edit" -> "Extras" -> "Force Conversion", but this involves some overhead because all data has to be processed on ABAP application server side.
This SAP Note describes how a VARBINARY field can be converted to LOB on SAP HANA level. As an alternative you can also consider to take advantage of paged attributes / Native Storage Extension (SAP Note 2799997) so that unused column pages are evicted from memory in an LRU
manner.
Attention: Converting a VARBINARY field to a LOB of a table used in data aging (SAP Note 2416490) is not recommended, since up to SAP HANA 2.0 SPS 03 LOB data types are not supported as paged attributes.
Attention: See SAP Note 2220627 ("Are there restrictions in processing LOB columns?") and make sure that a VARBINARY to LOB conversion is only performed when the mentioned operations aren't used in context of the column.
Attention: The conversion to LOB must only be done if a significant number of column values is larger than 1 KB because shorter LOB values are also loaded into memory and so there wouldn't be any difference to VARBINARY. Furthermore, it would introduce an inconsistency on ABAP side
if you switch to LOB on database level although the maximum column size is below 1 KB. In some cases, you may both increase the column size and adjust the data type, see SAP Note 3580132 for table BALDAT.
You can use SQL: "HANA_Tables_ColumnStore_Columns" (DATA_TYPE = 'VARBINARY') available via SAP Note 1969700 in order to determine VARBINARY columns with a particularly high memory consumption.
Example:

-----------------------------------------------------------------------------------
|TABLE_NAME |COLUMN_NAME |NUM_DISTINCT|COMPRESSION|DATA_TYPE|MEM_TOTAL_MB|
-----------------------------------------------------------------------------------
|RSRWBSTORE |CLUSTD | 5553869|DEFAULT |VARBINARY| 15494.69|
|RSBATCHDATA |CLUSTD | 4592640|INDIRECT |VARBINARY| 2064.49|
|RSR_CACHE_DATA_C|CLUSTD | 417961|DEFAULT |VARBINARY| 1552.38|
|SOC3 |CLUSTD | 1953200|DEFAULT |VARBINARY| 1269.21|
|YRSZWOBJ |CLUSTD | 248964|DEFAULT |VARBINARY| 836.25|
-----------------------------------------------------------------------------------

Resolution
Proceed according to the following steps in order to convert VARBINARY columns to LOBs.

Action Details

Consider LOB restrictions See SAP Note 2220627 ("Are there disadvantages having too many hybrid LOBs?") in order to make yourself comfortable with potential negative consequences of introducing additional LOB columns. Only proceed with the next steps if you expect an overall positive impact from a VA
RBINARY -> LOB conversion.

Define downtime window The conversion requires a lock on the table, so concurrent modifications aren't possible. For that reason you optimally execute this change during a planned downtime window.

Backup Make sure that a good database backup is in place that can be used in the unlikely case something goes wrong. You may additionally also create a backup of the original table using a command like:

CREATE TABLE "<schema_name>"."<table_name>_BACKUP" LIKE "<schema_name>"."<table_name>" WITH DATA


VARBINARY -> LOB convers Now you can convert the data type of the VARBINARY column with the following command. As VARBINARY contains binary information, BLOB is the proper LOB specific data type:
ion
ALTER TABLE "<schema_name>"."<table_name>" ALTER ("<column_name>" BLOB MEMORY THRESHOLD 1000)

Example: (column CLUSTD of table CRMORDERCONT in schema SAPSR3)

ALTER TABLE "SAPSR3"."CRMORDERCONT" ALTER ("CLUSTD" BLOB MEMORY THRESHOLD 1000)

Verification of results Double check that everything is fine for the table (correct number of records, no issues when accessing it from SAP ABAP side, ...).

You may also execute a LOB consistency check as described in SAP Note 2220627 ("How can the consistency of LOBs be checked?"):

CALL CHECK_TABLE_CONSISTENCY('CHECK_LOBS', '<schema_name>', '<table_name>')

Drop backup table Once you have verified that everything is working fine, you can drop the backup table:

DROP TABLE "<schema_name>"."<table_name>_BACKUP"

Keywords
VARBINARY hybrid LOB conversion memory disk

Products
Products

SAP HANA, platform edition all versions

This document refers to


SAP Note/KBA Component Title

2799997 HAN-DB-NSE

2416490 HAN-DB FAQ: SAP HANA Data Aging in SAP S/4HANA

2220627 HAN-DB FAQ: SAP HANA LOBs

1999997 HAN-DB FAQ: SAP HANA Memory

1994962 HAN-DB How-To: Activation of Hybrid LOBs in SAP HANA

3580132 BC-SRV-BAL Large memory requirement of table BALDAT in SAP HANA

This document is referenced by


SAP Note/KBA Component Title

2044468 FAQ: SAP HANA Partitioning

3460914 HAN-DB How to adjust the length of column in HANA

1999993 HAN-DB-MON How-To: Interpreting SAP HANA Mini Check Results

2969336 HAN-DB High memory utilization with table LTEX

2220627 HAN-DB FAQ: SAP HANA LOBs

3271502 HAN-DB LTVF - Landscape Transformation Validation Framework

You might also like