3210
MySQLERRORNotableInnoDB / PerformanceMEDIUM confidence

Out of memory while computing InnoDB statistics

Production Risk

Medium — query plans may be suboptimal if stats fail.

Why it happens
  1. 1InnoDB ran out of memory while gathering table statistics for the optimizer.
  2. 2Very large tables or high concurrent stats collection exhausting available memory.
How to reproduce
trigger — this will error
trigger — this will error
ANALYZE TABLE very_large_table;

expected output

ERROR 3210 (HY000): Out of memory while computing InnoDB statistics.

Fix 1

Reduce innodb_stats_persistent_sample_pages

Reduce innodb_stats_persistent_sample_pages
SET GLOBAL innodb_stats_persistent_sample_pages = 20;

Why this works

Fewer sampled pages reduces memory used during stats collection.

Fix 2

Increase server memory

Increase server memory
-- Increase RAM allocation or reduce other memory consumers.

Why this works

More available memory prevents OOM during stats computation.

What not to do

Sources
Official documentation ↗

MySQL 8.0 — 3210 ER_OOM_INNODB_STATS

Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev

← All MySQL errors