# table_open_cache_instances

> Number of shards the open tables cache is split into.

Source: https://sqlly.app/sql-configuration/mysql/table-open-cache-instances
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**

`16`

**Range**

1 to 64

**Restart needed**

Yes

**Default checked on**

MySQL 8.4 LTS

## What it does

The cache is partitioned into instances of table_open_cache / table_open_cache_instances each, and a session locks only its one instance for DML, which cuts contention on many-core servers. DDL still locks the whole cache, which is why heavy DDL is the workload that feels this setting.

## Default value

`16`. 16 (MySQL 8.4); the manual recommends 8 or 16 on systems that routinely use 16 or more cores.

## Check the current value

```
SHOW GLOBAL VARIABLES LIKE 'table_open_cache_instances';

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

## Change it

```
SET PERSIST_ONLY table_open_cache_instances = 16;
-- then restart mysqld (or set it under [mysqld] in my.cnf)
```

Restart required: the variable is read-only at runtime (SET GLOBAL fails with error 1238). Stage it with SET PERSIST_ONLY or under [mysqld] in my.cnf.

## When to change it

Rarely: 16 is right for most many-core servers. Drop to 1 only when very large triggers on many tables make the cache hold excessive memory.

## What can go wrong

Raising it shrinks each instance instead of growing the cache, so it only spreads the same table_open_cache across more locks. Many large triggers multiply per-instance memory, which is the one case the manual names for lowering it.

## Questions about table_open_cache_instances

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

16. 16 (MySQL 8.4); the manual recommends 8 or 16 on systems that routinely use 16 or more cores.

### Does changing table_open_cache_instances require a restart?

Yes. Restart required: the variable is read-only at runtime (SET GLOBAL fails with error 1238). Stage it with SET PERSIST_ONLY or under [mysqld] in my.cnf.

### When should I change table_open_cache_instances?

Rarely: 16 is right for most many-core servers. Drop to 1 only when very large triggers on many tables make the cache hold excessive memory.

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

- [`table_open_cache` Number of open table handles cached across all sessions.](https://sqlly.app/sql-configuration/mysql/table-open-cache)
- [`table_definition_cache` Number of table definitions cached.](https://sqlly.app/sql-configuration/mysql/table-definition-cache)
