PmaControl logo PmaControl
  • Home
  • PmaControl
    • AI Agents 13 on-premise agents
    • Plans Community, Cloud, On-Premise, Premium
    • Documentation Guides, API, architecture
    • Changelog Every stable 5.x release
    • Marketplace Community plugins
    • Clients 28+ companies
    • FAQ 25 questions / 7 categories
    Databases
    • MariaDB 35 articles
    • MySQL 15 articles
    • Galera Cluster 6 articles
    • MaxScale 4 articles
    • ProxySQL 3 articles
    • Amazon Aurora MySQL 0 article
    • Azure Database 0 article
    • ClickHouse 0 article
    • GCP CloudSQL 0 article
    • Percona Server 0 article
    • SingleStore 0 article
    • TiDB 0 article
    • Vitess 0 article
    Solutions
    • Support 24×7 MariaDB & MySQL emergencies
    • Observabilité SQL Monitoring, alerts, topology
    • Haute disponibilité Replication, failover, Galera
    • Disaster Recovery Backup, restore, RPO/RTO
    • Sécurité & conformité Audit, GDPR, SOC2
    • Migration & upgrade Zero downtime, pt-osc, gh-ost
  • Plans
  • Resources
    • Documentation Technical guides & API
    • MySQL optimization center Markdown index, metrics, parameters, incidents
    • FAQ 25 frequently asked questions
    • Testimonials Client feedback & use cases
    • Blog Articles & insights
    • Roadmap Upcoming features
    Areas of expertise
    • Observabilité SQL Monitoring, alerts, Dot3 topology
    • Haute disponibilité Replication, failover, Galera
    • Sécurité & conformité Audit, GDPR, SOC2, ISO 27001
    • Disaster Recovery Backup, restore, RPO/RTO
    • Performance & optimisation Digests, EXPLAIN, tuning
    • Migration & upgrade Zero downtime, pt-osc
    Quick links
    • GitHub Wiki 26 pages — install, engine, plugins
    • Source code Official GitHub repository
    • Support 24×7 MariaDB & MySQL emergencies
    • Book a demo 30 min — real architecture
  • Support 24×7
  • Book a demo
Book a demo
🇫🇷 FR Français 🇬🇧 EN English 🇵🇱 PL Polski 🇷🇺 RU Русский 🇨🇳 ZH 中文 🇸🇦 AR العربية
Resources › MySQL optimization center › MariaDB / MySQL InnoDB Memory Calculator

MariaDB / MySQL InnoDB Memory Calculator

Calculate an InnoDB and server memory scenario from your effective settings. Prefilled values illustrate a 16 GiB server; they are not recommendations.

Binary units: 1 GiB = 1024 MiB. Accepts bytes or K/M/G/T, for example 268435456, 256M, 8G. All calculations stay in your browser.

Enable JavaScript to use the calculator. Explanations and queries remain available below.

Server and concurrency
InnoDB memory

The pool and log buffer are global. The 10% allowance is a MySQL documented approximation, not a MariaDB constant. Add allocations not already counted: dictionary, locks, transactions, adaptive hash, compression. Do not add a measurement that already includes the pool.

Other global memory
Base memory per connection

One-thread-per-connection model: stack + two initial network buffers + digest + allowance. Adjust the allowance for thread pools. Network buffers can grow; include growth in the connection allowance or query memory.

Buffers per active query

These buffers are allocated on demand. Match multiplicities to the actual plan; use 0 for an unused operation. The allowance covers packets, SQL text, BLOBs, binlog and allocations not already counted. Complex joins can need several buffers.

Temporary tables

MariaDB and MEMORY: min(tmp_table_size, max_heap_table_size) per table, not per session. TempTable: shared RAM limit, without max_heap_table_size. Before MySQL 8.0.28, tmp_table_size does not limit TempTable. Local blocks, often 1 MiB or more, are outside the RAM limit and can survive until thread exit. Mmap and user MEMORY tables need an additional allowance.

Optional measurements, separate from calculation

0 means no measurement. Instrumented counters cover only tracked allocations; their sum is not RSS. Measurements are not added to the model.

Scenario results

InnoDB memory
Workload scenario
Stress at max_connections
Scenario headroom
Global allocations and allowances
Connection baseline
Active query buffers
Temporary tables and local blocks
Database server budget
Instrumented InnoDB, current measurement
Process RSS, current measurement

An estimate, not a guaranteed maximum

Workload, session overrides and uninstrumented allocations can exceed this model. Stress uses the same multiplicities with every connection active. Validate RSS, cgroup limits, swap and peaks under representative load. Redo/undo files and innodb_redo_log_capacity are storage, not equivalent RAM allocations.

Formulas and assumptions

C = connections; A = active queries; T = temporary tables per query. Allowances are added once.

InnoDB = innodb_buffer_pool_size × (1 + overhead / 100) + innodb_log_buffer_size + dictionary + locks + transactions + adaptive_hash + compression + InnoDB_extra G = InnoDB + key_buffer_size + aria_pagecache_buffer_size (MariaDB) + query_cache_size (MariaDB / MySQL 5.7) + other_global B = thread_stack + 2 × net_buffer_length + max_digest_length + session_extra Q = sort_buffer_size × sorts + join_buffer_size × joins + read_buffer_size × scans + read_rnd_buffer_size × random_reads + query_extra Total = G + C × B + A × Q + Temp Stress: C = A = max_connections

How to estimate InnoDB memory accurately

InnoDB memory is more than innodb_buffer_pool_size. The calculator counts the buffer pool, an adjustable allowance for its control structures, the global innodb_log_buffer_size, and additional InnoDB allocations you provide. MySQL documents roughly 10% extra space for buffer pool structures; the actual allowance depends on the build and workload, especially in MariaDB. Use the effective running value, which may differ from the requested configuration after buffer pool size rounding.

The data dictionary, adaptive hash index, locks, transaction structures and compression can add memory. Measure these where possible and enter only allocations not already included in the pool or its allowance. Redo log capacity, redo files and undo tablespace sizes are disk capacity: do not add their file sizes as RAM. An InnoDB subtotal excludes other engines, Performance Schema, connection/query buffers and the operating system.

Collect your running settings

Run these read-only statements on the target server. Unsupported variables are omitted by SHOW ... WHERE. Threads_running includes the collecting query and is a snapshot; use representative concurrency and recorded peaks. Max_used_connections is a connection peak, not an active-query peak. Check session values from application connections too: the current session does not describe every session.

SELECT VERSION();
SHOW GLOBAL VARIABLES WHERE Variable_name IN (
  'innodb_buffer_pool_size', 'innodb_log_buffer_size', 'innodb_page_size',
  'key_buffer_size', 'aria_pagecache_buffer_size', 'query_cache_size',
  'max_connections', 'thread_handling', 'thread_stack', 'net_buffer_length',
  'max_digest_length', 'max_allowed_packet', 'sort_buffer_size',
  'join_buffer_size', 'read_buffer_size', 'read_rnd_buffer_size',
  'tmp_table_size', 'max_heap_table_size', 'internal_tmp_mem_storage_engine',
  'temptable_max_ram', 'temptable_max_mmap', 'temptable_use_mmap'
);
SHOW GLOBAL STATUS WHERE Variable_name IN (
  'Threads_connected', 'Threads_running', 'Max_used_connections',
  'Created_tmp_tables', 'Created_tmp_disk_tables',
  'Innodb_buffer_pool_pages_total', 'Innodb_buffer_pool_pages_data',
  'Innodb_buffer_pool_pages_free'
);
SHOW SESSION VARIABLES WHERE Variable_name IN (
  'sort_buffer_size', 'join_buffer_size', 'read_buffer_size',
  'read_rnd_buffer_size', 'tmp_table_size', 'max_heap_table_size',
  'internal_tmp_mem_storage_engine', 'max_allowed_packet'
);
SHOW ENGINE INNODB STATUS;

Measure InnoDB and process memory

If your version exposes this Performance Schema memory table and InnoDB instruments are enabled, inspect the current allocations below. Instrumentation coverage differs by version and enabling counters later does not reconstruct every earlier allocation. Missing rows or zeros do not prove zero memory use. Do not sum per-instrument high-water marks to infer a simultaneous peak. Enter the current sum in the optional measured InnoDB field; it stays separate from the model.

SELECT EVENT_NAME,
       ROUND(CURRENT_NUMBER_OF_BYTES_USED / 1048576, 2) AS current_mib,
       ROUND(HIGH_NUMBER_OF_BYTES_USED / 1048576, 2) AS high_mib
FROM performance_schema.memory_summary_global_by_event_name
WHERE EVENT_NAME LIKE 'memory/innodb/%'
ORDER BY CURRENT_NUMBER_OF_BYTES_USED DESC;

SELECT ROUND(SUM(CURRENT_NUMBER_OF_BYTES_USED) / 1048576, 2)
       AS instrumented_innodb_mib
FROM performance_schema.memory_summary_global_by_event_name
WHERE EVENT_NAME LIKE 'memory/innodb/%';

On Linux, RSS below is in KiB; use a K suffix or divide by 1024 for MiB. RSS covers the process, not only InnoDB. Account for cgroup limits, OS page cache, allocator retention and other services when interpreting it.

ps -C mariadbd,mysqld -o pid=,rss=,comm=

Temporary table rules and practical limits

For MariaDB and MySQL using MEMORY for internal temporary tables, the smaller of tmp_table_size and max_heap_table_size limits each table. Multiple tables and join buffers can coexist in one query. The model applies your chosen multiplicities to active queries; it does not allocate every query buffer to every idle connection.

For MySQL TempTable, temptable_max_ram is shared across sessions. From 8.0.28, tmp_table_size also limits each individual table. The earlier TempTable profile uses the shared limit without that per-table cap. Thread-local blocks are outside the shared RAM limit; the model conservatively allows one for every connected session because it may remain until thread exit. A block can exceed the illustrated 1 MiB. Memory-mapped temporary files can contribute resident pages and require additional headroom; their file limit is not equivalent to allocated RAM.

The stress scenario makes all max_connections connections active with the same query shape. It is not a guaranteed upper bound. Add allowances for user MEMORY tables, packet growth, SQL/BLOB data, binary log caches, replication, prepared statements, thread caches and any unmodeled allocation. Validate the model against measured process peaks under representative load. Neither this estimate nor a tuning target enforces a memory cap.

Sources and verification

Checked on 13 October 2026. This page uses original explanations informed by Releem and the server manuals. Releem’s temporary-table example lists 200 connections and 32 MiB limits, then multiplies by 16 MB; the consistent one-table-per-connection result is 6400 MiB = 6.25 GiB. The engine-specific manuals take precedence over a generic formula.

  • Releem — memory calculator
  • Releem — MySQL memory usage
  • Releem — tmp_table_size
  • MariaDB — memory allocation
  • MySQL — memory use
  • MySQL — temporary tables
  • MySQL — InnoDB parameters
PmaControl
+33 6 63 28 27 47 contact@pmacontrol.com
Legal notice GitHub Contact
Do not wait for an incident to understand your architecture. © 2014-2026 PmaControl — 68Koncept