# read_rnd_buffer_size

> Buffer for reading rows in sorted order and for Multi-Range Read.

Source: https://sqlly.app/sql-configuration/mysql/read-rnd-buffer-size
Last updated: 2026-11-30
License: Text and data [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) (credit SQLly, sqlly.app); code and SQL snippets [MIT](https://opensource.org/license/mit). [Details](https://sqlly.app/license).

**Default**

`256KB`

**Range**

1 to 2147483647 bytes

**Restart needed**

No

**Default checked on**

MySQL 8.4 LTS

## What it does

When rows of a MyISAM table are read back in sorted order after a key sort, they go through this buffer to avoid disk seeks. It also drives Multi-Range Read (MRR) for any storage engine, which batches row lookups from a range scan into sequential reads. Most InnoDB OLTP queries use neither path, which is why the global default stays small.

## Default value

`256KB`. 262144 bytes (MySQL 8.4).

## Check the current value

```
SHOW GLOBAL VARIABLES LIKE 'read_rnd_buffer_size';

SELECT VARIABLE_NAME, VARIABLE_SOURCE, MIN_VALUE, MAX_VALUE, SET_TIME
FROM performance_schema.variables_info
WHERE VARIABLE_NAME = 'read_rnd_buffer_size';
```

## Change it

```
SET SESSION read_rnd_buffer_size = 1048576;   -- this connection
SET GLOBAL read_rnd_buffer_size = 1048576;    -- new connections, until restart
SET PERSIST read_rnd_buffer_size = 1048576;   -- new connections, and after restarts
```

No restart. SET GLOBAL (or SET PERSIST, which also survives restarts) applies to connections opened afterwards; existing connections keep their session value unless they SET it themselves.

## When to change it

Per session, when a query plan shows Multi-Range Read or a large sorted MyISAM read and the bigger buffer measurably speeds it up.

## What can go wrong

The buffer is allocated per client, so a large global value multiplies across connections even though only the few queries that use MRR or sorted MyISAM reads ever allocate it. Keep the global default and raise the session value where it helps.

## Questions about read_rnd_buffer_size

### What is the default value of read_rnd_buffer_size in MySQL?

256KB. 262144 bytes (MySQL 8.4).

### Does changing read_rnd_buffer_size require a restart?

No. No restart. SET GLOBAL (or SET PERSIST, which also survives restarts) applies to connections opened afterwards; existing connections keep their session value unless they SET it themselves.

### When should I change read_rnd_buffer_size?

Per session, when a query plan shows Multi-Range Read or a large sorted MyISAM read and the bigger buffer measurably speeds it up.

Back to all [MySQL settings](https://sqlly.app/sql-configuration/mysql), or check the [MySQL manual](https://dev.mysql.com/doc/refman/8.4/en/server-system-variables.html) for every option.

## Related MySQL settings

- [`sort_buffer_size` Memory each sort may use before it writes merge passes to disk.](https://sqlly.app/sql-configuration/mysql/sort-buffer-size)
- [`join_buffer_size` Buffer for joins that cannot use an index, including hash joins.](https://sqlly.app/sql-configuration/mysql/join-buffer-size)

## Related on SQLly

- [Memory pressure Performance guide](https://sqlly.app/sql-performance/memory-pressure)
- [MySQL query performance troubleshooting Performance guide](https://sqlly.app/sql-performance/mysql)
