Source: » SAP HANA Memory Usage Explained
Used memory serves several purposes:
- Program code and stack
- Working space and data tables (heap and shared memory)
The program code area contains the SAP HANA database itself while it is running. Different parts of SAP HANA can share the same program code.
The stack is needed to do actual computations.
The heap and shared memory are the most important part of used memory. It is used for working space, temporary data and for storing all data tables.
You can use the M_SERVICE_MEMORY view to explore the amount of SAP HANA Used Memory as follows:
Total Memory Used:
SELECT round(sum(TOTAL_MEMORY_USED_SIZE/1024/1024)) AS "Total Used MB"
FROM SYS.M_SERVICE_MEMORY;
Code and Stack Size:
SELECT round(sum(CODE_SIZE+STACK_SIZE)/1024/1024) AS "Code+stack MB"
FROM SYS.M_SERVICE_MEMORY;
Total Memory Consumption of All Columnar Tables:
SELECT round(sum(MEMORY_SIZE_IN_TOTAL)/1024/1024) AS "Column Tables MB"
FROM M_CS_TABLES;
Total Memory Consumption of All Row Tables
SELECT round(sum(USED_FIXED_PART_SIZE +
USED_VARIABLE_PART_SIZE)/1024/1024) AS "Row Tables MB"
FROM M_RS_TABLES;
Total Memory Consumption of All Columnar Tables by Schema:
SELECT SCHEMA_NAME AS "Schema",
round(sum(MEMORY_SIZE_IN_TOTAL) /1024/1024) AS "MB"
FROM M_CS_TABLES GROUP BY SCHEMA_NAME ORDER BY "MB" DESC;
Regards,
Mahaveer Jain
