blob: fa212b2a35e9e4e80d1c4f7b89e6606d3f85f53d [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?>
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
<!DOCTYPE concept PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
<concept rev="3.1.0" id="topn_bytes_limit">
<title>TOPN_BYTES_LIMIT Query Option (<keyword keyref="impala31_full"/> or higher only)</title>
<titlealts audience="PDF">
<data name="Category" value="Impala"/>
<data name="Category" value="Impala Query Options"/>
<data name="Category" value="Querying"/>
<data name="Category" value="Developers"/>
<data name="Category" value="Data Analysts"/>
The <codeph>TOPN_BYTES_LIMIT</codeph> query option places a limit on the amount of
estimated memory that Impala can process for <i>top-N</i> queries.
<i>Top-N</i> queries are the queries that include both <codeph>ORDER BY</codeph> and
<codeph>LIMIT</codeph> clauses. <i>Top-N</i> queries don't spill to disk so they have to
keep all rows they process in memory, and those queries can cause out-of-memory issues
when running with a large limit and an offset. If the Impala planner estimates that a
<i>top-N</i> operator will process more bytes than the <codeph>TOPN_BYTES_LIMIT</codeph>
value, it will replace the <i>top-N</i> operator with the <i>sort</i> operator. Switching
to the <i>sort</i> operator allows Impala to spill to disk, thus requiring less memory
than <i>top-N</i>, but potentially with performance penalties.
The option has no effect when set to 0 or -1.
<codeblock>SET TOPN_BYTES_LIMIT=<varname>limit</varname></codeblock>
<b>Type:</b> Number
<b>Default:</b> 536870912 (512 MB)
<b>Added in:</b> <keyword keyref="impala31"/>