100% found this document useful (1 vote)
519 views9 pages

Sap Hana Memory Configuration Guideline Learning How To Manage Hana Memory

Sap Hana Memory configuration step by step describes the different memory pools in Sap Hana including system table pool, row tables pool, column tables pool, workspace pool, and free space pool. It provides instructions on how to check the current and peak used memory for Sap Hana databases and tenants using SQL queries to the M_HOST_RESOURCE_UTILIZATION and M_SERVICE_MEMORY tables. The document also discusses monitoring used memory thresholds over time and checking historical used memory levels.

Uploaded by

Devender5194
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
100% found this document useful (1 vote)
519 views9 pages

Sap Hana Memory Configuration Guideline Learning How To Manage Hana Memory

Sap Hana Memory configuration step by step describes the different memory pools in Sap Hana including system table pool, row tables pool, column tables pool, workspace pool, and free space pool. It provides instructions on how to check the current and peak used memory for Sap Hana databases and tenants using SQL queries to the M_HOST_RESOURCE_UTILIZATION and M_SERVICE_MEMORY tables. The document also discusses monitoring used memory thresholds over time and checking historical used memory levels.

Uploaded by

Devender5194
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/ 9

Sap Hana Memory Configuration Guideline Learning how

to manage hana memory


bestsaphanatraining.com/how-to-manage-sap-hana-memory.html

Sap Hana Memory configuration step by step

What is Sap Hana memory ?


Sap hana is made of various processes which reserve memory from the operating
system when the entire sap hana system starts. When databases are up and running,
Sap hana has to manage and follow its own memory consumption. Only part of the
requested memory is actually in used at any time. The pre-reserved memory is made of
a number of pools which are grouped into 2 sections. The used memory and the resident
memory.

What are the different memory pools in sap hana?


Hana memory is made with the following memory pools :

1. System Table pool


2. Row tables pool
3. Column tables pool
4. Workspace pool
5. free space pool

What is sap hana used memory?


1/9
Used memory is the total current memory required by sap hana at any time. In other
word, it is the memory actually used within the reserved memory. Also keep in mind we
are talking about memory at memory pool level.

What is the sap hana used memory for?


Sap hana used memory is used to hold all program code and stack, all data and system
tables, and the memory required for temporary computation. It is basically the entire
database system in a part of the reserved memory. In hana "used memory" pool are
column and the row tables.

Be aware that "Used memory" over time grows as it is storing all data which are
increasing year after year.

Queries and query results, caching, calculation are also part of the "Used memory". Bad
or long queries will influence the state of the "used memory"

How to check sap hana used memory with hana studio?


There are different ways to check total used memory for all indexservers. On one hand
you can look at the overview page in hana studio on the other hand you can run sql
queries from the database.

2/9
How to get current sap hana tenant database used
memory?
Note : Connect to a tenant database and execute the following query. To obtain used
memory for all databases run the sql query at the SYSTEMDB level.

select HOST, round(INSTANCE_TOTAL_MEMORY_USED_SIZE/1024/1024/1024, 3) as "Current Used


Memory GB"
from M_HOST_RESOURCE_UTILIZATION;

| HOST | Current Used Memory GB |


| ------ | ---------------------- |
| linux7 | 174 |

NB : Keep in mind, sap hana data tables and temporary result are stored in the
indexserver used memory area.
Connected to the relevant tenant database before running the following query to check
used memory for that specific database.

select HOST, round(TOTAL_MEMORY_USED_SIZE/1024/1024/1024, 2) as "Used Memory GB"


from M_SERVICE_MEMORY
where SERVICE_NAME = 'indexserver';

| HOST | Used Memory GB |


| ------ | -------------- |
| linux7 | 46.91 |

How to check sap hana used memory peak threshold?


When performance issues are in the picture, it is always a good idea to have a look at the
used memory and to crosscheck with resident memory. Peak used memory will show a
time of heavy load or intence transactions.

3/9
select top 1 HOST,
SERVER_TIMESTAMP,
round(INSTANCE_TOTAL_MEMORY_USED_SIZE/1024/1024/1024) as "Peak Used Memory GB"
from _SYS_STATISTICS.HOST_RESOURCE_UTILIZATION_STATISTICS
order by "Peak Used Memory GB" desc;

| HOST | SERVER_TIMESTAMP | Peak Used Memory GB |


| ------ | ----------------------------- | ---------------------- |
| linux7 | 2017-11-05 13:39:48.581000000 | 979 |

How to monitor sap hana used memory peak threshold?


Used memory is made of data which fluctuates up and down all the time. Day after day,
data is likely to increase. The peak limit is going up slowing. It is therefore necessary to
monitor its progression in order to avoid any requested memory to go over the real
physical memory or over the licenced memory threshold.

How to check sap hana used memory history?


The following sql script will bring up the 10 highest peak "memory used" dates. On one
hand, you will be able to evaluate whether your database is currently consumming more
and more memories at the present time. On the other hand, you will be able to see what
time and on which dates were the highest memory consumption events.

Showing today memory used

select top 10 HOST, SERVER_TIMESTAMP,


round(INSTANCE_TOTAL_MEMORY_USED_SIZE/1024/1024/1024) as "Used Memory GB"
from _SYS_STATISTICS.HOST_RESOURCE_UTILIZATION_STATISTICS
order by SERVER_TIMESTAMP desc

| HOST | SERVER_TIMESTAMP | Used Memory GB |


| ------ | ----------------------------- | ---------------------- |
| slzqcr | 2017-12-22 12:13:15.813000000 | 685 |
| slzqcr | 2017-12-22 12:12:15.534000000 | 685 |
| slzqcr | 2017-12-22 12:11:15.569000000 | 685 |
| slzqcr | 2017-12-22 12:10:15.564000000 | 685 |
| slzqcr | 2017-12-22 12:09:15.549000000 | 684 |
| slzqcr | 2017-12-22 12:08:15.882000000 | 685 |
| slzqcr | 2017-12-22 12:07:15.521000000 | 685 |
| slzqcr | 2017-12-22 12:06:15.498000000 | 683 |
| slzqcr | 2017-12-22 12:05:15.531000000 | 682 |
| slzqcr | 2017-12-22 12:04:15.522000000 | 680 |

Showing top memory used history

select top 10 HOST, SERVER_TIMESTAMP,


4/9
round(INSTANCE_TOTAL_MEMORY_USED_SIZE/1024/1024/1024) as "Used Memory GB"
from _SYS_STATISTICS.HOST_RESOURCE_UTILIZATION_STATISTICS
order by INSTANCE_TOTAL_MEMORY_USED_SIZE desc;

| HOST | SERVER_TIMESTAMP | Used Memory GB |


| ------ | ----------------------------- | ---------------------- |
| linux7 | 2017-11-05 13:39:48.581000000 | 179 |
| linux7 | 2017-11-05 13:40:48.516000000 | 178 |
| linux7 | 2017-11-07 07:00:48.593000000 | 173 |
| linux7 | 2017-11-01 07:00:49.180000000 | 173 |
| linux7 | 2017-11-03 07:00:49.575000000 | 173 |
| linux7 | 2017-11-06 07:00:48.585000000 | 173 |
| linux7 | 2017-11-05 07:00:48.579000000 | 173 |
| linux7 | 2017-10-26 07:00:03.543000000 | 173 |
| linux7 | 2017-10-25 07:00:03.567000000 | 173 |
| linux7 | 2017-10-24 07:00:03.517000000 | 172 |

How to check sap hana all column tables size?


Column tables are very space efficiant. In Sap hana they would be taking most of the
memory space in the used memory area. It is important to follow the column tables
growth overtime.

select host, round(sum(MEMORY_SIZE_IN_TOTAL)/1024/1024) as "Total Column Tables MB Used"


from M_CS_TABLES
group by host;

| HOST | Total Column Table MB Used |


| ------ | ------------------------------------- |
| linux7 | 13532 |

How to check sap hana column table total size per schema?
You may want to find out why used memory is growing up. Looking at the column table
total size growth per schema can be relevant during a batch heavy load transaction.

select schema_name, round(sum(MEMORY_SIZE_IN_TOTAL)/1024/1024) as "Column Tables MB Used"


from M_CS_TABLES
group by schema_name
order by "Column Tables MB Used" desc;

| SCHEMA_NAME | Column Tables MB Used |


| --------------------- | ------------------------------------- |
| SAPBRH | 12437 |
| _SYS_REPO | 590 |
| _SYS_STATISTICS | 387 |
| _SYS_RT | 7|
| _SYS_BI | 5|
| _SYS_TASK | 4|
5/9
How to check sap hana row table total size?
You should only find few row tables in sap hana used memory. They should be small
tables. Otherwise something is not going wrong. Sap hana is mainly dealing with column
tables for performance purposes. Those row tables are likely to move back and forward
to disk when memory space is needed. Too many of them would not be space and
performance efficient.

select host, round(sum(USED_FIXED_PART_SIZE + USED_VARIABLE_PART_SIZE)/1024/1024) as "Row


Tables MB Used"
from M_RS_TABLES
group by host;

| HOST | Row Tables MB Used |


| ------ | ------------------------------------- |
| linux7 | 3505 |

How to check sap hana row table total size per schema?
Sap hana engine will decide which tables to bring into the memory and how long they
will stay. The move to the memory area or to the disk can occur at any time depending
on the need for memory space.

select schema_name,
round(sum(USED_FIXED_PART_SIZE + USED_VARIABLE_PART_SIZE)/1024/1024, 2) as "Row Tables
MB Used"
from M_RS_TABLES
group by schema_name
order by "Row Tables MB Used" desc;

| SCHEMA_NAME | Row Tables MB Used |


| --------------------- | ------------------------------------- |
| SAPBRH | 3337.06 |
| SYS | 163.71 |
| _SYS_STATISTICS | 0.07 |

How to check sap hana row table size per schema?

6/9
select SCHEMA_NAME,
TABLE_NAME,
round((USED_FIXED_PART_SIZE + USED_VARIABLE_PART_SIZE)/1024/1024, 2) as "MB Used"
from M_RS_TABLES
where SCHEMA_NAME = 'SYS'
order by "MB Used" desc, TABLE_NAME;

| SCH | TABLE_NAME | MB Used |


| --- | ----------------------------------------------- | ------------------------------------- |
| SYS | CS_COLUMNS_ | 78.79 |
| SYS | RS_COLUMNS_ | 14.61 |
| SYS | CE_SCENARIOS_ | 14.45 |
| SYS | CS_VIEW_ATTRIBUTES_ | 13.56 |
| SYS | CS_TABLES_ | 10.87 |

What is sap hana Resident Memory?


Resident memory is the real physical memory that is currently used by processes. You
will find that within that resident physical memory is the pool "memory used" which
represent Sap hana, the operating system and any other programs.

How to check sap hana Resident Memory?


SELECT ROUND(SUM(PHYSICAL_MEMORY_SIZE/1024/1024/1024)) AS "DB RESIDENT Memory GB"
FROM SYS.M_SERVICE_MEMORY;

What is the difference between used memory and resident


memory in sap hana ?

7/9
The term "Resident memory" is looking at memory used at physical level where as the
term "Memory used" is looking at memory at the memory allocation pool level. The two
though, have lots in common as their size grows and shrinks according to data, queries,
calculation and other operations.

What is the sap hana memory allocation limit ?


A total physical memory size is calculated and predefined while preparing sap hana
installation. In order to avoid serious trouble if a particular query would be requesting
more memory than there is, a line of safefy is created. Sap hana allocate to itself all
memory its needs, up to that allocation limit. A memory request beyond that limit will
generate errors. It is therefore essential to follow the memory growth overtime and to
keep an alert when the used memory is approaching the allocation limit.

SELECT HOST, ROUND(ALLOCATION_LIMIT/1024/1024/1024, 2) as "Allocation Limit GB"


from PUBLIC.M_HOST_RESOURCE_UTILIZATION;

How to Manage Memory in Sap Hana?


Sap Hana is an in-memory database. It means the entire database is in memory. Hana
Memory is pre-reserved and managed all along when hana processes starts. Hana Data
upload from disk to memory, is part of the starting process. Hana database environment
will be only available when all essentiel data will be loaded into memory. Remember data
loading time is proportional to the data size. Hana is managing data location
automatically within the memory and will move back and forwards tables to disk when
necessary in order to free memory space.

How to monitor sap hana Memory?


It is important to monitor and keep an eye on sap hana memory threshold notifications.
Faillure to do so could lead to serious problems and errors when hana memory limit is
reached. It is therefore strongly adviced to follow the hana memory usage growth
8/9
progression, especially when new data is being imported into the system.

About Type LinkTo

Show total Sql SELECT round(sum(CODE_SIZE+STACK_SIZE)/1024/1024)


used memory script AS "Used Memory for Code and stack in MB" FROM
with stacks SYS.M_SERVICE_MEMORY;

9/9

You might also like