> ## Documentation Index
> Fetch the complete documentation index at: https://clickhouse.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# max_result_* session settings

> ClickHouse session settings in the max_result_* generated group.

export const SettingsInfoBlock = ({type, default_value, changeable_without_restart}) => {
  return <div className="not-prose" style={{
    display: "flex",
    flexWrap: "wrap",
    alignItems: "baseline",
    columnGap: "0.5rem",
    rowGap: "0.125rem",
    margin: "0.375rem 0",
    fontSize: "0.8125rem",
    lineHeight: "1.125rem"
  }}>
      <div style={{
    fontWeight: 600,
    opacity: 0.72
  }}>Type</div>
      <div style={{
    overflowWrap: "anywhere"
  }}>{type}</div>
      <div style={{
    fontWeight: 600,
    opacity: 0.72,
    marginInlineStart: "0.5rem"
  }}>Default</div>
      <div style={{
    overflowWrap: "anywhere"
  }}>{default_value}</div>
      {changeable_without_restart && <div style={{
    fontWeight: 600,
    opacity: 0.72,
    marginInlineStart: "0.5rem"
  }}>
          Changeable without restart
        </div>}
      {changeable_without_restart && <div style={{
    overflowWrap: "anywhere"
  }}>
          {changeable_without_restart}
        </div>}
    </div>;
};

These settings are available in [system.settings](/docs/reference/system-tables/settings) and are autogenerated from [source](https://github.com/ClickHouse/ClickHouse/blob/master/src/Core/Settings.cpp).

<h2 id="max_result_bytes">
  max\_result\_bytes
</h2>

<SettingsInfoBlock type="UInt64" default_value="0" />

Limits the result size in bytes (uncompressed). The query will stop after processing a block of data if the threshold is met,
but it will not cut the last block of the result, therefore the result size can be larger than the threshold.

**Caveats**

The result size in memory is taken into account for this threshold.
Even if the result size is small, it can reference larger data structures in memory,
representing dictionaries of LowCardinality columns, and Arenas of AggregateFunction columns,
so the threshold can be exceeded despite the small result size.

<Warning>
  The setting is fairly low level and should be used with caution
</Warning>

<h2 id="max_result_rows">
  max\_result\_rows
</h2>

<SettingsInfoBlock type="UInt64" default_value="0" />

Limits the number of rows in the result. Also checked for subqueries, and on remote servers when running parts of a distributed query.
No limit is applied when the value is `0`.

The query will stop after processing a block of data if the threshold is met, but
it will not cut the last block of the result, therefore the result size can be
larger than the threshold.
