SAP HANA SQL语句内存使用限制策略



By default , single SAP HANA query can consume 100% of available memory. If you want to safeguard your system from uncontrolled expensive queries then it’s a good idea to limit the memory consumption of single statement per host.

Starting HANA SP08 SAP introduced parameter statement_memory_limit to restrict the query at predefined memory consumption limit.

Queries will be aborted with OOM dump (“compositelimit_oom OR [MEMORY_LIMIT_VIOLATION] “😉 ,  if it reaches the limit specified by this parameter – statement_memory_limit .

Requirement: You want to limit query from consuming limitless HANA memory.

Prerequisite:  You need database user with INIFILE ADMIN system privilege assigned.You also need statement memory tracking feature enabled. You need to change following parameters , these parameters do not need restart.

global.ini > [resource_tracking] > enable_tracking = on

global.ini > [resource_tracking] > memory_tracking = on

This will populate the MEMORY_SIZE column of expensive statement trace( M_EXPENSIVE_STATEMENTS)


  • Connect to HANA system and open SQL console in HANA studio
  • Execute following SQL
SAP HANA SQL语句内存使用限制策略