MariaDB Memory Allocation - MariaDB Knowledge Base

/mariadb-memory-allocation

  • #MariaDB #Memory Allocation - MariaDB Knowledge Base
    https://mariadb.com/kb/en/library/mariadb-memory-allocation

    Allocating RAM for MySQL - The short answer

    If using just MyISAM, set key_buffer_size to 20% of available RAM. (Plus innodb_buffer_pool_size=0)

    If using just InnoDB, set innodb_buffer_pool_size to 70% of available RAM. (Plus key_buffer_size = 10M, small, but not zero.)

    Rule of thumb for tuning mysql:

    – Start with released copy of my.cnf / my.ini.
    – Change key_buffer_size and innodb_buffer_pool_size according to engine usage and RAM.
    – Slow queries can usually be ’fixed’ via indexes, schema changes, or SELECT changes, not by tuning.
    – Don’t get carried away with the query cache until you understand what it can and cannot do.
    – Don’t change anything else unless you run into trouble (eg, max connections).
    – Be sure the changes are under the [mysqld] section, not some other section.

    The 20%/70% assumes you have at least 4GB of RAM. If you have a tiny antique, or a tiny VM, then those percentages are too high.

    Now for the gory details. (NDB Cluster is not discussed here.)

    #mysql