MEM_LIMIT Query Option
The MEM_LIMIT query option defines the maximum amount of memory a query can allocate on each node. The total memory that can be used by a query is the MEM_LIMIT times the number of nodes.
There are two levels of memory limit for Impala. The -mem_limit startup option sets an overall limit for the impalad process (which handles multiple queries concurrently). That limit is typically expressed in terms of a percentage of the RAM available on the host, such as -mem_limit=70%. The MEM_LIMIT query option, which you set through impala-shell or the SET statement in a JDBC or ODBC application, applies to each individual query. The MEM_LIMIT query option is usually expressed as a fixed size such as 10gb, and must always be less than the impalad memory limit.
If query processing exceeds the specified memory limit on any node, either the per-query limit or the impalad limit, Impala cancels the query automatically. Memory limits are checked periodically during query processing, so the actual memory in use might briefly exceed the limit without the query being cancelled.