Skip to main content
These settings are available in system.settings and are autogenerated from source.

max_memory_usage

Cloud default value: depends on the amount of RAM on the replica. The maximum amount of RAM to use for running a query on a single server. A value of 0 means unlimited. This setting does not consider the volume of available memory or the total volume of memory on the machine. The restriction applies to a single query within a single server. You can use SHOW PROCESSLIST to see the current memory consumption for each query. Peak memory consumption is tracked for each query and written to the log. Memory usage is not fully tracked for states of the following aggregate functions from String and Array arguments:
  • min
  • max
  • any
  • anyLast
  • argMin
  • argMax
Memory consumption is also restricted by the parameters max_memory_usage_for_user and max_server_memory_usage.

max_memory_usage_for_user

The maximum amount of RAM to use for running a user’s queries on a single server. Zero means unlimited. By default, the amount is not restricted (max_memory_usage_for_user = 0). Also see the description of max_memory_usage. For example if you want to set max_memory_usage_for_user to 1000 bytes for a user named clickhouse_read, you can use the statement
You can verify it worked by logging out of your client, logging back in, then use the getSetting function:
Last modified on July 23, 2026