Note
This parameter is introduced since OceanBase Database V1.4.
Description
memory_limit specifies the total memory size available.
Attributes
| Attribute | Description |
|---|---|
| Type | varchar |
| Default value | 0. The unit is MB. |
| Value range | [1G, +∞)
Note
|
| Modifiable | Yes. It can be modified using the ALTER SYSTEM SET statement. |
| Effective upon OBServer node restart | No |
Considerations
The default value of memory_limit is 0. If the value is not 0, the system ignores the setting of memory_limit_percentage and uses the value of memory_limit. Assume that a physical machine has 100 GB of memory. memory_limit_percentage is set to 80, which indicates that 80% of the memory can be used, and memory_limit is set to '90G'. In this case, the actual memory available for OceanBase Database on the physical machine depends on the value of memory_limit, that is, 90 GB. For more information about memory_limit_percentage, see memory_limit_percentage.
The value of
memory_limitis unlimited.If
memory_limitis set to a value greater than the total physical memory, other values calculated based onmemory_limitwill be excessively large.To restrict the memory size for running OceanBase Database, you can modify
memory_limitas required. After the modification, the backend parameter reloads the thread to dynamically enforce the setting without requiring a restart. However, you need to setmemory_limitto a value smaller than the total memory of the system.Notice
The value of
memory_limitmust be greater than the actual memory used by the OBServer node.
Examples
To set the total available memory for the OBServer node to 32 GB, use the following command:
obclient> ALTER SYSTEM SET memory_limit='32G';To query the current used memory (in GB), use the following command:
obclient> SELECT value/1024/1024/1024 used_gb FROM v$sysstat WHERE name LIKE '%observer memory%' AND con_id = 1 AND stat_id=140008 AND name='observer memory used size';