You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

307 lines
9.0 KiB

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en-us">
<head>
<title>
MySQL Tuner // Hagfi.sh
</title>
<link href="http://gmpg.org/xfn/11" rel="profile">
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1">
<meta name="description" content="">
<meta name="keywords" content="">
<meta name="author" content="">
<meta name="generator" content="Hugo 0.18.1" />
<meta property="og:title" content="MySQL Tuner" />
<meta property="og:description" content="" />
<meta property="og:type" content="website" />
<meta property="og:locale" content="en_US" />
<meta property="og:url" content="https://hagfi.sh/administration/mysql_tuner/" />
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/pure/0.5.0/base-min.css">
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/pure/0.5.0/pure-min.css">
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/pure/0.5.0/grids-responsive-min.css">
<link rel="stylesheet" href="https://hagfi.sh//css/redlounge.css">
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css" rel="stylesheet">
<link href='//fonts.googleapis.com/css?family=Raleway:400,200,100,700,300,500,600,800' rel='stylesheet' type='text/css'>
<link href='//fonts.googleapis.com/css?family=Libre+Baskerville:400,700,400italic' rel='stylesheet' type='text/css'>
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="/touch-icon-144-precomposed.png">
<link rel="shortcut icon" type="image/x-icon" href="/img/favicon.png">
<link href="" rel="alternate" type="application/rss+xml" title="Hagfi.sh" />
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.7/styles/tomorrow-night-bright.min.css">
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.7/highlight.min.js"></script>
<script>hljs.initHighlightingOnLoad();</script>
</head>
<body>
<div id="layout" class="pure-g">
<div class="sidebar pure-u-1 pure-u-md-1-4">
<div class="header">
<h1 class="brand-title">Hagfi.sh</h1>
<h2 class="brand-tagline">Documentation</h2>
<nav class="nav">
<ul class="nav-list">
<li class="nav-item"><span class="nav-item-separator">//</span><a href="https://hagfi.sh/">Home</a></li>
<li class="nav-item"><span class="nav-item-separator">//</span><a href="/administration">Administration</a></li>
<li class="nav-item"><span class="nav-item-separator">//</span><a href="/development">Development</a></li>
<li class="nav-item"><span class="nav-item-separator">//</span><a href="/tools">Tools</a></li>
</ul>
</nav>
</div>
</div>
<div class="content pure-u-1 pure-u-md-3-4">
<a name="top"></a>
<div id="toc" class="pure-u-1 pure-u-md-1-4">
<small class="toc-label">Contents</small>
<nav id="TableOfContents">
<ul>
<li>
<ul>
<li><a href="#mysql-tuner">MySQL Tuner</a></li>
</ul></li>
</ul>
</nav>
</div>
<section class="post">
<h1 class="post-title">
<a href="/administration/mysql_tuner/">MySQL Tuner</a>
</h1>
<h3 class="post-subtitle">
</h3>
<span class="post-date">
<span class="post-date-day"><sup>25</sup></span><span class="post-date-separator">/</span><span class="post-date-month">Aug</span> <span class="post-date-year">2018</span>
</span>
<h2 id="mysql-tuner">MySQL Tuner</h2>
<table>
<thead>
<tr>
<th>WAARDE</th>
<th>ACTIE</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>query_cache_size</code></td>
<td>AFBLIJVEN</td>
</tr>
<tr>
<td><code>table_cache</code></td>
<td>AFBLIJVEN <em>(maximumwaarde = 64)</em></td>
</tr>
<tr>
<td><code>table_open_cache</code></td>
<td>AFBLIJVEN</td>
</tr>
<tr>
<td><code>join_buffer_size</code></td>
<td>Verhogen indien <code>Joins performed without indexes++</code></td>
</tr>
<tr>
<td><code>tmp_table_size</code></td>
<td>Verhogen = <code>max_heap_table_size</code></td>
</tr>
<tr>
<td><code>max_heap_table_size</code></td>
<td>Verhogen <code>= tmp_table_size</code></td>
</tr>
<tr>
<td><code>query_cache_type</code></td>
<td><code>=1</code> indien <code>=0</code></td>
</tr>
</tbody>
</table>
<blockquote>
<p>mysql tuning improvements
<code>table_cache</code> NOOIT hoger dan 64
Sudo vim /etc/my.cnf
query_cache_size&rsquo; =&gt; &lsquo;256M’,
It caches the select query along with the result set, which enables the identical selects to execute faster as the data fetches from the in memory.
Caching voor select queries en bijhorende result sets, wat het mogelijk maakt om identieke selects sneller op te vragen uit memory.
&lsquo;open_files_limit&rsquo; =&gt; &lsquo;4096&rsquo;,
Changes the number of file descriptors available to mysqld. You should try increasing the value of this option if mysqld gives you the error Too many open files.
&lsquo;join_buffer_size&rsquo; =&gt; &lsquo;256K’,
The minimum size of the buffer that is used for plain index scans, range index scans, and joins that do not use indexes and thus perform full table scans. Normally, the best way to get fast joins is to add indexes. Increase the value of join_buffer_size to get a faster full join when adding indexes is not possible.
Minimumgrootte van buffer voor index en table scans.</p>
</blockquote>
<hr />
<blockquote>
<p>&lsquo;max_heap_table_size&rsquo; =&gt; &lsquo;32M’,
This variable sets the maximum size to which user-created MEMORY tables are permitted to grow.
Max grootte van user-created memory tables
These 2 need to be the same size!!!
&lsquo;tmp_table_size&rsquo; =&gt; &lsquo;32M’,
The maximum size of internal in-memory temporary tables.
Max grootte van interne in-memory tijdelijke tabellen</p>
</blockquote>
<hr />
<blockquote>
<p>table_cache=64 (maximumwaarde!!)
Table_Cache should always - well mostly anyway - be significantly bigger than the total number of tables in the server. Otherwise it&rsquo;ll keep opening and closing tables.
Maximumwaarde voor caching van geopende tabellen.
thread_cache_size=4
How many threads the server should cache for reuse.
Aantal threads dat de server kan cachen voor hergebruik.
&lsquo;innodb_buffer_pool_size&rsquo; =&gt; &lsquo;1G&rsquo;,
The size in bytes of the buffer pool, the memory area where InnoDB caches table and index data. The default value is 128MB.</p>
</blockquote>
<p>Sudo service mysql/mariadb reload (restart enkel onder toezicht)</p>
<ul>
<li><code>query_cache_*</code>:</li>
</ul>
<blockquote>
<p><code>query_cache_type</code><br />
Needs to be set to 1 to enable caching.<br />
<code>query_cache_size</code><br />
Is the size of the cache. This can be in bytes, or you can use a M suffix to specify the amount of megabytes.<br />
<code>query_cache_limit</code><br />
Is the maximum size of an individually cached query. Queries over this size won’t go into the cache. This is also in bytes, or megabytes with the M suffix. 1MB is a safe bet.<br />
Maximumgrootte voor elke individuele gecachte query. Queries groter dan dit zullen niet gecacht worden.<br />
<code>table_open_cache</code><br />
Indicates the maximum number of tables the server keeps open</p>
</blockquote>
<hr />
<p><code>innodb_buffer_pool_instances=2</code><br />
<em>Enables the use of multiple threads for innodb.</em></p>
<p><code>query_cache_type=1</code><br />
<em>Enables query caching.</em></p>
<p><code>join_buffer_size=1024K</code><br />
<em>Increased the buffer size for non-indexed joins.</em></p>
<p><code>tmp_table_size=64M &amp;&amp; max_heap_table_size=64M</code><br />
<em>Increased the size for temporary tables.</em></p>
<p><code>join_buffer_size</code><br />
<em>Omwille van het aantal JOIN queries uitgevoerd zonder indexes, werd de minimumgrootte van de buffer voor index en table scans verhoogd.</em></p>
<p><code>max_heap_table_size &amp; tmp_table_size</code><br />
<em>De maximale grootte van user-created memory tables en van interne in-memory tijdelijke tabellen werd verhoogd.</em></p>
<p><code>thread_cache_size</code><br />
<em>Het maximale aantal threads dat de server kan cachen voor hergebruik werd verhoogd.</em></p>
<div class="paging">
<span class="paging-label">More Reading</span>
<div class="paging-newer">
<span class="dark-red">Newer</span><span class="decorative-marker">//</span>
<a class="paging-link" href="/administration/letsencrypt/">Let&#39;s Encrypt</a>
</div>
<div class="paging-older">
<span class="dark-red">Older</span><span class="decorative-marker">//</span>
<a class="paging-link" href="/administration/windows_troubleshooting/">Windows troubleshooting</a>
</div>
</div>
</section>
</div>
</div>
</body>
</html>