> ## 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.

# min_bytes_* session settings

> ClickHouse session settings in the min_bytes_* generated group.

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

## min\_bytes\_before\_external\_group\_by

Type

UInt64

Default

0

The minimum size in bytes of the aggregation state of one thread before external `GROUP BY` writes it to disk.

When the memory of the query is over `max_bytes_before_external_group_by` or `max_bytes_ratio_before_external_group_by` because of other operators, for example a hash join that holds a large table, each thread would otherwise write every block it aggregates to disk as a separate small file. Reading many small files back costs more memory than the writes saved. With this setting a thread keeps aggregating until its own state reaches the given size, and only then writes it out as one file.

The memory used above the threshold is bounded by this value multiplied by the number of threads.

Possible values:

* A positive integer, the size in bytes.
* `0` — no minimum, the state is written as soon as the threshold is reached.

## min\_bytes\_to\_spill

[Experimental feature](https://clickhouse.com/docs/reference/settings/beta-and-experimental-features.md#experimental-features)

Type

UInt64

Default

67108864

Used in workload scheduling.
The minimum amount of bytes to spill.
This setting takes effect only if MEMORY RESERVATION resource is created.

## min\_bytes\_to\_use\_direct\_io

Type

UInt64

Default

0

The minimum data volume required for using direct I/O access to the storage disk.

ClickHouse uses this setting when reading data from tables. If the total storage volume of all the data to be read exceeds `min_bytes_to_use_direct_io` bytes, then ClickHouse reads the data from the storage disk with the `O_DIRECT` option.

Possible values:

* 0 — Direct I/O is disabled.
* Positive integer.

## min\_bytes\_to\_use\_mmap\_io

Type

UInt64

Default

0

This is an experimental setting. Sets the minimum amount of memory for reading large files without copying data from the kernel to userspace. Recommended threshold is about 64 MB, because [mmap/munmap](https://en.wikipedia.org/wiki/Mmap) is slow. It makes sense only for large files and helps only if data reside in the page cache.

Possible values:

* Positive integer.
* 0 — Big files read with only copying data from kernel to userspace.
