url
stringlengths 45
122
| content
stringlengths 380
3.07M
|
---|---|
https://dev.mysql.com/doc/refman/8.4/en/creating-many-tables.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="creating-many-tables">
</a>
10.4.3.2 Disadvantages of Creating Many Tables in the Same Database
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045226666304">
</a>
<p>
If you have many
<code class="literal">
MyISAM
</code>
tables in the same
database directory, open, close, and create operations are
slow. If you execute
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
statements on many different tables, there is a little
overhead when the table cache is full, because for every table
that has to be opened, another must be closed. You can reduce
this overhead by increasing the number of entries permitted in
the table cache.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/charset-collation-implementations.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="charset-collation-implementations">
</a>
12.14.1 Collation Implementation Types
</h3>
</div>
</div>
</div>
<p>
MySQL implements several types of collations:
</p>
<p>
<span class="bold">
<strong>
Simple collations for 8-bit character
sets
</strong>
</span>
</p>
<p>
This kind of collation is implemented using an array of 256
weights that defines a one-to-one mapping from character codes
to weights.
<code class="literal">
latin1_swedish_ci
</code>
is an example.
It is a case-insensitive collation, so the uppercase and
lowercase versions of a character have the same weights and they
compare as equal.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa26255728"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SET</span> <span class="token keyword">NAMES</span> <span class="token string">'latin1'</span> <span class="token keyword">COLLATE</span> <span class="token string">'latin1_swedish_ci'</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 0 rows affected (0.01 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">HEX</span><span class="token punctuation">(</span><span class="token function">WEIGHT_STRING</span><span class="token punctuation">(</span><span class="token string">'a'</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token function">HEX</span><span class="token punctuation">(</span><span class="token function">WEIGHT_STRING</span><span class="token punctuation">(</span><span class="token string">'A'</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> HEX(WEIGHT_STRING('a')) <span class="token punctuation">|</span> HEX(WEIGHT_STRING('A')) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 41 <span class="token punctuation">|</span> 41 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output">1 row in set (0.01 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token string">'a'</span> <span class="token operator">=</span> <span class="token string">'A'</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 'a' = 'A' <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output">1 row in set (0.12 sec)</span></code></pre>
</div>
<p>
For implementation instructions, see
<a class="xref" href="adding-collation-simple-8bit.html" title="12.14.3 Adding a Simple Collation to an 8-Bit Character Set">
Section 12.14.3, “Adding a Simple Collation to an 8-Bit Character Set”
</a>
.
</p>
<p>
<span class="bold">
<strong>
Complex collations for 8-bit character
sets
</strong>
</span>
</p>
<p>
This kind of collation is implemented using functions in a C
source file that define how to order characters, as described in
<a class="xref" href="adding-character-set.html" title="12.13 Adding a Character Set">
Section 12.13, “Adding a Character Set”
</a>
.
</p>
<p>
<span class="bold">
<strong>
Collations for non-Unicode multibyte
character sets
</strong>
</span>
</p>
<p>
For this type of collation, 8-bit (single-byte) and multibyte
characters are handled differently. For 8-bit characters,
character codes map to weights in case-insensitive fashion. (For
example, the single-byte characters
<code class="literal">
'a'
</code>
and
<code class="literal">
'A'
</code>
both have a weight of
<code class="literal">
0x41
</code>
.) For multibyte characters, there are
two types of relationship between character codes and weights:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Weights equal character codes.
<code class="literal">
sjis_japanese_ci
</code>
is an example of this
kind of collation. The multibyte character
<code class="literal">
'ぢ'
</code>
has a character code of
<code class="literal">
0x82C0
</code>
, and the weight is also
<code class="literal">
0x82C0
</code>
.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa55396215"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> t1
<span class="token punctuation">(</span>c1 <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">2</span><span class="token punctuation">)</span> <span class="token keyword">CHARACTER</span> <span class="token keyword">SET</span> sjis <span class="token keyword">COLLATE</span> sjis_japanese_ci<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 0 rows affected (0.01 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">INSERT</span> <span class="token keyword">INTO</span> t1 <span class="token keyword">VALUES</span> <span class="token punctuation">(</span><span class="token string">'a'</span><span class="token punctuation">)</span><span class="token punctuation">,</span><span class="token punctuation">(</span><span class="token string">'A'</span><span class="token punctuation">)</span><span class="token punctuation">,</span><span class="token punctuation">(</span><span class="token number">0x82C0</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 3 rows affected (0.00 sec)</span>
<span class="token output">Records: 3 Duplicates: 0 Warnings: 0</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> c1<span class="token punctuation">,</span> <span class="token function">HEX</span><span class="token punctuation">(</span>c1<span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token function">HEX</span><span class="token punctuation">(</span><span class="token function">WEIGHT_STRING</span><span class="token punctuation">(</span>c1<span class="token punctuation">)</span><span class="token punctuation">)</span> <span class="token keyword">FROM</span> t1<span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> c1 <span class="token punctuation">|</span> HEX(c1) <span class="token punctuation">|</span> HEX(WEIGHT_STRING(c1)) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> a <span class="token punctuation">|</span> 61 <span class="token punctuation">|</span> 41 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> A <span class="token punctuation">|</span> 41 <span class="token punctuation">|</span> 41 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> ぢ <span class="token punctuation">|</span> 82C0 <span class="token punctuation">|</span> 82C0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output">3 rows in set (0.00 sec)</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
Character codes map one-to-one to weights, but a code is not
necessarily equal to the weight.
<code class="literal">
gbk_chinese_ci
</code>
is an example of this kind
of collation. The multibyte character
<code class="literal">
'膰'
</code>
has a character code of
<code class="literal">
0x81B0
</code>
but a weight of
<code class="literal">
0xC286
</code>
.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa12414788"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> t1
<span class="token punctuation">(</span>c1 <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">2</span><span class="token punctuation">)</span> <span class="token keyword">CHARACTER</span> <span class="token keyword">SET</span> gbk <span class="token keyword">COLLATE</span> gbk_chinese_ci<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 0 rows affected (0.33 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">INSERT</span> <span class="token keyword">INTO</span> t1 <span class="token keyword">VALUES</span> <span class="token punctuation">(</span><span class="token string">'a'</span><span class="token punctuation">)</span><span class="token punctuation">,</span><span class="token punctuation">(</span><span class="token string">'A'</span><span class="token punctuation">)</span><span class="token punctuation">,</span><span class="token punctuation">(</span><span class="token number">0x81B0</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 3 rows affected (0.00 sec)</span>
<span class="token output">Records: 3 Duplicates: 0 Warnings: 0</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> c1<span class="token punctuation">,</span> <span class="token function">HEX</span><span class="token punctuation">(</span>c1<span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token function">HEX</span><span class="token punctuation">(</span><span class="token function">WEIGHT_STRING</span><span class="token punctuation">(</span>c1<span class="token punctuation">)</span><span class="token punctuation">)</span> <span class="token keyword">FROM</span> t1<span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> c1 <span class="token punctuation">|</span> HEX(c1) <span class="token punctuation">|</span> HEX(WEIGHT_STRING(c1)) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> a <span class="token punctuation">|</span> 61 <span class="token punctuation">|</span> 41 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> A <span class="token punctuation">|</span> 41 <span class="token punctuation">|</span> 41 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 膰 <span class="token punctuation">|</span> 81B0 <span class="token punctuation">|</span> C286 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output">3 rows in set (0.00 sec)</span></code></pre>
</div>
</li>
</ul>
</div>
<p>
For implementation instructions, see
<a class="xref" href="adding-character-set.html" title="12.13 Adding a Character Set">
Section 12.13, “Adding a Character Set”
</a>
.
</p>
<p>
<span class="bold">
<strong>
Collations for Unicode multibyte character
sets
</strong>
</span>
</p>
<p>
Some of these collations are based on the Unicode Collation
Algorithm (UCA), others are not.
</p>
<p>
Non-UCA collations have a one-to-one mapping from character code
to weight. In MySQL, such collations are case-insensitive and
accent-insensitive.
<code class="literal">
utf8mb4_general_ci
</code>
is an
example:
<code class="literal">
'a'
</code>
,
<code class="literal">
'A'
</code>
,
<code class="literal">
'À'
</code>
, and
<code class="literal">
'á'
</code>
each have
different character codes but all have a weight of
<code class="literal">
0x0041
</code>
and compare as equal.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa89267284"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SET</span> <span class="token keyword">NAMES</span> <span class="token string">'utf8mb4'</span> <span class="token keyword">COLLATE</span> <span class="token string">'utf8mb4_general_ci'</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 0 rows affected (0.00 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> t1
<span class="token punctuation">(</span>c1 <span class="token datatype">CHAR</span><span class="token punctuation">(</span><span class="token number">1</span><span class="token punctuation">)</span> <span class="token keyword">CHARACTER</span> <span class="token keyword">SET</span> UTF8MB4 <span class="token keyword">COLLATE</span> utf8mb4_general_ci<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 0 rows affected (0.01 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">INSERT</span> <span class="token keyword">INTO</span> t1 <span class="token keyword">VALUES</span> <span class="token punctuation">(</span><span class="token string">'a'</span><span class="token punctuation">)</span><span class="token punctuation">,</span><span class="token punctuation">(</span><span class="token string">'A'</span><span class="token punctuation">)</span><span class="token punctuation">,</span><span class="token punctuation">(</span><span class="token string">'À'</span><span class="token punctuation">)</span><span class="token punctuation">,</span><span class="token punctuation">(</span><span class="token string">'á'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 4 rows affected (0.00 sec)</span>
<span class="token output">Records: 4 Duplicates: 0 Warnings: 0</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> c1<span class="token punctuation">,</span> <span class="token function">HEX</span><span class="token punctuation">(</span>c1<span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token function">HEX</span><span class="token punctuation">(</span><span class="token function">WEIGHT_STRING</span><span class="token punctuation">(</span>c1<span class="token punctuation">)</span><span class="token punctuation">)</span> <span class="token keyword">FROM</span> t1<span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> c1 <span class="token punctuation">|</span> HEX(c1) <span class="token punctuation">|</span> HEX(WEIGHT_STRING(c1)) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> a <span class="token punctuation">|</span> 61 <span class="token punctuation">|</span> 0041 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> A <span class="token punctuation">|</span> 41 <span class="token punctuation">|</span> 0041 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> À <span class="token punctuation">|</span> C380 <span class="token punctuation">|</span> 0041 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> á <span class="token punctuation">|</span> C3A1 <span class="token punctuation">|</span> 0041 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output">4 rows in set (0.00 sec)</span></code></pre>
</div>
<p>
UCA-based collations in MySQL have these properties:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
If a character has weights, each weight uses 2 bytes (16
bits).
</p>
</li>
<li class="listitem">
<p>
A character may have zero weights (or an empty weight). In
this case, the character is ignorable. Example: "U+0000
NULL" does not have a weight and is ignorable.
</p>
</li>
<li class="listitem">
<p>
A character may have one weight. Example:
<code class="literal">
'a'
</code>
has a weight of
<code class="literal">
0x0E33
</code>
.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa67869870"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SET</span> <span class="token keyword">NAMES</span> <span class="token string">'utf8mb4'</span> <span class="token keyword">COLLATE</span> <span class="token string">'utf8mb4_unicode_ci'</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 0 rows affected (0.05 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">HEX</span><span class="token punctuation">(</span><span class="token string">'a'</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token function">HEX</span><span class="token punctuation">(</span><span class="token function">WEIGHT_STRING</span><span class="token punctuation">(</span><span class="token string">'a'</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> HEX('a') <span class="token punctuation">|</span> HEX(WEIGHT_STRING('a')) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 61 <span class="token punctuation">|</span> 0E33 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output">1 row in set (0.02 sec)</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
A character may have many weights. This is an expansion.
Example: The German letter
<code class="literal">
'ß'
</code>
(SZ
ligature, or SHARP S) has a weight of
<code class="literal">
0x0FEA0FEA
</code>
.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa68063032"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SET</span> <span class="token keyword">NAMES</span> <span class="token string">'utf8mb4'</span> <span class="token keyword">COLLATE</span> <span class="token string">'utf8mb4_unicode_ci'</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 0 rows affected (0.11 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">HEX</span><span class="token punctuation">(</span><span class="token string">'ß'</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token function">HEX</span><span class="token punctuation">(</span><span class="token function">WEIGHT_STRING</span><span class="token punctuation">(</span><span class="token string">'ß'</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> HEX('ß') <span class="token punctuation">|</span> HEX(WEIGHT_STRING('ß')) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> C39F <span class="token punctuation">|</span> 0FEA0FEA <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output">1 row in set (0.00 sec)</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
Many characters may have one weight. This is a contraction.
Example:
<code class="literal">
'ch'
</code>
is a single letter in Czech
and has a weight of
<code class="literal">
0x0EE2
</code>
.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa35198729"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SET</span> <span class="token keyword">NAMES</span> <span class="token string">'utf8mb4'</span> <span class="token keyword">COLLATE</span> <span class="token string">'utf8mb4_czech_ci'</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 0 rows affected (0.09 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">HEX</span><span class="token punctuation">(</span><span class="token string">'ch'</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token function">HEX</span><span class="token punctuation">(</span><span class="token function">WEIGHT_STRING</span><span class="token punctuation">(</span><span class="token string">'ch'</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> HEX('ch') <span class="token punctuation">|</span> HEX(WEIGHT_STRING('ch')) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 6368 <span class="token punctuation">|</span> 0EE2 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output">1 row in set (0.00 sec)</span></code></pre>
</div>
</li>
</ul>
</div>
<p>
A many-characters-to-many-weights mapping is also possible (this
is contraction with expansion), but is not supported by MySQL.
</p>
<p>
For implementation instructions, for a non-UCA collation, see
<a class="xref" href="adding-character-set.html" title="12.13 Adding a Character Set">
Section 12.13, “Adding a Character Set”
</a>
. For a UCA collation, see
<a class="xref" href="adding-collation-unicode-uca.html" title="12.14.4 Adding a UCA Collation to a Unicode Character Set">
Section 12.14.4, “Adding a UCA Collation to a Unicode Character Set”
</a>
.
</p>
<p>
<span class="bold">
<strong>
Miscellaneous collations
</strong>
</span>
</p>
<p>
There are also a few collations that do not fall into any of the
previous categories.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/sys-memory-global-total.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="sys-memory-global-total">
</a>
30.4.3.20 The memory_global_total and x$memory_global_total Views
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045062772544">
</a>
<a class="indexterm" name="idm46045062771072">
</a>
<a class="indexterm" name="idm46045062769568">
</a>
<a class="indexterm" name="idm46045062768064">
</a>
<p>
These views summarize total memory use within the server.
</p>
<p>
The
<a class="link" href="sys-memory-global-total.html" title="30.4.3.20 The memory_global_total and x$memory_global_total Views">
<code class="literal">
memory_global_total
</code>
</a>
and
<a class="link" href="sys-memory-global-total.html" title="30.4.3.20 The memory_global_total and x$memory_global_total Views">
<code class="literal">
x$memory_global_total
</code>
</a>
views have
these columns:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
total_allocated
</code>
</p>
<p>
The total bytes of memory allocated within the server.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/replication-formats.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="replication-formats">
</a>
19.2.1 Replication Formats
</h3>
</div>
</div>
</div>
<div class="toc">
<dl class="toc">
<dt>
<span class="section">
<a href="replication-sbr-rbr.html">
19.2.1.1 Advantages and Disadvantages of Statement-Based and Row-Based
Replication
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="replication-rbr-usage.html">
19.2.1.2 Usage of Row-Based Logging and Replication
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="replication-rbr-safe-unsafe.html">
19.2.1.3 Determination of Safe and Unsafe Statements in Binary Logging
</a>
</span>
</dt>
</dl>
</div>
<p>
Replication works because events written to the binary log are
read from the source and then processed on the replica. The events
are recorded within the binary log in different formats according
to the type of event. The different replication formats used
correspond to the binary logging format used when the events were
recorded in the source's binary log. The correlation between
binary logging formats and the terms used during replication are:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
When using statement-based binary logging, the source writes
SQL statements to the binary log. Replication of the source to
the replica works by executing the SQL statements on the
replica. This is called
<span class="firstterm">
statement-based
replication
</span>
(which can be abbreviated as
<span class="firstterm">
SBR
</span>
), which corresponds
to the MySQL statement-based binary logging format.
</p>
</li>
<li class="listitem">
<p>
When using row-based logging, the source writes
<span class="firstterm">
events
</span>
to the binary log
that indicate how individual table rows are changed.
Replication of the source to the replica works by copying the
events representing the changes to the table rows to the
replica. This is called
<span class="firstterm">
row-based
replication
</span>
(which can be abbreviated as
<span class="firstterm">
RBR
</span>
).
</p>
<p>
Row-based logging is the default method.
</p>
</li>
<li class="listitem">
<p>
You can also configure MySQL to use a mix of both
statement-based and row-based logging, depending on which is
most appropriate for the change to be logged. This is called
<span class="firstterm">
mixed-format logging
</span>
.
When using mixed-format logging, a statement-based log is used
by default. Depending on certain statements, and also the
storage engine being used, the log is automatically switched
to row-based in particular cases. Replication using the mixed
format is referred to as
<span class="firstterm">
mixed-based replication
</span>
or
<span class="firstterm">
mixed-format
replication
</span>
. For more information, see
<a class="xref" href="binary-log-mixed.html" title="7.4.4.3 Mixed Binary Logging Format">
Section 7.4.4.3, “Mixed Binary Logging Format”
</a>
.
</p>
</li>
</ul>
</div>
<p>
<b>
NDB Cluster.
</b>
The default binary logging format in MySQL NDB Cluster
8.4 is
<code class="literal">
ROW
</code>
. NDB Cluster
Replication uses row-based replication; that the
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
storage engine is incompatible
with statement-based replication. See
<a class="xref" href="mysql-cluster-replication-general.html" title="25.7.2 General Requirements for NDB Cluster Replication">
Section 25.7.2, “General Requirements for NDB Cluster Replication”
</a>
, for more
information.
</p>
<p>
When using
<code class="literal">
MIXED
</code>
format, the binary logging
format is determined in part by the storage engine being used and
the statement being executed. For more information on mixed-format
logging and the rules governing the support of different logging
formats, see
<a class="xref" href="binary-log-mixed.html" title="7.4.4.3 Mixed Binary Logging Format">
Section 7.4.4.3, “Mixed Binary Logging Format”
</a>
.
</p>
<p>
The logging format in a running MySQL server is controlled by
setting the
<a class="link" href="replication-options-binary-log.html#sysvar_binlog_format">
<code class="literal">
binlog_format
</code>
</a>
server
system variable. This variable can be set with session or global
scope. The rules governing when and how the new setting takes
effect are the same as for other MySQL server system variables.
Setting the variable for the current session lasts only until the
end of that session, and the change is not visible to other
sessions. Setting the variable globally takes effect for clients
that connect after the change, but not for any current client
sessions, including the session where the variable setting was
changed. To make the global system variable setting permanent so
that it applies across server restarts, you must set it in an
option file. For more information, see
<a class="xref" href="set-variable.html" title="15.7.6.1 SET Syntax for Variable Assignment">
Section 15.7.6.1, “SET Syntax for Variable Assignment”
</a>
.
</p>
<p>
There are conditions under which you cannot change the binary
logging format at runtime or doing so causes replication to fail.
See
<a class="xref" href="binary-log-setting.html" title="7.4.4.2 Setting The Binary Log Format">
Section 7.4.4.2, “Setting The Binary Log Format”
</a>
.
</p>
<p>
Changing the global
<a class="link" href="replication-options-binary-log.html#sysvar_binlog_format">
<code class="literal">
binlog_format
</code>
</a>
value requires privileges sufficient to set global system
variables. Changing the session
<a class="link" href="replication-options-binary-log.html#sysvar_binlog_format">
<code class="literal">
binlog_format
</code>
</a>
value requires
privileges sufficient to set restricted session system variables.
See
<a class="xref" href="system-variable-privileges.html" title="7.1.9.1 System Variable Privileges">
Section 7.1.9.1, “System Variable Privileges”
</a>
.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
Changing the binary logging format
(
<a class="link" href="replication-options-binary-log.html#sysvar_binlog_format">
<code class="literal">
binlog_format
</code>
</a>
system variable)
was deprecated in MySQL 8.0; in a future version of MySQL, you
can expect
<code class="literal">
binlog_format
</code>
to be removed
altogether, and the row-based format to become the only logging
format used by MySQL.
</p>
</div>
<p>
The statement-based and row-based replication formats have
different issues and limitations. For a comparison of their
relative advantages and disadvantages, see
<a class="xref" href="replication-sbr-rbr.html" title="19.2.1.1 Advantages and Disadvantages of Statement-Based and Row-Based Replication">
Section 19.2.1.1, “Advantages and Disadvantages of Statement-Based and Row-Based
Replication”
</a>
.
</p>
<p>
With statement-based replication, you may encounter issues with
replicating stored routines or triggers. You can avoid these
issues by using row-based replication instead. For more
information, see
<a class="xref" href="stored-programs-logging.html" title="27.7 Stored Program Binary Logging">
Section 27.7, “Stored Program Binary Logging”
</a>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/row-constructor-optimization.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="row-constructor-optimization">
</a>
10.2.1.22 Row Constructor Expression Optimization
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045228469632">
</a>
<a class="indexterm" name="idm46045228468144">
</a>
<p>
Row constructors permit simultaneous comparisons of multiple
values. For example, these two statements are semantically
equivalent:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa26905863"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> t1 <span class="token keyword">WHERE</span> <span class="token punctuation">(</span>column1<span class="token punctuation">,</span>column2<span class="token punctuation">)</span> <span class="token operator">=</span> <span class="token punctuation">(</span><span class="token number">1</span><span class="token punctuation">,</span><span class="token number">1</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> t1 <span class="token keyword">WHERE</span> column1 <span class="token operator">=</span> <span class="token number">1</span> <span class="token operator">AND</span> column2 <span class="token operator">=</span> <span class="token number">1</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
In addition, the optimizer handles both expressions the same
way.
</p>
<p>
The optimizer is less likely to use available indexes if the
row constructor columns do not cover the prefix of an index.
Consider the following table, which has a primary key on
<code class="literal">
(c1, c2, c3)
</code>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa70338388"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> t1 <span class="token punctuation">(</span>
c1 <span class="token datatype">INT</span><span class="token punctuation">,</span> c2 <span class="token datatype">INT</span><span class="token punctuation">,</span> c3 <span class="token datatype">INT</span><span class="token punctuation">,</span> c4 <span class="token datatype">CHAR</span><span class="token punctuation">(</span><span class="token number">100</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">PRIMARY</span> <span class="token keyword">KEY</span><span class="token punctuation">(</span>c1<span class="token punctuation">,</span>c2<span class="token punctuation">,</span>c3<span class="token punctuation">)</span>
<span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
In this query, the
<code class="literal">
WHERE
</code>
clause uses all
columns in the index. However, the row constructor itself does
not cover an index prefix, with the result that the optimizer
uses only
<code class="literal">
c1
</code>
(
<code class="literal">
key_len=4
</code>
,
the size of
<code class="literal">
c1
</code>
):
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa16919016"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">EXPLAIN</span> <span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> t1
<span class="token keyword">WHERE</span> c1<span class="token operator">=</span><span class="token number">1</span> <span class="token operator">AND</span> <span class="token punctuation">(</span>c2<span class="token punctuation">,</span>c3<span class="token punctuation">)</span> <span class="token operator">></span> <span class="token punctuation">(</span><span class="token number">1</span><span class="token punctuation">,</span><span class="token number">1</span><span class="token punctuation">)</span>\G
<span class="token output"><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span> 1. row <span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span>
id<span class="token punctuation">:</span> 1
select_type<span class="token punctuation">:</span> SIMPLE
table<span class="token punctuation">:</span> t1
partitions<span class="token punctuation">:</span> NULL
type<span class="token punctuation">:</span> ref
possible_keys<span class="token punctuation">:</span> PRIMARY
key<span class="token punctuation">:</span> PRIMARY
key_len<span class="token punctuation">:</span> 4
ref<span class="token punctuation">:</span> const
rows<span class="token punctuation">:</span> 3
filtered<span class="token punctuation">:</span> 100.00
Extra<span class="token punctuation">:</span> Using where</span></code></pre>
</div>
<p>
In such cases, rewriting the row constructor expression using
an equivalent nonconstructor expression may result in more
complete index use. For the given query, the row constructor
and equivalent nonconstructor expressions are:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa93053526"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token punctuation">(</span>c2<span class="token punctuation">,</span>c3<span class="token punctuation">)</span> <span class="token operator">></span> <span class="token punctuation">(</span><span class="token number">1</span><span class="token punctuation">,</span><span class="token number">1</span><span class="token punctuation">)</span>
c2 <span class="token operator">></span> <span class="token number">1</span> <span class="token operator">OR</span> <span class="token punctuation">(</span><span class="token punctuation">(</span>c2 <span class="token operator">=</span> <span class="token number">1</span><span class="token punctuation">)</span> <span class="token operator">AND</span> <span class="token punctuation">(</span>c3 <span class="token operator">></span> <span class="token number">1</span><span class="token punctuation">)</span><span class="token punctuation">)</span></code></pre>
</div>
<p>
Rewriting the query to use the nonconstructor expression
results in the optimizer using all three columns in the index
(
<code class="literal">
key_len=12
</code>
):
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa62719529"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">EXPLAIN</span> <span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> t1
<span class="token keyword">WHERE</span> c1 <span class="token operator">=</span> <span class="token number">1</span> <span class="token operator">AND</span> <span class="token punctuation">(</span>c2 <span class="token operator">></span> <span class="token number">1</span> <span class="token operator">OR</span> <span class="token punctuation">(</span><span class="token punctuation">(</span>c2 <span class="token operator">=</span> <span class="token number">1</span><span class="token punctuation">)</span> <span class="token operator">AND</span> <span class="token punctuation">(</span>c3 <span class="token operator">></span> <span class="token number">1</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">)</span>\G
<span class="token output"><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span> 1. row <span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span>
id<span class="token punctuation">:</span> 1
select_type<span class="token punctuation">:</span> SIMPLE
table<span class="token punctuation">:</span> t1
partitions<span class="token punctuation">:</span> NULL
type<span class="token punctuation">:</span> range
possible_keys<span class="token punctuation">:</span> PRIMARY
key<span class="token punctuation">:</span> PRIMARY
key_len<span class="token punctuation">:</span> 12
ref<span class="token punctuation">:</span> NULL
rows<span class="token punctuation">:</span> 3
filtered<span class="token punctuation">:</span> 100.00
Extra<span class="token punctuation">:</span> Using where</span></code></pre>
</div>
<p>
Thus, for better results, avoid mixing row constructors with
<a class="link" href="logical-operators.html#operator_and">
<code class="literal">
AND
</code>
</a>
/
<a class="link" href="logical-operators.html#operator_or">
<code class="literal">
OR
</code>
</a>
expressions. Use one or the other.
</p>
<p>
Under certain conditions, the optimizer can apply the range
access method to
<a class="link" href="comparison-operators.html#operator_in">
<code class="literal">
IN()
</code>
</a>
expressions
that have row constructor arguments. See
<a class="xref" href="range-optimization.html#row-constructor-range-optimization" title="Range Optimization of Row Constructor Expressions">
Range Optimization of Row Constructor Expressions
</a>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/error-log-filtering.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="error-log-filtering">
</a>
7.4.2.4 Types of Error Log Filtering
</h4>
</div>
</div>
</div>
<p>
Error log configuration normally includes one log filter
component and one or more log sink components. For error log
filtering, MySQL offers a choice of components:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
log_filter_internal
</code>
: This filter
component provides error log filtering based on log event
priority and error code, in combination with the
<a class="link" href="server-system-variables.html#sysvar_log_error_verbosity">
<code class="literal">
log_error_verbosity
</code>
</a>
and
<a class="link" href="server-system-variables.html#sysvar_log_error_suppression_list">
<code class="literal">
log_error_suppression_list
</code>
</a>
system variables.
<code class="literal">
log_filter_internal
</code>
is
built in and enabled by default. See
<a class="xref" href="error-log-priority-based-filtering.html" title="7.4.2.5 Priority-Based Error Log Filtering (log_filter_internal)">
Section 7.4.2.5, “Priority-Based Error Log Filtering (log_filter_internal)”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
log_filter_dragnet
</code>
: This filter component
provides error log filtering based on user-supplied rules,
in combination with the
<a class="link" href="server-system-variables.html#sysvar_dragnet.log_error_filter_rules">
<code class="literal">
dragnet.log_error_filter_rules
</code>
</a>
system variable. See
<a class="xref" href="error-log-rule-based-filtering.html" title="7.4.2.6 Rule-Based Error Log Filtering (log_filter_dragnet)">
Section 7.4.2.6, “Rule-Based Error Log Filtering (log_filter_dragnet)”
</a>
.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/mysql-cluster-programs-ndb-select-all.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="mysql-cluster-programs-ndb-select-all">
</a>
25.5.25 ndb_select_all — Print Rows from an NDB Table
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045097928688">
</a>
<p>
<a class="link" href="mysql-cluster-programs-ndb-select-all.html" title="25.5.25 ndb_select_all — Print Rows from an NDB Table">
<span class="command">
<strong>
ndb_select_all
</strong>
</span>
</a>
prints all rows from an
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
table to
<code class="literal">
stdout
</code>
.
</p>
<h4>
<a name="idm46045097923952">
</a>
Usage
</h4>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa62207436"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal">ndb_select_all <span class="token property">-c</span> <em class="replaceable">connection_string</em> <em class="replaceable">tbl_name</em> <span class="token property">-d</span> <em class="replaceable">db_name</em> <span class="token punctuation">[</span>> <em class="replaceable">file_name</em><span class="token punctuation">]</span></code></pre>
</div>
<p>
Options that can be used with
<a class="link" href="mysql-cluster-programs-ndb-select-all.html" title="25.5.25 ndb_select_all — Print Rows from an NDB Table">
<span class="command">
<strong>
ndb_select_all
</strong>
</span>
</a>
are shown in the following table. Additional descriptions follow
the table.
</p>
<p>
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a name="option_ndb_select_all_character-sets-dir">
</a>
<a class="link" href="mysql-cluster-programs-ndb-select-all.html#option_ndb_select_all_character-sets-dir">
<code class="option">
--character-sets-dir
</code>
</a>
</p>
<a class="indexterm" name="idm46045097915616">
</a>
<a class="indexterm" name="idm46045097914112">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for character-sets-dir">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--character-sets-dir=path
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Directory containing character sets.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_select_all_connect-retries">
</a>
<a class="link" href="mysql-cluster-programs-ndb-select-all.html#option_ndb_select_all_connect-retries">
<code class="option">
--connect-retries
</code>
</a>
</p>
<a class="indexterm" name="idm46045097904320">
</a>
<a class="indexterm" name="idm46045097902832">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for connect-retries">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--connect-retries=#
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
Integer
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
12
</code>
</td>
</tr>
<tr>
<th>
Minimum Value
</th>
<td>
<code class="literal">
0
</code>
</td>
</tr>
<tr>
<th>
Maximum Value
</th>
<td>
<code class="literal">
12
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Number of times to retry connection before giving up.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_select_all_connect-retry-delay">
</a>
<a class="link" href="mysql-cluster-programs-ndb-select-all.html#option_ndb_select_all_connect-retry-delay">
<code class="option">
--connect-retry-delay
</code>
</a>
</p>
<a class="indexterm" name="idm46045097883728">
</a>
<a class="indexterm" name="idm46045097882224">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for connect-retry-delay">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--connect-retry-delay=#
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
Integer
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
5
</code>
</td>
</tr>
<tr>
<th>
Minimum Value
</th>
<td>
<code class="literal">
0
</code>
</td>
</tr>
<tr>
<th>
Maximum Value
</th>
<td>
<code class="literal">
5
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Number of seconds to wait between attempts to contact
management server.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_select_all_connect-string">
</a>
<a class="link" href="mysql-cluster-programs-ndb-select-all.html#option_ndb_select_all_connect-string">
<code class="option">
--connect-string
</code>
</a>
</p>
<a class="indexterm" name="idm46045097863168">
</a>
<a class="indexterm" name="idm46045097861680">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for connect-string">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--connect-string=connection_string
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
[none]
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Same as
<a class="link" href="mysql-cluster-programs-ndb-select-all.html#option_ndb_select_all_ndb-connectstring">
<code class="option">
--ndb-connectstring
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_select_all_core-file">
</a>
<a class="link" href="mysql-cluster-programs-ndb-select-all.html#option_ndb_select_all_core-file">
<code class="option">
--core-file
</code>
</a>
</p>
<a class="indexterm" name="idm46045097846384">
</a>
<a class="indexterm" name="idm46045097844896">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for core-file">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--core-file
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Write core file on error; used in debugging.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_select_all_database">
</a>
<a class="link" href="mysql-cluster-programs-ndb-select-all.html#option_ndb_select_all_database">
<code class="option">
--database=
<em class="replaceable">
<code>
dbname
</code>
</em>
</code>
</a>
,
<code class="option">
-d
</code>
<em class="replaceable">
<code>
dbname
</code>
</em>
</p>
<a class="indexterm" name="idm46045097834000">
</a>
<p>
Name of the database in which the table is found. The
default value is
<code class="literal">
TEST_DB
</code>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_select_all_descending">
</a>
<a class="link" href="mysql-cluster-programs-ndb-select-all.html#option_ndb_select_all_descending">
<code class="option">
--descending
</code>
</a>
,
<code class="option">
-z
</code>
</p>
<a class="indexterm" name="idm46045097828640">
</a>
<a class="indexterm" name="idm46045097827152">
</a>
<p>
Sorts the output in descending order. This option can be
used only in conjunction with the
<code class="option">
-o
</code>
(
<a class="link" href="mysql-cluster-programs-ndb-select-all.html#option_ndb_select_all_order">
<code class="option">
--order
</code>
</a>
) option.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_select_all_defaults-extra-file">
</a>
<a class="link" href="mysql-cluster-programs-ndb-select-all.html#option_ndb_select_all_defaults-extra-file">
<code class="option">
--defaults-extra-file
</code>
</a>
</p>
<a class="indexterm" name="idm46045097821248">
</a>
<a class="indexterm" name="idm46045097819744">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for defaults-extra-file">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--defaults-extra-file=path
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
[none]
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Read given file after global files are read.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_select_all_defaults-file">
</a>
<a class="link" href="mysql-cluster-programs-ndb-select-all.html#option_ndb_select_all_defaults-file">
<code class="option">
--defaults-file
</code>
</a>
</p>
<a class="indexterm" name="idm46045097805456">
</a>
<a class="indexterm" name="idm46045097803968">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for defaults-file">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--defaults-file=path
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
[none]
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Read default options from given file only.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_select_all_defaults-group-suffix">
</a>
<a class="link" href="mysql-cluster-programs-ndb-select-all.html#option_ndb_select_all_defaults-group-suffix">
<code class="option">
--defaults-group-suffix
</code>
</a>
</p>
<a class="indexterm" name="idm46045097789552">
</a>
<a class="indexterm" name="idm46045097788048">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for defaults-group-suffix">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--defaults-group-suffix=string
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
[none]
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Also read groups with concat(group, suffix).
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_select_all_delimiter">
</a>
<a class="link" href="mysql-cluster-programs-ndb-select-all.html#option_ndb_select_all_delimiter">
<code class="option">
--delimiter=
<em class="replaceable">
<code>
character
</code>
</em>
</code>
</a>
,
<code class="option">
-D
<em class="replaceable">
<code>
character
</code>
</em>
</code>
</p>
<a class="indexterm" name="idm46045097772832">
</a>
<a class="indexterm" name="idm46045097771344">
</a>
<p>
Causes the
<em class="replaceable">
<code>
character
</code>
</em>
to be used
as a column delimiter. Only table data columns are separated
by this delimiter.
</p>
<p>
The default delimiter is the tab character.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_select_all_disk">
</a>
<a class="link" href="mysql-cluster-programs-ndb-select-all.html#option_ndb_select_all_disk">
<code class="option">
--disk
</code>
</a>
</p>
<a class="indexterm" name="idm46045097766160">
</a>
<a class="indexterm" name="idm46045097764672">
</a>
<p>
Adds a disk reference column to the output. The column is
nonempty only for Disk Data tables having nonindexed
columns.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_select_all_gci">
</a>
<a class="link" href="mysql-cluster-programs-ndb-select-all.html#option_ndb_select_all_gci">
<code class="option">
--gci
</code>
</a>
</p>
<a class="indexterm" name="idm46045097760256">
</a>
<a class="indexterm" name="idm46045097758768">
</a>
<p>
Adds a
<code class="literal">
GCI
</code>
column to the output showing
the global checkpoint at which each row was last updated.
See
<a class="xref" href="mysql-cluster-overview.html" title="25.2 NDB Cluster Overview">
Section 25.2, “NDB Cluster Overview”
</a>
, and
<a class="xref" href="mysql-cluster-log-events.html" title="25.6.3.2 NDB Cluster Log Events">
Section 25.6.3.2, “NDB Cluster Log Events”
</a>
, for more
information about checkpoints.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_select_all_gci64">
</a>
<a class="link" href="mysql-cluster-programs-ndb-select-all.html#option_ndb_select_all_gci64">
<code class="option">
--gci64
</code>
</a>
</p>
<a class="indexterm" name="idm46045097752240">
</a>
<a class="indexterm" name="idm46045097750752">
</a>
<p>
Adds a
<code class="literal">
ROW$GCI64
</code>
column to the output
showing the global checkpoint at which each row was last
updated, as well as the number of the epoch in which this
update occurred.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_select_all_help">
</a>
<a class="link" href="mysql-cluster-programs-ndb-select-all.html#option_ndb_select_all_help">
<code class="option">
--help
</code>
</a>
</p>
<a class="indexterm" name="idm46045097745632">
</a>
<a class="indexterm" name="idm46045097744144">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for help">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--help
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Display help text and exit.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_select_all_lock">
</a>
<a class="link" href="mysql-cluster-programs-ndb-select-all.html#option_ndb_select_all_lock">
<code class="option">
--lock=
<em class="replaceable">
<code>
lock_type
</code>
</em>
</code>
</a>
,
<code class="option">
-l
<em class="replaceable">
<code>
lock_type
</code>
</em>
</code>
</p>
<a class="indexterm" name="idm46045097733408">
</a>
<a class="indexterm" name="idm46045097731920">
</a>
<p>
Employs a lock when reading the table. Possible values for
<em class="replaceable">
<code>
lock_type
</code>
</em>
are:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<code class="literal">
0
</code>
: Read lock
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
1
</code>
: Read lock with hold
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
2
</code>
: Exclusive read lock
</p>
</li>
</ul>
</div>
<p>
There is no default value for this option.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_select_all_login-path">
</a>
<a class="link" href="mysql-cluster-programs-ndb-select-all.html#option_ndb_select_all_login-path">
<code class="option">
--login-path
</code>
</a>
</p>
<a class="indexterm" name="idm46045097721936">
</a>
<a class="indexterm" name="idm46045097720448">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for login-path">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--login-path=path
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
[none]
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Read given path from login file.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_select_all_no-login-paths">
</a>
<a class="link" href="mysql-cluster-programs-ndb-select-all.html#option_ndb_select_all_no-login-paths">
<code class="option">
--no-login-paths
</code>
</a>
</p>
<a class="indexterm" name="idm46045097706176">
</a>
<a class="indexterm" name="idm46045097704688">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for no-login-paths">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--no-login-paths
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Skips reading options from the login path file.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_select_all_header">
</a>
<a class="link" href="mysql-cluster-programs-ndb-select-all.html#option_ndb_select_all_header">
<code class="option">
--header=FALSE
</code>
</a>
</p>
<a class="indexterm" name="idm46045097694912">
</a>
<a class="indexterm" name="idm46045097693424">
</a>
<p>
Excludes column headers from the output.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_select_all_nodata">
</a>
<a class="link" href="mysql-cluster-programs-ndb-select-all.html#option_ndb_select_all_nodata">
<code class="option">
--nodata
</code>
</a>
</p>
<a class="indexterm" name="idm46045097689168">
</a>
<a class="indexterm" name="idm46045097687680">
</a>
<p>
Causes any table data to be omitted.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_select_all_ndb-connectstring">
</a>
<a class="link" href="mysql-cluster-programs-ndb-select-all.html#option_ndb_select_all_ndb-connectstring">
<code class="option">
--ndb-connectstring
</code>
</a>
</p>
<a class="indexterm" name="idm46045097683600">
</a>
<a class="indexterm" name="idm46045097682144">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for ndb-connectstring">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--ndb-connectstring=connection_string
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
[none]
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Set connection string for connecting to
<a class="link" href="mysql-cluster-programs-ndb-mgmd.html" title="25.5.4 ndb_mgmd — The NDB Cluster Management Server Daemon">
<span class="command">
<strong>
ndb_mgmd
</strong>
</span>
</a>
. Syntax:
<code class="literal">
[nodeid=
<em class="replaceable">
<code>
id
</code>
</em>
;][host=]
<em class="replaceable">
<code>
hostname
</code>
</em>
[:
<em class="replaceable">
<code>
port
</code>
</em>
]
</code>
.
Overrides entries in
<code class="literal">
NDB_CONNECTSTRING
</code>
and
<code class="filename">
my.cnf
</code>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_select_all_ndb-mgm-tls">
</a>
<a class="link" href="mysql-cluster-programs-ndb-select-all.html#option_ndb_select_all_ndb-mgm-tls">
<code class="option">
--ndb-mgm-tls
</code>
</a>
</p>
<a class="indexterm" name="idm46045097663104">
</a>
<a class="indexterm" name="idm46045097661616">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for ndb-mgm-tls">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--ndb-mgm-tls=level
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
Enumeration
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
relaxed
</code>
</td>
</tr>
<tr>
<th>
Valid Values
</th>
<td>
<p class="valid-value">
<code class="literal">
relaxed
</code>
</p>
<p class="valid-value">
<code class="literal">
strict
</code>
</p>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Sets the level of TLS support required to connect to the
management server; one of
<code class="literal">
relaxed
</code>
or
<code class="literal">
strict
</code>
.
<code class="literal">
relaxed
</code>
(the
default) means that a TLS connection is attempted, but
success is not required;
<code class="literal">
strict
</code>
means
that TLS is required to connect.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_select_all_ndb-mgmd-host">
</a>
<a class="link" href="mysql-cluster-programs-ndb-select-all.html#option_ndb_select_all_ndb-mgmd-host">
<code class="option">
--ndb-mgmd-host
</code>
</a>
</p>
<a class="indexterm" name="idm46045097640560">
</a>
<a class="indexterm" name="idm46045097639072">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for ndb-mgmd-host">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--ndb-mgmd-host=connection_string
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
[none]
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Same as
<a class="link" href="mysql-cluster-programs-ndb-select-all.html#option_ndb_select_all_ndb-connectstring">
<code class="option">
--ndb-connectstring
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_select_all_ndb-nodeid">
</a>
<a class="link" href="mysql-cluster-programs-ndb-select-all.html#option_ndb_select_all_ndb-nodeid">
<code class="option">
--ndb-nodeid
</code>
</a>
</p>
<a class="indexterm" name="idm46045097623824">
</a>
<a class="indexterm" name="idm46045097622336">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for ndb-nodeid">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--ndb-nodeid=#
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
Integer
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
[none]
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Set node ID for this node, overriding any ID set by
<a class="link" href="mysql-cluster-programs-ndb-select-all.html#option_ndb_select_all_ndb-connectstring">
<code class="option">
--ndb-connectstring
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_select_all_ndb-optimized-node-selection">
</a>
<a class="link" href="mysql-cluster-programs-ndb-select-all.html#option_ndb_select_all_ndb-optimized-node-selection">
<code class="option">
--ndb-optimized-node-selection
</code>
</a>
</p>
<a class="indexterm" name="idm46045097607008">
</a>
<a class="indexterm" name="idm46045097605504">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for ndb-optimized-node-selection">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--ndb-optimized-node-selection
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Enable optimizations for selection of nodes for
transactions. Enabled by default; use
<code class="option">
--skip-ndb-optimized-node-selection
</code>
to
disable.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_select_all_ndb-tls-search-path">
</a>
<a class="link" href="mysql-cluster-programs-ndb-select-all.html#option_ndb_select_all_ndb-tls-search-path">
<code class="option">
--ndb-tls-search-path
</code>
</a>
</p>
<a class="indexterm" name="idm46045097595072">
</a>
<a class="indexterm" name="idm46045097593568">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for ndb-tls-search-path">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--ndb-tls-search-path=list
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
Path name
</td>
</tr>
<tr>
<th>
Default Value (Unix)
</th>
<td>
<code class="literal">
$HOME/ndb-tls
</code>
</td>
</tr>
<tr>
<th>
Default Value (Windows)
</th>
<td>
<code class="literal">
$HOMEDIR/ndb-tls
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Specify a list of directories to search for a CA file. On
Unix platforms, the directory names are separated by colons
(
<code class="literal">
:
</code>
); on Windows systems, the semicolon
character (
<code class="literal">
;
</code>
) is used as the separator. A
directory reference may be relative or absolute; it may
contain one or more environment variables, each denoted by a
prefixed dollar sign (
<code class="literal">
$
</code>
), and expanded
prior to use.
</p>
<p>
Searching begins with the leftmost named directory and
proceeds from left to right until a file is found. An empty
string denotes an empty search path, which causes all
searches to fail. A string consisting of a single dot
(
<code class="literal">
.
</code>
) indicates that the search path
limited to the current working directory.
</p>
<p>
If no search path is supplied, the compiled-in default value
is used. This value depends on the platform used: On
Windows, this is
<code class="literal">
\ndb-tls
</code>
; on other
platforms (including Linux), it is
<code class="literal">
$HOME/ndb-tls
</code>
. This can be overridden by
compiling NDB Cluster using
<a class="link" href="source-configuration-options.html#option_cmake_with_ndb_tls_search_path">
<code class="option">
-DWITH_NDB_TLS_SEARCH_PATH
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_select_all_no-defaults">
</a>
<a class="link" href="mysql-cluster-programs-ndb-select-all.html#option_ndb_select_all_no-defaults">
<code class="option">
--no-defaults
</code>
</a>
</p>
<a class="indexterm" name="idm46045097569872">
</a>
<a class="indexterm" name="idm46045097568384">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for no-defaults">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--no-defaults
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Do not read default options from any option file other than
login file.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_select_all_order">
</a>
<a class="link" href="mysql-cluster-programs-ndb-select-all.html#option_ndb_select_all_order">
<code class="option">
--order=
<em class="replaceable">
<code>
index_name
</code>
</em>
</code>
</a>
,
<code class="option">
-o
<em class="replaceable">
<code>
index_name
</code>
</em>
</code>
</p>
<a class="indexterm" name="idm46045097557744">
</a>
<a class="indexterm" name="idm46045097556256">
</a>
<p>
Orders the output according to the index named
<em class="replaceable">
<code>
index_name
</code>
</em>
.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
This is the name of an index, not of a column; the index
must have been explicitly named when created.
</p>
</div>
</li>
<li class="listitem">
<p>
<a name="option_ndb_select_all_parallelism">
</a>
<a class="link" href="mysql-cluster-programs-ndb-select-all.html#option_ndb_select_all_parallelism">
<code class="option">
parallelism=
<em class="replaceable">
<code>
#
</code>
</em>
</code>
</a>
,
<code class="option">
-p
</code>
<em class="replaceable">
<code>
#
</code>
</em>
</p>
<a class="indexterm" name="idm46045097549616">
</a>
<p>
Specifies the degree of parallelism.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_select_all_print-defaults">
</a>
<a class="link" href="mysql-cluster-programs-ndb-select-all.html#option_ndb_select_all_print-defaults">
<code class="option">
--print-defaults
</code>
</a>
</p>
<a class="indexterm" name="idm46045097545424">
</a>
<a class="indexterm" name="idm46045097543936">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for print-defaults">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--print-defaults
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Print program argument list and exit.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_select_all_rowid">
</a>
<a class="link" href="mysql-cluster-programs-ndb-select-all.html#option_ndb_select_all_rowid">
<code class="option">
--rowid
</code>
</a>
</p>
<a class="indexterm" name="idm46045097534160">
</a>
<a class="indexterm" name="idm46045097532672">
</a>
<p>
Adds a
<code class="literal">
ROWID
</code>
column providing information
about the fragments in which rows are stored.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_select_all_tupscan">
</a>
<a class="link" href="mysql-cluster-programs-ndb-select-all.html#option_ndb_select_all_tupscan">
<code class="option">
--tupscan
</code>
</a>
,
<code class="option">
-t
</code>
</p>
<a class="indexterm" name="idm46045097527248">
</a>
<a class="indexterm" name="idm46045097525760">
</a>
<p>
Scan the table in the order of the tuples.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_select_all_usage">
</a>
<a class="link" href="mysql-cluster-programs-ndb-select-all.html#option_ndb_select_all_usage">
<code class="option">
--usage
</code>
</a>
</p>
<a class="indexterm" name="idm46045097521504">
</a>
<a class="indexterm" name="idm46045097520016">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for usage">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--usage
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Display help text and exit; same as
<a class="link" href="mysql-cluster-programs-ndb-select-all.html#option_ndb_select_all_help">
<code class="option">
--help
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_select_all_useHexFormat">
</a>
<a class="link" href="mysql-cluster-programs-ndb-select-all.html#option_ndb_select_all_useHexFormat">
<code class="option">
--useHexFormat
</code>
</a>
<code class="option">
-x
</code>
</p>
<a class="indexterm" name="idm46045097508944">
</a>
<a class="indexterm" name="idm46045097507456">
</a>
<p>
Causes all numeric values to be displayed in hexadecimal
format. This does not affect the output of numerals
contained in strings or datetime values.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_select_all_version">
</a>
<a class="link" href="mysql-cluster-programs-ndb-select-all.html#option_ndb_select_all_version">
<code class="option">
--version
</code>
</a>
</p>
<a class="indexterm" name="idm46045097503072">
</a>
<a class="indexterm" name="idm46045097501584">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for version">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--version
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Display version information and exit.
</p>
</li>
</ul>
</div>
<h4>
<a name="idm46045097493872">
</a>
Sample Output
</h4>
<p>
Output from a MySQL
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
statement:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa34383533"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> ctest1<span class="token punctuation">.</span>fish<span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> id <span class="token punctuation">|</span> name <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 3 <span class="token punctuation">|</span> shark <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 6 <span class="token punctuation">|</span> puffer <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 2 <span class="token punctuation">|</span> tuna <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 4 <span class="token punctuation">|</span> manta ray <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 5 <span class="token punctuation">|</span> grouper <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> guppy <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output">6 rows in set (0.04 sec)</span></code></pre>
</div>
<p>
Output from the equivalent invocation of
<a class="link" href="mysql-cluster-programs-ndb-select-all.html" title="25.5.25 ndb_select_all — Print Rows from an NDB Table">
<span class="command">
<strong>
ndb_select_all
</strong>
</span>
</a>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa68125015"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">./ndb_select_all</span> <span class="token property">-c</span> localhost fish <span class="token property">-d</span> ctest1
id name
3 <span class="token punctuation">[</span>shark<span class="token punctuation">]</span>
6 <span class="token punctuation">[</span>puffer<span class="token punctuation">]</span>
2 <span class="token punctuation">[</span>tuna<span class="token punctuation">]</span>
4 <span class="token punctuation">[</span>manta ray<span class="token punctuation">]</span>
5 <span class="token punctuation">[</span>grouper<span class="token punctuation">]</span>
1 <span class="token punctuation">[</span>guppy<span class="token punctuation">]</span>
6 rows returned</code></pre>
</div>
<p>
All string values are enclosed by square brackets
(
<code class="literal">
[
</code>
...
<code class="literal">
]
</code>
) in the output of
<a class="link" href="mysql-cluster-programs-ndb-select-all.html" title="25.5.25 ndb_select_all — Print Rows from an NDB Table">
<span class="command">
<strong>
ndb_select_all
</strong>
</span>
</a>
. For another example, consider
the table created and populated as shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa41633685"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> dogs <span class="token punctuation">(</span>
id <span class="token datatype">INT</span><span class="token punctuation">(</span><span class="token number">11</span><span class="token punctuation">)</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span> <span class="token keyword">AUTO_INCREMENT</span><span class="token punctuation">,</span>
<span class="token keyword">name</span> <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">25</span><span class="token punctuation">)</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span><span class="token punctuation">,</span>
breed <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">50</span><span class="token punctuation">)</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span><span class="token punctuation">,</span>
<span class="token keyword">PRIMARY</span> <span class="token keyword">KEY</span> pk <span class="token punctuation">(</span>id<span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">KEY</span> ix <span class="token punctuation">(</span><span class="token keyword">name</span><span class="token punctuation">)</span>
<span class="token punctuation">)</span>
<span class="token keyword">TABLESPACE</span> ts <span class="token keyword">STORAGE</span> <span class="token keyword">DISK</span>
<span class="token keyword">ENGINE</span><span class="token operator">=</span><span class="token keyword">NDBCLUSTER</span><span class="token punctuation">;</span>
<span class="token keyword">INSERT</span> <span class="token keyword">INTO</span> dogs <span class="token keyword">VALUES</span>
<span class="token punctuation">(</span><span class="token string">''</span><span class="token punctuation">,</span> <span class="token string">'Lassie'</span><span class="token punctuation">,</span> <span class="token string">'collie'</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token punctuation">(</span><span class="token string">''</span><span class="token punctuation">,</span> <span class="token string">'Scooby-Doo'</span><span class="token punctuation">,</span> <span class="token string">'Great Dane'</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token punctuation">(</span><span class="token string">''</span><span class="token punctuation">,</span> <span class="token string">'Rin-Tin-Tin'</span><span class="token punctuation">,</span> <span class="token string">'Alsatian'</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token punctuation">(</span><span class="token string">''</span><span class="token punctuation">,</span> <span class="token string">'Rosscoe'</span><span class="token punctuation">,</span> <span class="token string">'Mutt'</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
This demonstrates the use of several additional
<a class="link" href="mysql-cluster-programs-ndb-select-all.html" title="25.5.25 ndb_select_all — Print Rows from an NDB Table">
<span class="command">
<strong>
ndb_select_all
</strong>
</span>
</a>
options:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa87667575"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">./ndb_select_all</span> <span class="token property">-d</span> ctest1 dogs <span class="token property">-o</span> ix <span class="token property">-z</span> <span class="token property">--gci</span> <span class="token property">--disk</span>
GCI id name breed DISK_REF
834461 2 <span class="token punctuation">[</span>Scooby-Doo<span class="token punctuation">]</span> <span class="token punctuation">[</span>Great Dane<span class="token punctuation">]</span> <span class="token punctuation">[</span> m_file_no<span class="token punctuation">:</span> 0 m_page<span class="token punctuation">:</span> 98 m_page_idx<span class="token punctuation">:</span> 0 <span class="token punctuation">]</span>
834878 4 <span class="token punctuation">[</span>Rosscoe<span class="token punctuation">]</span> <span class="token punctuation">[</span>Mutt<span class="token punctuation">]</span> <span class="token punctuation">[</span> m_file_no<span class="token punctuation">:</span> 0 m_page<span class="token punctuation">:</span> 98 m_page_idx<span class="token punctuation">:</span> 16 <span class="token punctuation">]</span>
834463 3 <span class="token punctuation">[</span>Rin-Tin-Tin<span class="token punctuation">]</span> <span class="token punctuation">[</span>Alsatian<span class="token punctuation">]</span> <span class="token punctuation">[</span> m_file_no<span class="token punctuation">:</span> 0 m_page<span class="token punctuation">:</span> 34 m_page_idx<span class="token punctuation">:</span> 0 <span class="token punctuation">]</span>
835657 1 <span class="token punctuation">[</span>Lassie<span class="token punctuation">]</span> <span class="token punctuation">[</span>Collie<span class="token punctuation">]</span> <span class="token punctuation">[</span> m_file_no<span class="token punctuation">:</span> 0 m_page<span class="token punctuation">:</span> 66 m_page_idx<span class="token punctuation">:</span> 0 <span class="token punctuation">]</span>
4 rows returned</code></pre>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/sys-version-minor.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="sys-version-minor">
</a>
30.4.5.21 The version_minor() Function
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045060643616">
</a>
<a class="indexterm" name="idm46045060642144">
</a>
<p>
This function returns the minor version of the MySQL server.
</p>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="sys-version-minor-parameters">
</a>
Parameters
</h5>
</div>
</div>
</div>
<p>
None.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="sys-version-minor-return-value">
</a>
Return Value
</h5>
</div>
</div>
</div>
<p>
A
<code class="literal">
TINYINT UNSIGNED
</code>
value.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="sys-version-minor-example">
</a>
Example
</h5>
</div>
</div>
</div>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa3218647"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">VERSION</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">,</span> sys<span class="token punctuation">.</span>version_minor<span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> VERSION() <span class="token punctuation">|</span> sys.version_minor() <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 8.4.0<span class="token punctuation">-</span>tr <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/stored-routines-last-insert-id.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="stored-routines-last-insert-id">
</a>
27.2.4 Stored Procedures, Functions, Triggers, and LAST_INSERT_ID()
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045082444688">
</a>
<a class="indexterm" name="idm46045082443200">
</a>
<a class="indexterm" name="idm46045082441712">
</a>
<a class="indexterm" name="idm46045082440224">
</a>
<p>
Within the body of a stored routine (procedure or function) or a
trigger, the value of
<a class="link" href="information-functions.html#function_last-insert-id">
<code class="literal">
LAST_INSERT_ID()
</code>
</a>
changes the same
way as for statements executed outside the body of these kinds of
objects (see
<a class="xref" href="information-functions.html" title="14.15 Information Functions">
Section 14.15, “Information Functions”
</a>
). The effect
of a stored routine or trigger upon the value of
<a class="link" href="information-functions.html#function_last-insert-id">
<code class="literal">
LAST_INSERT_ID()
</code>
</a>
that is seen by
following statements depends on the kind of routine:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
If a stored procedure executes statements that change the
value of
<a class="link" href="information-functions.html#function_last-insert-id">
<code class="literal">
LAST_INSERT_ID()
</code>
</a>
, the
changed value is seen by statements that follow the procedure
call.
</p>
</li>
<li class="listitem">
<p>
For stored functions and triggers that change the value, the
value is restored when the function or trigger ends, so
following statements do not see a changed value.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/sys-schema-functions.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="sys-schema-functions">
</a>
30.4.5 sys Schema Stored Functions
</h3>
</div>
</div>
</div>
<div class="toc">
<dl class="toc">
<dt>
<span class="section">
<a href="sys-extract-schema-from-file-name.html">
30.4.5.1 The extract_schema_from_file_name() Function
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="sys-extract-table-from-file-name.html">
30.4.5.2 The extract_table_from_file_name() Function
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="sys-format-bytes.html">
30.4.5.3 The format_bytes() Function
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="sys-format-path.html">
30.4.5.4 The format_path() Function
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="sys-format-statement.html">
30.4.5.5 The format_statement() Function
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="sys-format-time.html">
30.4.5.6 The format_time() Function
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="sys-list-add.html">
30.4.5.7 The list_add() Function
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="sys-list-drop.html">
30.4.5.8 The list_drop() Function
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="sys-ps-is-account-enabled.html">
30.4.5.9 The ps_is_account_enabled() Function
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="sys-ps-is-consumer-enabled.html">
30.4.5.10 The ps_is_consumer_enabled() Function
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="sys-ps-is-instrument-default-enabled.html">
30.4.5.11 The ps_is_instrument_default_enabled() Function
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="sys-ps-is-instrument-default-timed.html">
30.4.5.12 The ps_is_instrument_default_timed() Function
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="sys-ps-is-thread-instrumented.html">
30.4.5.13 The ps_is_thread_instrumented() Function
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="sys-ps-thread-account.html">
30.4.5.14 The ps_thread_account() Function
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="sys-ps-thread-id.html">
30.4.5.15 The ps_thread_id() Function
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="sys-ps-thread-stack.html">
30.4.5.16 The ps_thread_stack() Function
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="sys-ps-thread-trx-info.html">
30.4.5.17 The ps_thread_trx_info() Function
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="sys-quote-identifier.html">
30.4.5.18 The quote_identifier() Function
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="sys-sys-get-config.html">
30.4.5.19 The sys_get_config() Function
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="sys-version-major.html">
30.4.5.20 The version_major() Function
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="sys-version-minor.html">
30.4.5.21 The version_minor() Function
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="sys-version-patch.html">
30.4.5.22 The version_patch() Function
</a>
</span>
</dt>
</dl>
</div>
<p>
The following sections describe
<a class="link" href="sys-schema.html" title="Chapter 30 MySQL sys Schema">
<code class="literal">
sys
</code>
</a>
schema stored functions.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/partitioning-columns-range.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="partitioning-columns-range">
</a>
26.2.3.1 RANGE COLUMNS partitioning
</h4>
</div>
</div>
</div>
<p>
Range columns partitioning is similar to range partitioning,
but enables you to define partitions using ranges based on
multiple column values. In addition, you can define the ranges
using columns of types other than integer types.
</p>
<p>
<code class="literal">
RANGE COLUMNS
</code>
partitioning differs
significantly from
<code class="literal">
RANGE
</code>
partitioning in
the following ways:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
RANGE COLUMNS
</code>
does not accept
expressions, only names of columns.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
RANGE COLUMNS
</code>
accepts a list of one or
more columns.
</p>
<p>
<code class="literal">
RANGE COLUMNS
</code>
partitions are based on
comparisons between
<span class="firstterm">
tuples
</span>
(lists of
column values) rather than comparisons between scalar
values. Placement of rows in
<code class="literal">
RANGE
COLUMNS
</code>
partitions is also based on comparisons
between tuples; this is discussed further later in this
section.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
RANGE COLUMNS
</code>
partitioning columns are
not restricted to integer columns; string,
<a class="link" href="datetime.html" title="13.2.2 The DATE, DATETIME, and TIMESTAMP Types">
<code class="literal">
DATE
</code>
</a>
and
<a class="link" href="datetime.html" title="13.2.2 The DATE, DATETIME, and TIMESTAMP Types">
<code class="literal">
DATETIME
</code>
</a>
columns can also
be used as partitioning columns. (See
<a class="xref" href="partitioning-columns.html" title="26.2.3 COLUMNS Partitioning">
Section 26.2.3, “COLUMNS Partitioning”
</a>
, for details.)
</p>
</li>
</ul>
</div>
<p>
The basic syntax for creating a table partitioned by
<code class="literal">
RANGE COLUMNS
</code>
is shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa24534008"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> <span class="token keyword"><em class="replaceable">table_name</em></span>
<span class="token keyword">PARTITION</span> <span class="token keyword">BY</span> <span class="token keyword">RANGE</span> <span class="token keyword">COLUMNS</span><span class="token punctuation">(</span><em class="replaceable">column_list</em><span class="token punctuation">)</span> <span class="token punctuation">(</span>
<span class="token keyword">PARTITION</span> <em class="replaceable">partition_name</em> <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token punctuation">(</span><em class="replaceable">value_list</em><span class="token punctuation">)</span><span class="token punctuation">[</span><span class="token punctuation">,</span>
<span class="token keyword">PARTITION</span> <em class="replaceable">partition_name</em> <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token punctuation">(</span><em class="replaceable">value_list</em><span class="token punctuation">)</span><span class="token punctuation">]</span><span class="token punctuation">[</span><span class="token punctuation">,</span>
<span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">]</span>
<span class="token punctuation">)</span>
<em class="replaceable">column_list</em>:
<span class="token keyword"><em class="replaceable">column_name</em></span><span class="token punctuation">[</span><span class="token punctuation">,</span> <span class="token keyword"><em class="replaceable">column_name</em></span><span class="token punctuation">]</span><span class="token punctuation">[</span><span class="token punctuation">,</span> <span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">]</span>
<em class="replaceable">value_list</em>:
<span class="token keyword"><em class="replaceable">value</em></span><span class="token punctuation">[</span><span class="token punctuation">,</span> <span class="token keyword"><em class="replaceable">value</em></span><span class="token punctuation">]</span><span class="token punctuation">[</span><span class="token punctuation">,</span> <span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">]</span></code></pre>
</div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
Not all
<a class="link" href="create-table.html" title="15.1.20 CREATE TABLE Statement">
<code class="literal">
CREATE TABLE
</code>
</a>
options
that can be used when creating partitioned tables are shown
here. For complete information, see
<a class="xref" href="create-table.html" title="15.1.20 CREATE TABLE Statement">
Section 15.1.20, “CREATE TABLE Statement”
</a>
.
</p>
</div>
<p>
In the syntax just shown,
<em class="replaceable">
<code>
column_list
</code>
</em>
is a list of one or
more columns (sometimes called a
<span class="firstterm">
partitioning column
list
</span>
), and
<em class="replaceable">
<code>
value_list
</code>
</em>
is
a list of values (that is, it is a
<span class="firstterm">
partition definition value
list
</span>
). A
<em class="replaceable">
<code>
value_list
</code>
</em>
must
be supplied for each partition definition, and each
<em class="replaceable">
<code>
value_list
</code>
</em>
must have the same
number of values as the
<em class="replaceable">
<code>
column_list
</code>
</em>
has columns. Generally speaking, if you use
<em class="replaceable">
<code>
N
</code>
</em>
columns in the
<code class="literal">
COLUMNS
</code>
clause, then each
<code class="literal">
VALUES
LESS THAN
</code>
clause must also be supplied with a list
of
<em class="replaceable">
<code>
N
</code>
</em>
values.
</p>
<p>
The elements in the partitioning column list and in the value
list defining each partition must occur in the same order. In
addition, each element in the value list must be of the same
data type as the corresponding element in the column list.
However, the order of the column names in the partitioning
column list and the value lists does not have to be the same
as the order of the table column definitions in the main part
of the
<a class="link" href="create-table.html" title="15.1.20 CREATE TABLE Statement">
<code class="literal">
CREATE TABLE
</code>
</a>
statement.
As with table partitioned by
<code class="literal">
RANGE
</code>
, you can
use
<code class="literal">
MAXVALUE
</code>
to represent a value such that
any legal value inserted into a given column is always less
than this value. Here is an example of a
<a class="link" href="create-table.html" title="15.1.20 CREATE TABLE Statement">
<code class="literal">
CREATE TABLE
</code>
</a>
statement that
helps to illustrate all of these points:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa89092468"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> rcx <span class="token punctuation">(</span>
<span class="token prompt"> -></span> a <span class="token datatype">INT</span><span class="token punctuation">,</span>
<span class="token prompt"> -></span> b <span class="token datatype">INT</span><span class="token punctuation">,</span>
<span class="token prompt"> -></span> c <span class="token datatype">CHAR</span><span class="token punctuation">(</span><span class="token number">3</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token prompt"> -></span> d <span class="token datatype">INT</span>
<span class="token prompt"> -></span> <span class="token punctuation">)</span>
<span class="token prompt"> -></span> <span class="token keyword">PARTITION</span> <span class="token keyword">BY</span> <span class="token keyword">RANGE</span> <span class="token keyword">COLUMNS</span><span class="token punctuation">(</span>a<span class="token punctuation">,</span>d<span class="token punctuation">,</span>c<span class="token punctuation">)</span> <span class="token punctuation">(</span>
<span class="token prompt"> -></span> <span class="token keyword">PARTITION</span> p0 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token punctuation">(</span><span class="token number">5</span><span class="token punctuation">,</span><span class="token number">10</span><span class="token punctuation">,</span><span class="token string">'ggg'</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token prompt"> -></span> <span class="token keyword">PARTITION</span> p1 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token punctuation">(</span><span class="token number">10</span><span class="token punctuation">,</span><span class="token number">20</span><span class="token punctuation">,</span><span class="token string">'mmm'</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token prompt"> -></span> <span class="token keyword">PARTITION</span> p2 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token punctuation">(</span><span class="token number">15</span><span class="token punctuation">,</span><span class="token number">30</span><span class="token punctuation">,</span><span class="token string">'sss'</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token prompt"> -></span> <span class="token keyword">PARTITION</span> p3 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token punctuation">(</span><span class="token keyword">MAXVALUE</span><span class="token punctuation">,</span><span class="token keyword">MAXVALUE</span><span class="token punctuation">,</span><span class="token keyword">MAXVALUE</span><span class="token punctuation">)</span>
<span class="token prompt"> -></span> <span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 0 rows affected (0.15 sec)</span></code></pre>
</div>
<p>
Table
<code class="literal">
rcx
</code>
contains the columns
<code class="literal">
a
</code>
,
<code class="literal">
b
</code>
,
<code class="literal">
c
</code>
,
<code class="literal">
d
</code>
. The partitioning
column list supplied to the
<code class="literal">
COLUMNS
</code>
clause
uses 3 of these columns, in the order
<code class="literal">
a
</code>
,
<code class="literal">
d
</code>
,
<code class="literal">
c
</code>
. Each value list
used to define a partition contains 3 values in the same
order; that is, each value list tuple has the form
(
<code class="literal">
INT
</code>
,
<code class="literal">
INT
</code>
,
<code class="literal">
CHAR(3)
</code>
), which corresponds to the data
types used by columns
<code class="literal">
a
</code>
,
<code class="literal">
d
</code>
, and
<code class="literal">
c
</code>
(in that
order).
</p>
<p>
Placement of rows into partitions is determined by comparing
the tuple from a row to be inserted that matches the column
list in the
<code class="literal">
COLUMNS
</code>
clause with the tuples
used in the
<code class="literal">
VALUES LESS THAN
</code>
clauses to
define partitions of the table. Because we are comparing
tuples (that is, lists or sets of values) rather than scalar
values, the semantics of
<code class="literal">
VALUES LESS THAN
</code>
as used with
<code class="literal">
RANGE COLUMNS
</code>
partitions
differs somewhat from the case with simple
<code class="literal">
RANGE
</code>
partitions. In
<code class="literal">
RANGE
</code>
partitioning, a row generating an
expression value that is equal to a limiting value in a
<code class="literal">
VALUES LESS THAN
</code>
is never placed in the
corresponding partition; however, when using
<code class="literal">
RANGE
COLUMNS
</code>
partitioning, it is sometimes possible for a
row whose partitioning column list's first element is
equal in value to the that of the first element in a
<code class="literal">
VALUES LESS THAN
</code>
value list to be placed in
the corresponding partition.
</p>
<p>
Consider the
<code class="literal">
RANGE
</code>
partitioned table
created by this statement:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa72772758"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> r1 <span class="token punctuation">(</span>
a <span class="token datatype">INT</span><span class="token punctuation">,</span>
b <span class="token datatype">INT</span>
<span class="token punctuation">)</span>
<span class="token keyword">PARTITION</span> <span class="token keyword">BY</span> <span class="token keyword">RANGE</span> <span class="token punctuation">(</span>a<span class="token punctuation">)</span> <span class="token punctuation">(</span>
<span class="token keyword">PARTITION</span> p0 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token punctuation">(</span><span class="token number">5</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">PARTITION</span> p1 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token punctuation">(</span><span class="token keyword">MAXVALUE</span><span class="token punctuation">)</span>
<span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
If we insert 3 rows into this table such that the column value
for
<code class="literal">
a
</code>
is
<code class="literal">
5
</code>
for each row,
all 3 rows are stored in partition
<code class="literal">
p1
</code>
because the
<code class="literal">
a
</code>
column value is in each case
not less than 5, as we can see by executing the proper query
against the Information Schema
<a class="link" href="information-schema-partitions-table.html" title="28.3.21 The INFORMATION_SCHEMA PARTITIONS Table">
<code class="literal">
PARTITIONS
</code>
</a>
table:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa21516889"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">INSERT</span> <span class="token keyword">INTO</span> r1 <span class="token keyword">VALUES</span> <span class="token punctuation">(</span><span class="token number">5</span><span class="token punctuation">,</span><span class="token number">10</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token number">5</span><span class="token punctuation">,</span><span class="token number">11</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token number">5</span><span class="token punctuation">,</span><span class="token number">12</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 3 rows affected (0.00 sec)</span>
<span class="token output">Records: 3 Duplicates: 0 Warnings: 0</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> PARTITION_NAME<span class="token punctuation">,</span> TABLE_ROWS
<span class="token prompt"> -></span> <span class="token keyword">FROM</span> INFORMATION_SCHEMA<span class="token punctuation">.</span><span class="token keyword">PARTITIONS</span>
<span class="token prompt"> -></span> <span class="token keyword">WHERE</span> <span class="token keyword">TABLE_NAME</span> <span class="token operator">=</span> <span class="token string">'r1'</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> PARTITION_NAME <span class="token punctuation">|</span> TABLE_ROWS <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> p0 <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> p1 <span class="token punctuation">|</span> 3 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output">2 rows in set (0.00 sec)</span></code></pre>
</div>
<p>
Now consider a similar table
<code class="literal">
rc1
</code>
that uses
<code class="literal">
RANGE COLUMNS
</code>
partitioning with both
columns
<code class="literal">
a
</code>
and
<code class="literal">
b
</code>
referenced in the
<code class="literal">
COLUMNS
</code>
clause, created
as shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa57220079"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> rc1 <span class="token punctuation">(</span>
a <span class="token datatype">INT</span><span class="token punctuation">,</span>
b <span class="token datatype">INT</span>
<span class="token punctuation">)</span>
<span class="token keyword">PARTITION</span> <span class="token keyword">BY</span> <span class="token keyword">RANGE</span> <span class="token keyword">COLUMNS</span><span class="token punctuation">(</span>a<span class="token punctuation">,</span> b<span class="token punctuation">)</span> <span class="token punctuation">(</span>
<span class="token keyword">PARTITION</span> p0 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token punctuation">(</span><span class="token number">5</span><span class="token punctuation">,</span> <span class="token number">12</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">PARTITION</span> p3 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token punctuation">(</span><span class="token keyword">MAXVALUE</span><span class="token punctuation">,</span> <span class="token keyword">MAXVALUE</span><span class="token punctuation">)</span>
<span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
If we insert exactly the same rows into
<code class="literal">
rc1
</code>
as we just inserted into
<code class="literal">
r1
</code>
, the
distribution of the rows is quite different:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa34260857"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">INSERT</span> <span class="token keyword">INTO</span> rc1 <span class="token keyword">VALUES</span> <span class="token punctuation">(</span><span class="token number">5</span><span class="token punctuation">,</span><span class="token number">10</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token number">5</span><span class="token punctuation">,</span><span class="token number">11</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token number">5</span><span class="token punctuation">,</span><span class="token number">12</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 3 rows affected (0.00 sec)</span>
<span class="token output">Records: 3 Duplicates: 0 Warnings: 0</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> PARTITION_NAME<span class="token punctuation">,</span> TABLE_ROWS
<span class="token prompt"> -></span> <span class="token keyword">FROM</span> INFORMATION_SCHEMA<span class="token punctuation">.</span><span class="token keyword">PARTITIONS</span>
<span class="token prompt"> -></span> <span class="token keyword">WHERE</span> <span class="token keyword">TABLE_NAME</span> <span class="token operator">=</span> <span class="token string">'rc1'</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> PARTITION_NAME <span class="token punctuation">|</span> TABLE_ROWS <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> p0 <span class="token punctuation">|</span> 2 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> p3 <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output">2 rows in set (0.00 sec)</span></code></pre>
</div>
<p>
This is because we are comparing rows rather than scalar
values. We can compare the row values inserted with the
limiting row value from the
<code class="literal">
VALUES THAN LESS
THAN
</code>
clause used to define partition
<code class="literal">
p0
</code>
in table
<code class="literal">
rc1
</code>
, like
this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa93357089"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token punctuation">(</span><span class="token number">5</span><span class="token punctuation">,</span><span class="token number">10</span><span class="token punctuation">)</span> <span class="token operator"><</span> <span class="token punctuation">(</span><span class="token number">5</span><span class="token punctuation">,</span><span class="token number">12</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token number">5</span><span class="token punctuation">,</span><span class="token number">11</span><span class="token punctuation">)</span> <span class="token operator"><</span> <span class="token punctuation">(</span><span class="token number">5</span><span class="token punctuation">,</span><span class="token number">12</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token number">5</span><span class="token punctuation">,</span><span class="token number">12</span><span class="token punctuation">)</span> <span class="token operator"><</span> <span class="token punctuation">(</span><span class="token number">5</span><span class="token punctuation">,</span><span class="token number">12</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> (5,10) < (5,12) <span class="token punctuation">|</span> (5,11) < (5,12) <span class="token punctuation">|</span> (5,12) < (5,12) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output">1 row in set (0.00 sec)</span></code></pre>
</div>
<p>
The 2 tuples
<code class="literal">
(5,10)
</code>
and
<code class="literal">
(5,11)
</code>
evaluate as less than
<code class="literal">
(5,12)
</code>
, so they are stored in partition
<code class="literal">
p0
</code>
. Since 5 is not less than 5 and 12 is
not less than 12,
<code class="literal">
(5,12)
</code>
is considered not
less than
<code class="literal">
(5,12)
</code>
, and is stored in
partition
<code class="literal">
p1
</code>
.
</p>
<p>
The
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
statement in the
preceding example could also have been written using explicit
row constructors, like this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa92155890"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SELECT</span> <span class="token keyword">ROW</span><span class="token punctuation">(</span><span class="token number">5</span><span class="token punctuation">,</span><span class="token number">10</span><span class="token punctuation">)</span> <span class="token operator"><</span> <span class="token keyword">ROW</span><span class="token punctuation">(</span><span class="token number">5</span><span class="token punctuation">,</span><span class="token number">12</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token keyword">ROW</span><span class="token punctuation">(</span><span class="token number">5</span><span class="token punctuation">,</span><span class="token number">11</span><span class="token punctuation">)</span> <span class="token operator"><</span> <span class="token keyword">ROW</span><span class="token punctuation">(</span><span class="token number">5</span><span class="token punctuation">,</span><span class="token number">12</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token keyword">ROW</span><span class="token punctuation">(</span><span class="token number">5</span><span class="token punctuation">,</span><span class="token number">12</span><span class="token punctuation">)</span> <span class="token operator"><</span> <span class="token keyword">ROW</span><span class="token punctuation">(</span><span class="token number">5</span><span class="token punctuation">,</span><span class="token number">12</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
For more information about the use of row constructors in
MySQL, see
<a class="xref" href="row-subqueries.html" title="15.2.15.5 Row Subqueries">
Section 15.2.15.5, “Row Subqueries”
</a>
.
</p>
<p>
For a table partitioned by
<code class="literal">
RANGE COLUMNS
</code>
using only a single partitioning column, the storing of rows
in partitions is the same as that of an equivalent table that
is partitioned by
<code class="literal">
RANGE
</code>
. The following
<code class="literal">
CREATE TABLE
</code>
statement creates a table
partitioned by
<code class="literal">
RANGE COLUMNS
</code>
using 1
partitioning column:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa69911990"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> rx <span class="token punctuation">(</span>
a <span class="token datatype">INT</span><span class="token punctuation">,</span>
b <span class="token datatype">INT</span>
<span class="token punctuation">)</span>
<span class="token keyword">PARTITION</span> <span class="token keyword">BY</span> <span class="token keyword">RANGE</span> <span class="token keyword">COLUMNS</span> <span class="token punctuation">(</span>a<span class="token punctuation">)</span> <span class="token punctuation">(</span>
<span class="token keyword">PARTITION</span> p0 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token punctuation">(</span><span class="token number">5</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">PARTITION</span> p1 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token punctuation">(</span><span class="token keyword">MAXVALUE</span><span class="token punctuation">)</span>
<span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
If we insert the rows
<code class="literal">
(5,10)
</code>
,
<code class="literal">
(5,11)
</code>
, and
<code class="literal">
(5,12)
</code>
into
this table, we can see that their placement is the same as it
is for the table
<code class="literal">
r
</code>
we created and populated
earlier:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa281339"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">INSERT</span> <span class="token keyword">INTO</span> rx <span class="token keyword">VALUES</span> <span class="token punctuation">(</span><span class="token number">5</span><span class="token punctuation">,</span><span class="token number">10</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token number">5</span><span class="token punctuation">,</span><span class="token number">11</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token number">5</span><span class="token punctuation">,</span><span class="token number">12</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 3 rows affected (0.00 sec)</span>
<span class="token output">Records: 3 Duplicates: 0 Warnings: 0</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> PARTITION_NAME<span class="token punctuation">,</span>TABLE_ROWS
<span class="token prompt"> -></span> <span class="token keyword">FROM</span> INFORMATION_SCHEMA<span class="token punctuation">.</span><span class="token keyword">PARTITIONS</span>
<span class="token prompt"> -></span> <span class="token keyword">WHERE</span> <span class="token keyword">TABLE_NAME</span> <span class="token operator">=</span> <span class="token string">'rx'</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> PARTITION_NAME <span class="token punctuation">|</span> TABLE_ROWS <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> p0 <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> p1 <span class="token punctuation">|</span> 3 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output">2 rows in set (0.00 sec)</span></code></pre>
</div>
<p>
It is also possible to create tables partitioned by
<code class="literal">
RANGE COLUMNS
</code>
where limiting values for one
or more columns are repeated in successive partition
definitions. You can do this as long as the tuples of column
values used to define the partitions are strictly increasing.
For example, each of the following
<a class="link" href="create-table.html" title="15.1.20 CREATE TABLE Statement">
<code class="literal">
CREATE
TABLE
</code>
</a>
statements is valid:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa18956382"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> rc2 <span class="token punctuation">(</span>
a <span class="token datatype">INT</span><span class="token punctuation">,</span>
b <span class="token datatype">INT</span>
<span class="token punctuation">)</span>
<span class="token keyword">PARTITION</span> <span class="token keyword">BY</span> <span class="token keyword">RANGE</span> <span class="token keyword">COLUMNS</span><span class="token punctuation">(</span>a<span class="token punctuation">,</span>b<span class="token punctuation">)</span> <span class="token punctuation">(</span>
<span class="token keyword">PARTITION</span> p0 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token punctuation">(</span><span class="token number">0</span><span class="token punctuation">,</span><span class="token number">10</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">PARTITION</span> p1 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token punctuation">(</span><span class="token number">10</span><span class="token punctuation">,</span><span class="token number">20</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">PARTITION</span> p2 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token punctuation">(</span><span class="token number">10</span><span class="token punctuation">,</span><span class="token number">30</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">PARTITION</span> p3 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token punctuation">(</span><span class="token keyword">MAXVALUE</span><span class="token punctuation">,</span><span class="token keyword">MAXVALUE</span><span class="token punctuation">)</span>
<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> rc3 <span class="token punctuation">(</span>
a <span class="token datatype">INT</span><span class="token punctuation">,</span>
b <span class="token datatype">INT</span>
<span class="token punctuation">)</span>
<span class="token keyword">PARTITION</span> <span class="token keyword">BY</span> <span class="token keyword">RANGE</span> <span class="token keyword">COLUMNS</span><span class="token punctuation">(</span>a<span class="token punctuation">,</span>b<span class="token punctuation">)</span> <span class="token punctuation">(</span>
<span class="token keyword">PARTITION</span> p0 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token punctuation">(</span><span class="token number">0</span><span class="token punctuation">,</span><span class="token number">10</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">PARTITION</span> p1 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token punctuation">(</span><span class="token number">10</span><span class="token punctuation">,</span><span class="token number">20</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">PARTITION</span> p2 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token punctuation">(</span><span class="token number">10</span><span class="token punctuation">,</span><span class="token number">30</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">PARTITION</span> p3 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token punctuation">(</span><span class="token number">10</span><span class="token punctuation">,</span><span class="token number">35</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">PARTITION</span> p4 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token punctuation">(</span><span class="token number">20</span><span class="token punctuation">,</span><span class="token number">40</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">PARTITION</span> p5 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token punctuation">(</span><span class="token keyword">MAXVALUE</span><span class="token punctuation">,</span><span class="token keyword">MAXVALUE</span><span class="token punctuation">)</span>
<span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
The following statement also succeeds, even though it might
appear at first glance that it would not, since the limiting
value of column
<code class="literal">
b
</code>
is 25 for partition
<code class="literal">
p0
</code>
and 20 for partition
<code class="literal">
p1
</code>
, and the limiting value of column
<code class="literal">
c
</code>
is 100 for partition
<code class="literal">
p1
</code>
and 50 for partition
<code class="literal">
p2
</code>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa29912216"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> rc4 <span class="token punctuation">(</span>
a <span class="token datatype">INT</span><span class="token punctuation">,</span>
b <span class="token datatype">INT</span><span class="token punctuation">,</span>
c <span class="token datatype">INT</span>
<span class="token punctuation">)</span>
<span class="token keyword">PARTITION</span> <span class="token keyword">BY</span> <span class="token keyword">RANGE</span> <span class="token keyword">COLUMNS</span><span class="token punctuation">(</span>a<span class="token punctuation">,</span>b<span class="token punctuation">,</span>c<span class="token punctuation">)</span> <span class="token punctuation">(</span>
<span class="token keyword">PARTITION</span> p0 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token punctuation">(</span><span class="token number">0</span><span class="token punctuation">,</span><span class="token number">25</span><span class="token punctuation">,</span><span class="token number">50</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">PARTITION</span> p1 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token punctuation">(</span><span class="token number">10</span><span class="token punctuation">,</span><span class="token number">20</span><span class="token punctuation">,</span><span class="token number">100</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">PARTITION</span> p2 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token punctuation">(</span><span class="token number">10</span><span class="token punctuation">,</span><span class="token number">30</span><span class="token punctuation">,</span><span class="token number">50</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">PARTITION</span> p3 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token punctuation">(</span><span class="token keyword">MAXVALUE</span><span class="token punctuation">,</span><span class="token keyword">MAXVALUE</span><span class="token punctuation">,</span><span class="token keyword">MAXVALUE</span><span class="token punctuation">)</span>
<span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
When designing tables partitioned by
<code class="literal">
RANGE
COLUMNS
</code>
, you can always test successive partition
definitions by comparing the desired tuples using the
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
client, like this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa18001430"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token punctuation">(</span><span class="token number">0</span><span class="token punctuation">,</span><span class="token number">25</span><span class="token punctuation">,</span><span class="token number">50</span><span class="token punctuation">)</span> <span class="token operator"><</span> <span class="token punctuation">(</span><span class="token number">10</span><span class="token punctuation">,</span><span class="token number">20</span><span class="token punctuation">,</span><span class="token number">100</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token number">10</span><span class="token punctuation">,</span><span class="token number">20</span><span class="token punctuation">,</span><span class="token number">100</span><span class="token punctuation">)</span> <span class="token operator"><</span> <span class="token punctuation">(</span><span class="token number">10</span><span class="token punctuation">,</span><span class="token number">30</span><span class="token punctuation">,</span><span class="token number">50</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> (0,25,50) < (10,20,100) <span class="token punctuation">|</span> (10,20,100) < (10,30,50) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output">1 row in set (0.00 sec)</span></code></pre>
</div>
<p>
If a
<a class="link" href="create-table.html" title="15.1.20 CREATE TABLE Statement">
<code class="literal">
CREATE TABLE
</code>
</a>
statement
contains partition definitions that are not in strictly
increasing order, it fails with an error, as shown in this
example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa96421213"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> rcf <span class="token punctuation">(</span>
<span class="token prompt"> -></span> a <span class="token datatype">INT</span><span class="token punctuation">,</span>
<span class="token prompt"> -></span> b <span class="token datatype">INT</span><span class="token punctuation">,</span>
<span class="token prompt"> -></span> c <span class="token datatype">INT</span>
<span class="token prompt"> -></span> <span class="token punctuation">)</span>
<span class="token prompt"> -></span> <span class="token keyword">PARTITION</span> <span class="token keyword">BY</span> <span class="token keyword">RANGE</span> <span class="token keyword">COLUMNS</span><span class="token punctuation">(</span>a<span class="token punctuation">,</span>b<span class="token punctuation">,</span>c<span class="token punctuation">)</span> <span class="token punctuation">(</span>
<span class="token prompt"> -></span> <span class="token keyword">PARTITION</span> p0 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token punctuation">(</span><span class="token number">0</span><span class="token punctuation">,</span><span class="token number">25</span><span class="token punctuation">,</span><span class="token number">50</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token prompt"> -></span> <span class="token keyword">PARTITION</span> p1 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token punctuation">(</span><span class="token number">20</span><span class="token punctuation">,</span><span class="token number">20</span><span class="token punctuation">,</span><span class="token number">100</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token prompt"> -></span> <span class="token keyword">PARTITION</span> p2 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token punctuation">(</span><span class="token number">10</span><span class="token punctuation">,</span><span class="token number">30</span><span class="token punctuation">,</span><span class="token number">50</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token prompt"> -></span> <span class="token keyword">PARTITION</span> p3 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token punctuation">(</span><span class="token keyword">MAXVALUE</span><span class="token punctuation">,</span><span class="token keyword">MAXVALUE</span><span class="token punctuation">,</span><span class="token keyword">MAXVALUE</span><span class="token punctuation">)</span>
<span class="token prompt"> -></span> <span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output">ERROR 1493 (HY000)<span class="token punctuation">:</span> VALUES LESS THAN value must be strictly increasing for each partition</span></code></pre>
</div>
<p>
When you get such an error, you can deduce which partition
definitions are invalid by making
<span class="quote">
“
<span class="quote">
less than
</span>
”
</span>
comparisons between their column lists. In this case, the
problem is with the definition of partition
<code class="literal">
p2
</code>
because the tuple used to define it is
not less than the tuple used to define partition
<code class="literal">
p3
</code>
, as shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa15415860"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token punctuation">(</span><span class="token number">0</span><span class="token punctuation">,</span><span class="token number">25</span><span class="token punctuation">,</span><span class="token number">50</span><span class="token punctuation">)</span> <span class="token operator"><</span> <span class="token punctuation">(</span><span class="token number">20</span><span class="token punctuation">,</span><span class="token number">20</span><span class="token punctuation">,</span><span class="token number">100</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token number">20</span><span class="token punctuation">,</span><span class="token number">20</span><span class="token punctuation">,</span><span class="token number">100</span><span class="token punctuation">)</span> <span class="token operator"><</span> <span class="token punctuation">(</span><span class="token number">10</span><span class="token punctuation">,</span><span class="token number">30</span><span class="token punctuation">,</span><span class="token number">50</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> (0,25,50) < (20,20,100) <span class="token punctuation">|</span> (20,20,100) < (10,30,50) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output">1 row in set (0.00 sec)</span></code></pre>
</div>
<p>
It is also possible for
<code class="literal">
MAXVALUE
</code>
to appear
for the same column in more than one
<code class="literal">
VALUES LESS
THAN
</code>
clause when using
<code class="literal">
RANGE
COLUMNS
</code>
. However, the limiting values for individual
columns in successive partition definitions should otherwise
be increasing, there should be no more than one partition
defined where
<code class="literal">
MAXVALUE
</code>
is used as the upper
limit for all column values, and this partition definition
should appear last in the list of
<code class="literal">
PARTITION ...
VALUES LESS THAN
</code>
clauses. In addition, you cannot
use
<code class="literal">
MAXVALUE
</code>
as the limiting value for the
first column in more than one partition definition.
</p>
<p>
As stated previously, it is also possible with
<code class="literal">
RANGE
COLUMNS
</code>
partitioning to use non-integer columns as
partitioning columns. (See
<a class="xref" href="partitioning-columns.html" title="26.2.3 COLUMNS Partitioning">
Section 26.2.3, “COLUMNS Partitioning”
</a>
, for a complete listing
of these.) Consider a table named
<code class="literal">
employees
</code>
(which is not partitioned), created using the following
statement:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa88747337"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> employees <span class="token punctuation">(</span>
id <span class="token datatype">INT</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span><span class="token punctuation">,</span>
fname <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">30</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
lname <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">30</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
hired <span class="token datatype">DATE</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span> <span class="token keyword">DEFAULT</span> <span class="token string">'1970-01-01'</span><span class="token punctuation">,</span>
separated <span class="token datatype">DATE</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span> <span class="token keyword">DEFAULT</span> <span class="token string">'9999-12-31'</span><span class="token punctuation">,</span>
job_code <span class="token datatype">INT</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span><span class="token punctuation">,</span>
store_id <span class="token datatype">INT</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span>
<span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Using
<code class="literal">
RANGE COLUMNS
</code>
partitioning, you can
create a version of this table that stores each row in one of
four partitions based on the employee's last name, like
this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa31239207"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> employees_by_lname <span class="token punctuation">(</span>
id <span class="token datatype">INT</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span><span class="token punctuation">,</span>
fname <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">30</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
lname <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">30</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
hired <span class="token datatype">DATE</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span> <span class="token keyword">DEFAULT</span> <span class="token string">'1970-01-01'</span><span class="token punctuation">,</span>
separated <span class="token datatype">DATE</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span> <span class="token keyword">DEFAULT</span> <span class="token string">'9999-12-31'</span><span class="token punctuation">,</span>
job_code <span class="token datatype">INT</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span><span class="token punctuation">,</span>
store_id <span class="token datatype">INT</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span>
<span class="token punctuation">)</span>
<span class="token keyword">PARTITION</span> <span class="token keyword">BY</span> <span class="token keyword">RANGE</span> <span class="token keyword">COLUMNS</span> <span class="token punctuation">(</span>lname<span class="token punctuation">)</span> <span class="token punctuation">(</span>
<span class="token keyword">PARTITION</span> p0 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token punctuation">(</span><span class="token string">'g'</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">PARTITION</span> p1 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token punctuation">(</span><span class="token string">'m'</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">PARTITION</span> p2 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token punctuation">(</span><span class="token string">'t'</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">PARTITION</span> p3 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token punctuation">(</span><span class="token keyword">MAXVALUE</span><span class="token punctuation">)</span>
<span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Alternatively, you could cause the
<code class="literal">
employees
</code>
table as created previously to be
partitioned using this scheme by executing the following
<a class="link" href="alter-table-partition-operations.html" title="15.1.9.1 ALTER TABLE Partition Operations">
<code class="literal">
ALTER
TABLE
</code>
</a>
statement:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa16080756"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">ALTER</span> <span class="token keyword">TABLE</span> employees <span class="token keyword">PARTITION</span> <span class="token keyword">BY</span> <span class="token keyword">RANGE</span> <span class="token keyword">COLUMNS</span> <span class="token punctuation">(</span>lname<span class="token punctuation">)</span> <span class="token punctuation">(</span>
<span class="token keyword">PARTITION</span> p0 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token punctuation">(</span><span class="token string">'g'</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">PARTITION</span> p1 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token punctuation">(</span><span class="token string">'m'</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">PARTITION</span> p2 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token punctuation">(</span><span class="token string">'t'</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">PARTITION</span> p3 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token punctuation">(</span><span class="token keyword">MAXVALUE</span><span class="token punctuation">)</span>
<span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
Because different character sets and collations have
different sort orders, the character sets and collations in
use may effect which partition of a table partitioned by
<code class="literal">
RANGE COLUMNS
</code>
a given row is stored in
when using string columns as partitioning columns. In
addition, changing the character set or collation for a
given database, table, or column after such a table is
created may cause changes in how rows are distributed. For
example, when using a case-sensitive collation,
<code class="literal">
'and'
</code>
sorts before
<code class="literal">
'Andersen'
</code>
, but when using a collation
that is case-insensitive, the reverse is true.
</p>
<p>
For information about how MySQL handles character sets and
collations, see
<a class="xref" href="charset.html" title="Chapter 12 Character Sets, Collations, Unicode">
Chapter 12,
<i>
Character Sets, Collations, Unicode
</i>
</a>
.
</p>
</div>
<p>
Similarly, you can cause the
<code class="literal">
employees
</code>
table to be partitioned in such a way that each row is stored
in one of several partitions based on the decade in which the
corresponding employee was hired using the
<a class="link" href="alter-table-partition-operations.html" title="15.1.9.1 ALTER TABLE Partition Operations">
<code class="literal">
ALTER
TABLE
</code>
</a>
statement shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa61166859"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">ALTER</span> <span class="token keyword">TABLE</span> employees <span class="token keyword">PARTITION</span> <span class="token keyword">BY</span> <span class="token keyword">RANGE</span> <span class="token keyword">COLUMNS</span> <span class="token punctuation">(</span>hired<span class="token punctuation">)</span> <span class="token punctuation">(</span>
<span class="token keyword">PARTITION</span> p0 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token punctuation">(</span><span class="token string">'1970-01-01'</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">PARTITION</span> p1 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token punctuation">(</span><span class="token string">'1980-01-01'</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">PARTITION</span> p2 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token punctuation">(</span><span class="token string">'1990-01-01'</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">PARTITION</span> p3 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token punctuation">(</span><span class="token string">'2000-01-01'</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">PARTITION</span> p4 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token punctuation">(</span><span class="token string">'2010-01-01'</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">PARTITION</span> p5 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token punctuation">(</span><span class="token keyword">MAXVALUE</span><span class="token punctuation">)</span>
<span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
See
<a class="xref" href="create-table.html" title="15.1.20 CREATE TABLE Statement">
Section 15.1.20, “CREATE TABLE Statement”
</a>
, for additional information
about
<code class="literal">
PARTITION BY RANGE COLUMNS
</code>
syntax.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/create-trigger.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="create-trigger">
</a>
15.1.22 CREATE TRIGGER Statement
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045183824512">
</a>
<a class="indexterm" name="idm46045183823472">
</a>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa81137571"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CREATE</span>
<span class="token punctuation">[</span><span class="token keyword">DEFINER</span> <span class="token operator">=</span> <span class="token keyword"><em class="replaceable">user</em></span><span class="token punctuation">]</span>
<span class="token keyword">TRIGGER</span> <span class="token punctuation">[</span><span class="token keyword">IF</span> <span class="token operator">NOT</span> <span class="token keyword">EXISTS</span><span class="token punctuation">]</span> <em class="replaceable">trigger_name</em>
<em class="replaceable">trigger_time</em> <em class="replaceable">trigger_event</em>
<span class="token keyword">ON</span> <em class="replaceable">tbl_name</em> <span class="token keyword">FOR</span> <span class="token keyword">EACH</span> <span class="token keyword">ROW</span>
<span class="token punctuation">[</span><em class="replaceable">trigger_order</em><span class="token punctuation">]</span>
<em class="replaceable">trigger_body</em>
<em class="replaceable">trigger_time</em>: { <span class="token keyword">BEFORE</span> <span class="token operator">|</span> <span class="token keyword">AFTER</span> }
<em class="replaceable">trigger_event</em>: { <span class="token keyword">INSERT</span> <span class="token operator">|</span> <span class="token keyword">UPDATE</span> <span class="token operator">|</span> <span class="token keyword">DELETE</span> }
<em class="replaceable">trigger_order</em>: { <span class="token keyword">FOLLOWS</span> <span class="token operator">|</span> <span class="token keyword">PRECEDES</span> } <em class="replaceable">other_trigger_name</em></code></pre>
</div>
<p>
This statement creates a new trigger. A trigger is a named
database object that is associated with a table, and that
activates when a particular event occurs for the table. The
trigger becomes associated with the table named
<em class="replaceable">
<code>
tbl_name
</code>
</em>
, which must refer to a
permanent table. You cannot associate a trigger with a
<code class="literal">
TEMPORARY
</code>
table or a view.
</p>
<p>
Trigger names exist in the schema namespace, meaning that all
triggers must have unique names within a schema. Triggers in
different schemas can have the same name.
</p>
<p>
<code class="literal">
IF NOT EXISTS
</code>
prevents an error from occurring
if a trigger having the same name, on the same table, exists in
the same schema.
</p>
<p>
This section describes
<a class="link" href="create-trigger.html" title="15.1.22 CREATE TRIGGER Statement">
<code class="literal">
CREATE
TRIGGER
</code>
</a>
syntax. For additional discussion, see
<a class="xref" href="trigger-syntax.html" title="27.3.1 Trigger Syntax and Examples">
Section 27.3.1, “Trigger Syntax and Examples”
</a>
.
</p>
<p>
<a class="link" href="create-trigger.html" title="15.1.22 CREATE TRIGGER Statement">
<code class="literal">
CREATE TRIGGER
</code>
</a>
requires the
<a class="link" href="privileges-provided.html#priv_trigger">
<code class="literal">
TRIGGER
</code>
</a>
privilege for the table
associated with the trigger. If the
<code class="literal">
DEFINER
</code>
clause is present, the privileges required depend on the
<em class="replaceable">
<code>
user
</code>
</em>
value, as discussed in
<a class="xref" href="stored-objects-security.html" title="27.6 Stored Object Access Control">
Section 27.6, “Stored Object Access Control”
</a>
. If binary logging is
enabled,
<a class="link" href="create-trigger.html" title="15.1.22 CREATE TRIGGER Statement">
<code class="literal">
CREATE TRIGGER
</code>
</a>
might
require the
<a class="link" href="privileges-provided.html#priv_super">
<code class="literal">
SUPER
</code>
</a>
privilege, as
discussed in
<a class="xref" href="stored-programs-logging.html" title="27.7 Stored Program Binary Logging">
Section 27.7, “Stored Program Binary Logging”
</a>
.
</p>
<p>
The
<code class="literal">
DEFINER
</code>
clause determines the security
context to be used when checking access privileges at trigger
activation time, as described later in this section.
</p>
<p>
<em class="replaceable">
<code>
trigger_time
</code>
</em>
is the trigger action
time. It can be
<code class="literal">
BEFORE
</code>
or
<code class="literal">
AFTER
</code>
to indicate that the trigger activates
before or after each row to be modified.
</p>
<p>
Basic column value checks occur prior to trigger activation, so
you cannot use
<code class="literal">
BEFORE
</code>
triggers to convert
values inappropriate for the column type to valid values.
</p>
<p>
<em class="replaceable">
<code>
trigger_event
</code>
</em>
indicates the kind of
operation that activates the trigger. These
<em class="replaceable">
<code>
trigger_event
</code>
</em>
values are permitted:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="link" href="insert.html" title="15.2.7 INSERT Statement">
<code class="literal">
INSERT
</code>
</a>
: The trigger activates
whenever a new row is inserted into the table (for example,
through
<a class="link" href="insert.html" title="15.2.7 INSERT Statement">
<code class="literal">
INSERT
</code>
</a>
,
<a class="link" href="load-data.html" title="15.2.9 LOAD DATA Statement">
<code class="literal">
LOAD DATA
</code>
</a>
, and
<a class="link" href="replace.html" title="15.2.12 REPLACE Statement">
<code class="literal">
REPLACE
</code>
</a>
statements).
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="update.html" title="15.2.17 UPDATE Statement">
<code class="literal">
UPDATE
</code>
</a>
: The trigger activates
whenever a row is modified (for example, through
<a class="link" href="update.html" title="15.2.17 UPDATE Statement">
<code class="literal">
UPDATE
</code>
</a>
statements).
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="delete.html" title="15.2.2 DELETE Statement">
<code class="literal">
DELETE
</code>
</a>
: The trigger activates
whenever a row is deleted from the table (for example, through
<a class="link" href="delete.html" title="15.2.2 DELETE Statement">
<code class="literal">
DELETE
</code>
</a>
and
<a class="link" href="replace.html" title="15.2.12 REPLACE Statement">
<code class="literal">
REPLACE
</code>
</a>
statements).
<a class="link" href="drop-table.html" title="15.1.32 DROP TABLE Statement">
<code class="literal">
DROP TABLE
</code>
</a>
and
<a class="link" href="truncate-table.html" title="15.1.37 TRUNCATE TABLE Statement">
<code class="literal">
TRUNCATE TABLE
</code>
</a>
statements on
the table do
<span class="emphasis">
<em>
not
</em>
</span>
activate this trigger,
because they do not use
<a class="link" href="delete.html" title="15.2.2 DELETE Statement">
<code class="literal">
DELETE
</code>
</a>
.
Dropping a partition does not activate
<a class="link" href="delete.html" title="15.2.2 DELETE Statement">
<code class="literal">
DELETE
</code>
</a>
triggers, either.
</p>
</li>
</ul>
</div>
<p>
The
<em class="replaceable">
<code>
trigger_event
</code>
</em>
does not represent a
literal type of SQL statement that activates the trigger so much
as it represents a type of table operation. For example, an
<a class="link" href="insert.html" title="15.2.7 INSERT Statement">
<code class="literal">
INSERT
</code>
</a>
trigger activates not only
for
<a class="link" href="insert.html" title="15.2.7 INSERT Statement">
<code class="literal">
INSERT
</code>
</a>
statements but also
<a class="link" href="load-data.html" title="15.2.9 LOAD DATA Statement">
<code class="literal">
LOAD DATA
</code>
</a>
statements because both
statements insert rows into a table.
</p>
<p>
A potentially confusing example of this is the
<code class="literal">
INSERT
INTO ... ON DUPLICATE KEY UPDATE ...
</code>
syntax: a
<code class="literal">
BEFORE INSERT
</code>
trigger activates for every row,
followed by either an
<code class="literal">
AFTER INSERT
</code>
trigger or
both the
<code class="literal">
BEFORE UPDATE
</code>
and
<code class="literal">
AFTER
UPDATE
</code>
triggers, depending on whether there was a
duplicate key for the row.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
Cascaded foreign key actions do not activate triggers.
</p>
</div>
<p>
It is possible to define multiple triggers for a given table that
have the same trigger event and action time. For example, you can
have two
<code class="literal">
BEFORE UPDATE
</code>
triggers for a table. By
default, triggers that have the same trigger event and action time
activate in the order they were created. To affect trigger order,
specify a
<em class="replaceable">
<code>
trigger_order
</code>
</em>
clause that
indicates
<code class="literal">
FOLLOWS
</code>
or
<code class="literal">
PRECEDES
</code>
and the name of an existing trigger
that also has the same trigger event and action time. With
<code class="literal">
FOLLOWS
</code>
, the new trigger activates after the
existing trigger. With
<code class="literal">
PRECEDES
</code>
, the new
trigger activates before the existing trigger.
</p>
<p>
<em class="replaceable">
<code>
trigger_body
</code>
</em>
is the statement to
execute when the trigger activates. To execute multiple
statements, use the
<a class="link" href="begin-end.html" title="15.6.1 BEGIN ... END Compound Statement">
<code class="literal">
BEGIN ... END
</code>
</a>
compound statement construct. This also enables you to use the
same statements that are permitted within stored routines. See
<a class="xref" href="begin-end.html" title="15.6.1 BEGIN ... END Compound Statement">
Section 15.6.1, “BEGIN ... END Compound Statement”
</a>
. Some statements are not permitted in
triggers; see
<a class="xref" href="stored-program-restrictions.html" title="27.8 Restrictions on Stored Programs">
Section 27.8, “Restrictions on Stored Programs”
</a>
.
</p>
<p>
Within the trigger body, you can refer to columns in the subject
table (the table associated with the trigger) by using the aliases
<code class="literal">
OLD
</code>
and
<code class="literal">
NEW
</code>
.
<code class="literal">
OLD.
<em class="replaceable">
<code>
col_name
</code>
</em>
</code>
refers
to a column of an existing row before it is updated or deleted.
<code class="literal">
NEW.
<em class="replaceable">
<code>
col_name
</code>
</em>
</code>
refers
to the column of a new row to be inserted or an existing row after
it is updated.
</p>
<a class="indexterm" name="idm46045183749744">
</a>
<p>
Triggers cannot use
<code class="literal">
NEW.
<em class="replaceable">
<code>
col_name
</code>
</em>
</code>
or use
<code class="literal">
OLD.
<em class="replaceable">
<code>
col_name
</code>
</em>
</code>
to
refer to generated columns. For information about generated
columns, see
<a class="xref" href="create-table-generated-columns.html" title="15.1.20.8 CREATE TABLE and Generated Columns">
Section 15.1.20.8, “CREATE TABLE and Generated Columns”
</a>
.
</p>
<p>
MySQL stores the
<a class="link" href="server-system-variables.html#sysvar_sql_mode">
<code class="literal">
sql_mode
</code>
</a>
system
variable setting in effect when a trigger is created, and always
executes the trigger body with this setting in force,
<span class="emphasis">
<em>
regardless of the current server SQL mode when the
trigger begins executing
</em>
</span>
.
</p>
<p>
The
<code class="literal">
DEFINER
</code>
clause specifies the MySQL account
to be used when checking access privileges at trigger activation
time. If the
<code class="literal">
DEFINER
</code>
clause is present, the
<em class="replaceable">
<code>
user
</code>
</em>
value should be a MySQL account
specified as
<code class="literal">
'
<em class="replaceable">
<code>
user_name
</code>
</em>
'@'
<em class="replaceable">
<code>
host_name
</code>
</em>
'
</code>
,
<a class="link" href="information-functions.html#function_current-user">
<code class="literal">
CURRENT_USER
</code>
</a>
, or
<a class="link" href="information-functions.html#function_current-user">
<code class="literal">
CURRENT_USER()
</code>
</a>
. The permitted
<em class="replaceable">
<code>
user
</code>
</em>
values depend on the privileges
you hold, as discussed in
<a class="xref" href="stored-objects-security.html" title="27.6 Stored Object Access Control">
Section 27.6, “Stored Object Access Control”
</a>
. Also see that section
for additional information about trigger security.
</p>
<p>
If the
<code class="literal">
DEFINER
</code>
clause is omitted, the default
definer is the user who executes the
<a class="link" href="create-trigger.html" title="15.1.22 CREATE TRIGGER Statement">
<code class="literal">
CREATE
TRIGGER
</code>
</a>
statement. This is the same as specifying
<code class="literal">
DEFINER = CURRENT_USER
</code>
explicitly.
</p>
<p>
MySQL takes the
<code class="literal">
DEFINER
</code>
user into account when
checking trigger privileges as follows:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
At
<a class="link" href="create-trigger.html" title="15.1.22 CREATE TRIGGER Statement">
<code class="literal">
CREATE TRIGGER
</code>
</a>
time, the
user who issues the statement must have the
<a class="link" href="privileges-provided.html#priv_trigger">
<code class="literal">
TRIGGER
</code>
</a>
privilege.
</p>
</li>
<li class="listitem">
<p>
At trigger activation time, privileges are checked against the
<code class="literal">
DEFINER
</code>
user. This user must have these
privileges:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
The
<a class="link" href="privileges-provided.html#priv_trigger">
<code class="literal">
TRIGGER
</code>
</a>
privilege for
the subject table.
</p>
</li>
<li class="listitem">
<p>
The
<a class="link" href="privileges-provided.html#priv_select">
<code class="literal">
SELECT
</code>
</a>
privilege for
the subject table if references to table columns occur
using
<code class="literal">
OLD.
<em class="replaceable">
<code>
col_name
</code>
</em>
</code>
or
<code class="literal">
NEW.
<em class="replaceable">
<code>
col_name
</code>
</em>
</code>
in the trigger body.
</p>
</li>
<li class="listitem">
<p>
The
<a class="link" href="privileges-provided.html#priv_update">
<code class="literal">
UPDATE
</code>
</a>
privilege for
the subject table if table columns are targets of
<code class="literal">
SET NEW.
<em class="replaceable">
<code>
col_name
</code>
</em>
=
<em class="replaceable">
<code>
value
</code>
</em>
</code>
assignments in
the trigger body.
</p>
</li>
<li class="listitem">
<p>
Whatever other privileges normally are required for the
statements executed by the trigger.
</p>
</li>
</ul>
</div>
</li>
</ul>
</div>
<p>
Within a trigger body, the
<a class="link" href="information-functions.html#function_current-user">
<code class="literal">
CURRENT_USER
</code>
</a>
function returns the
account used to check privileges at trigger activation time. This
is the
<code class="literal">
DEFINER
</code>
user, not the user whose actions
caused the trigger to be activated. For information about user
auditing within triggers, see
<a class="xref" href="account-activity-auditing.html" title="8.2.23 SQL-Based Account Activity Auditing">
Section 8.2.23, “SQL-Based Account Activity Auditing”
</a>
.
</p>
<p>
If you use
<a class="link" href="lock-tables.html" title="15.3.6 LOCK TABLES and UNLOCK TABLES Statements">
<code class="literal">
LOCK TABLES
</code>
</a>
to lock a
table that has triggers, the tables used within the trigger are
also locked, as described in
<a class="xref" href="lock-tables.html#lock-tables-and-triggers" title="LOCK TABLES and Triggers">
LOCK TABLES and Triggers
</a>
.
</p>
<p>
For additional discussion of trigger use, see
<a class="xref" href="trigger-syntax.html" title="27.3.1 Trigger Syntax and Examples">
Section 27.3.1, “Trigger Syntax and Examples”
</a>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/view-check-option.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="view-check-option">
</a>
27.5.4 The View WITH CHECK OPTION Clause
</h3>
</div>
</div>
</div>
<p>
The
<code class="literal">
WITH CHECK OPTION
</code>
clause can be given for
an updatable view to prevent inserts to rows for which the
<code class="literal">
WHERE
</code>
clause in the
<em class="replaceable">
<code>
select_statement
</code>
</em>
is not true. It also
prevents updates to rows for which the
<code class="literal">
WHERE
</code>
clause is true but the update would cause it to be not true (in
other words, it prevents visible rows from being updated to
nonvisible rows).
</p>
<p>
In a
<code class="literal">
WITH CHECK OPTION
</code>
clause for an updatable
view, the
<code class="literal">
LOCAL
</code>
and
<code class="literal">
CASCADED
</code>
keywords determine the scope of check testing when the view is
defined in terms of another view. When neither keyword is given,
the default is
<code class="literal">
CASCADED
</code>
.
</p>
<p>
<code class="literal">
WITH CHECK OPTION
</code>
testing is
standard-compliant:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
With
<code class="literal">
LOCAL
</code>
, the view
<code class="literal">
WHERE
</code>
clause is checked, then checking
recurses to underlying views and applies the same rules.
</p>
</li>
<li class="listitem">
<p>
With
<code class="literal">
CASCADED
</code>
, the view
<code class="literal">
WHERE
</code>
clause is checked, then checking
recurses to underlying views, adds
<code class="literal">
WITH CASCADED
CHECK OPTION
</code>
to them (for purposes of the check;
their definitions remain unchanged), and applies the same
rules.
</p>
</li>
<li class="listitem">
<p>
With no check option, the view
<code class="literal">
WHERE
</code>
clause
is not checked, then checking recurses to underlying views,
and applies the same rules.
</p>
</li>
</ul>
</div>
<p>
Consider the definitions for the following table and set of views:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa47926482"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> t1 <span class="token punctuation">(</span>a <span class="token datatype">INT</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">CREATE</span> <span class="token keyword">VIEW</span> v1 <span class="token keyword">AS</span> <span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> t1 <span class="token keyword">WHERE</span> a <span class="token operator"><</span> <span class="token number">2</span>
<span class="token keyword">WITH</span> <span class="token keyword">CHECK</span> <span class="token keyword">OPTION</span><span class="token punctuation">;</span>
<span class="token keyword">CREATE</span> <span class="token keyword">VIEW</span> v2 <span class="token keyword">AS</span> <span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> v1 <span class="token keyword">WHERE</span> a <span class="token operator">></span> <span class="token number">0</span>
<span class="token keyword">WITH</span> <span class="token keyword">LOCAL</span> <span class="token keyword">CHECK</span> <span class="token keyword">OPTION</span><span class="token punctuation">;</span>
<span class="token keyword">CREATE</span> <span class="token keyword">VIEW</span> v3 <span class="token keyword">AS</span> <span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> v1 <span class="token keyword">WHERE</span> a <span class="token operator">></span> <span class="token number">0</span>
<span class="token keyword">WITH</span> <span class="token keyword">CASCADED</span> <span class="token keyword">CHECK</span> <span class="token keyword">OPTION</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Here the
<code class="literal">
v2
</code>
and
<code class="literal">
v3
</code>
views are
defined in terms of another view,
<code class="literal">
v1
</code>
.
</p>
<p>
Inserts for
<code class="literal">
v2
</code>
are checked against its
<code class="literal">
LOCAL
</code>
check option, then the check recurses to
<code class="literal">
v1
</code>
and the rules are applied again. The rules
for
<code class="literal">
v1
</code>
cause a check failure. The check for
<code class="literal">
v3
</code>
also fails:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa22632290"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">INSERT</span> <span class="token keyword">INTO</span> v2 <span class="token keyword">VALUES</span> <span class="token punctuation">(</span><span class="token number">2</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output">ERROR 1369 (HY000)<span class="token punctuation">:</span> CHECK OPTION failed 'test.v2'</span>
<span class="token prompt">mysql></span> <span class="token keyword">INSERT</span> <span class="token keyword">INTO</span> v3 <span class="token keyword">VALUES</span> <span class="token punctuation">(</span><span class="token number">2</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output">ERROR 1369 (HY000)<span class="token punctuation">:</span> CHECK OPTION failed 'test.v3'</span></code></pre>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/show-engines.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="show-engines">
</a>
15.7.7.17 SHOW ENGINES Statement
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045170530448">
</a>
<a class="indexterm" name="idm46045170529376">
</a>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa39456045"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SHOW</span> <span class="token punctuation">[</span><span class="token keyword">STORAGE</span><span class="token punctuation">]</span> <span class="token keyword">ENGINES</span></code></pre>
</div>
<p>
<a class="link" href="show-engines.html" title="15.7.7.17 SHOW ENGINES Statement">
<code class="literal">
SHOW ENGINES
</code>
</a>
displays status
information about the server's storage engines. This is
particularly useful for checking whether a storage engine is
supported, or to see what the default engine is.
</p>
<p>
For information about MySQL storage engines, see
<a class="xref" href="innodb-storage-engine.html" title="Chapter 17 The InnoDB Storage Engine">
Chapter 17,
<i>
The InnoDB Storage Engine
</i>
</a>
, and
<a class="xref" href="storage-engines.html" title="Chapter 18 Alternative Storage Engines">
Chapter 18,
<i>
Alternative Storage Engines
</i>
</a>
.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa25571904"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SHOW</span> <span class="token keyword">ENGINES</span>\G
<span class="token output"><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span> 1. row <span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span>
Engine<span class="token punctuation">:</span> MEMORY
Support<span class="token punctuation">:</span> YES
Comment<span class="token punctuation">:</span> Hash based, stored in memory, useful for temporary tables
Transactions<span class="token punctuation">:</span> NO
XA<span class="token punctuation">:</span> NO
Savepoints<span class="token punctuation">:</span> NO
<span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span> 2. row <span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span>
Engine<span class="token punctuation">:</span> InnoDB
Support<span class="token punctuation">:</span> DEFAULT
Comment<span class="token punctuation">:</span> Supports transactions, row-level locking, and foreign keys
Transactions<span class="token punctuation">:</span> YES
XA<span class="token punctuation">:</span> YES
Savepoints<span class="token punctuation">:</span> YES
<span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span> 3. row <span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span>
Engine<span class="token punctuation">:</span> PERFORMANCE_SCHEMA
Support<span class="token punctuation">:</span> YES
Comment<span class="token punctuation">:</span> Performance Schema
Transactions<span class="token punctuation">:</span> NO
XA<span class="token punctuation">:</span> NO
Savepoints<span class="token punctuation">:</span> NO
<span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span> 4. row <span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span>
Engine<span class="token punctuation">:</span> MyISAM
Support<span class="token punctuation">:</span> YES
Comment<span class="token punctuation">:</span> MyISAM storage engine
Transactions<span class="token punctuation">:</span> NO
XA<span class="token punctuation">:</span> NO
Savepoints<span class="token punctuation">:</span> NO
<span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span> 5. row <span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span>
Engine<span class="token punctuation">:</span> MRG_MYISAM
Support<span class="token punctuation">:</span> YES
Comment<span class="token punctuation">:</span> Collection of identical MyISAM tables
Transactions<span class="token punctuation">:</span> NO
XA<span class="token punctuation">:</span> NO
Savepoints<span class="token punctuation">:</span> NO
<span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span> 6. row <span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span>
Engine<span class="token punctuation">:</span> BLACKHOLE
Support<span class="token punctuation">:</span> YES
Comment<span class="token punctuation">:</span> /dev/null storage engine (anything you write to it disappears)
Transactions<span class="token punctuation">:</span> NO
XA<span class="token punctuation">:</span> NO
Savepoints<span class="token punctuation">:</span> NO
<span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span> 7. row <span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span>
Engine<span class="token punctuation">:</span> CSV
Support<span class="token punctuation">:</span> YES
Comment<span class="token punctuation">:</span> CSV storage engine
Transactions<span class="token punctuation">:</span> NO
XA<span class="token punctuation">:</span> NO
Savepoints<span class="token punctuation">:</span> NO
<span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span> 8. row <span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span>
Engine<span class="token punctuation">:</span> ARCHIVE
Support<span class="token punctuation">:</span> YES
Comment<span class="token punctuation">:</span> Archive storage engine
Transactions<span class="token punctuation">:</span> NO
XA<span class="token punctuation">:</span> NO
Savepoints<span class="token punctuation">:</span> NO</span></code></pre>
</div>
<p>
The output from
<code class="literal">
SHOW ENGINES
</code>
may vary
according to the MySQL version used and other factors.
</p>
<p>
<code class="literal">
SHOW ENGINES
</code>
output has these columns:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
Engine
</code>
</p>
<p>
The name of the storage engine.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
Support
</code>
</p>
<p>
The server's level of support for the storage engine,
as shown in the following table.
</p>
<div class="informaltable">
<table summary="Values for the Support column in the output of the SHOW ENGINES statement.">
<colgroup>
<col style="width: 15%"/>
<col style="width: 85%"/>
</colgroup>
<thead>
<tr>
<th>
Value
</th>
<th>
Meaning
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<code class="literal">
YES
</code>
</td>
<td>
The engine is supported and is active
</td>
</tr>
<tr>
<td>
<code class="literal">
DEFAULT
</code>
</td>
<td>
Like
<code class="literal">
YES
</code>
, plus this is the default engine
</td>
</tr>
<tr>
<td>
<code class="literal">
NO
</code>
</td>
<td>
The engine is not supported
</td>
</tr>
<tr>
<td>
<code class="literal">
DISABLED
</code>
</td>
<td>
The engine is supported but has been disabled
</td>
</tr>
</tbody>
</table>
</div>
<p>
A value of
<code class="literal">
NO
</code>
means that the server was
compiled without support for the engine, so it cannot be
enabled at runtime.
</p>
<p>
A value of
<code class="literal">
DISABLED
</code>
occurs either because
the server was started with an option that disables the
engine, or because not all options required to enable it
were given. In the latter case, the error log should contain
a reason indicating why the option is disabled. See
<a class="xref" href="error-log.html" title="7.4.2 The Error Log">
Section 7.4.2, “The Error Log”
</a>
.
</p>
<p>
You might also see
<code class="literal">
DISABLED
</code>
for a storage
engine if the server was compiled to support it, but was
started with a
<code class="option">
--skip-
<em class="replaceable">
<code>
engine_name
</code>
</em>
</code>
option. For the
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
storage
engine,
<code class="literal">
DISABLED
</code>
means the server was
compiled with support for NDB Cluster, but was not started
with the
<a class="link" href="mysql-cluster-options-variables.html#option_mysqld_ndbcluster">
<code class="option">
--ndbcluster
</code>
</a>
option.
</p>
<p>
All MySQL servers support
<code class="literal">
MyISAM
</code>
tables.
It is not possible to disable
<code class="literal">
MyISAM
</code>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
Comment
</code>
</p>
<p>
A brief description of the storage engine.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
Transactions
</code>
</p>
<p>
Whether the storage engine supports transactions.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
XA
</code>
</p>
<p>
Whether the storage engine supports XA transactions.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
Savepoints
</code>
</p>
<p>
Whether the storage engine supports savepoints.
</p>
</li>
</ul>
</div>
<p>
Storage engine information is also available from the
<code class="literal">
INFORMATION_SCHEMA
</code>
<a class="link" href="information-schema-engines-table.html" title="28.3.13 The INFORMATION_SCHEMA ENGINES Table">
<code class="literal">
ENGINES
</code>
</a>
table. See
<a class="xref" href="information-schema-engines-table.html" title="28.3.13 The INFORMATION_SCHEMA ENGINES Table">
Section 28.3.13, “The INFORMATION_SCHEMA ENGINES Table”
</a>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/partitioning-range.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="partitioning-range">
</a>
26.2.1 RANGE Partitioning
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045084782144">
</a>
<a class="indexterm" name="idm46045084780656">
</a>
<p>
A table that is partitioned by range is partitioned in such a
way that each partition contains rows for which the partitioning
expression value lies within a given range. Ranges should be
contiguous but not overlapping, and are defined using the
<code class="literal">
VALUES LESS THAN
</code>
operator. For the next few
examples, suppose that you are creating a table such as the
following to hold personnel records for a chain of 20 video
stores, numbered 1 through 20:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa7729602"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> employees <span class="token punctuation">(</span>
id <span class="token datatype">INT</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span><span class="token punctuation">,</span>
fname <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">30</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
lname <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">30</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
hired <span class="token datatype">DATE</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span> <span class="token keyword">DEFAULT</span> <span class="token string">'1970-01-01'</span><span class="token punctuation">,</span>
separated <span class="token datatype">DATE</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span> <span class="token keyword">DEFAULT</span> <span class="token string">'9999-12-31'</span><span class="token punctuation">,</span>
job_code <span class="token datatype">INT</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span><span class="token punctuation">,</span>
store_id <span class="token datatype">INT</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span>
<span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
The
<code class="literal">
employees
</code>
table used here has no
primary or unique keys. While the examples work as shown for
purposes of the present discussion, you should keep in mind
that tables are extremely likely in practice to have primary
keys, unique keys, or both, and that allowable choices for
partitioning columns depend on the columns used for these
keys, if any are present. For a discussion of these issues,
see
<a class="xref" href="partitioning-limitations-partitioning-keys-unique-keys.html" title="26.6.1 Partitioning Keys, Primary Keys, and Unique Keys">
Section 26.6.1, “Partitioning Keys, Primary Keys, and Unique Keys”
</a>
.
</p>
</div>
<p>
This table can be partitioned by range in a number of ways,
depending on your needs. One way would be to use the
<code class="literal">
store_id
</code>
column. For instance, you might
decide to partition the table 4 ways by adding a
<code class="literal">
PARTITION BY RANGE
</code>
clause as shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa80183598"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> employees <span class="token punctuation">(</span>
id <span class="token datatype">INT</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span><span class="token punctuation">,</span>
fname <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">30</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
lname <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">30</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
hired <span class="token datatype">DATE</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span> <span class="token keyword">DEFAULT</span> <span class="token string">'1970-01-01'</span><span class="token punctuation">,</span>
separated <span class="token datatype">DATE</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span> <span class="token keyword">DEFAULT</span> <span class="token string">'9999-12-31'</span><span class="token punctuation">,</span>
job_code <span class="token datatype">INT</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span><span class="token punctuation">,</span>
store_id <span class="token datatype">INT</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span>
<span class="token punctuation">)</span>
<span class="token keyword">PARTITION</span> <span class="token keyword">BY</span> <span class="token keyword">RANGE</span> <span class="token punctuation">(</span>store_id<span class="token punctuation">)</span> <span class="token punctuation">(</span>
<span class="token keyword">PARTITION</span> p0 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token punctuation">(</span><span class="token number">6</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">PARTITION</span> p1 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token punctuation">(</span><span class="token number">11</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">PARTITION</span> p2 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token punctuation">(</span><span class="token number">16</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">PARTITION</span> p3 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token punctuation">(</span><span class="token number">21</span><span class="token punctuation">)</span>
<span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
In this partitioning scheme, all rows corresponding to employees
working at stores 1 through 5 are stored in partition
<code class="literal">
p0
</code>
, to those employed at stores 6 through 10
are stored in partition
<code class="literal">
p1
</code>
, and so on. Each
partition is defined in order, from lowest to highest. This is a
requirement of the
<code class="literal">
PARTITION BY RANGE
</code>
syntax;
you can think of it as being analogous to a series of
<code class="literal">
if ... elseif ...
</code>
statements in C or Java in
this regard.
</p>
<p>
It is easy to determine that a new row containing the data
<code class="literal">
(72, 'Mitchell', 'Wilson', '1998-06-25', DEFAULT, 7,
13)
</code>
is inserted into partition
<code class="literal">
p2
</code>
,
but what happens when your chain adds a
21
<sup>
st
</sup>
store? Under this scheme, there
is no rule that covers a row whose
<code class="literal">
store_id
</code>
is greater than 20, so an error results because the server does
not know where to place it. You can keep this from occurring by
using a
<span class="quote">
“
<span class="quote">
catchall
</span>
”
</span>
<code class="literal">
VALUES LESS
THAN
</code>
clause in the
<a class="link" href="create-table.html" title="15.1.20 CREATE TABLE Statement">
<code class="literal">
CREATE
TABLE
</code>
</a>
statement that provides for all values greater
than the highest value explicitly named:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa30795140"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> employees <span class="token punctuation">(</span>
id <span class="token datatype">INT</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span><span class="token punctuation">,</span>
fname <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">30</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
lname <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">30</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
hired <span class="token datatype">DATE</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span> <span class="token keyword">DEFAULT</span> <span class="token string">'1970-01-01'</span><span class="token punctuation">,</span>
separated <span class="token datatype">DATE</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span> <span class="token keyword">DEFAULT</span> <span class="token string">'9999-12-31'</span><span class="token punctuation">,</span>
job_code <span class="token datatype">INT</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span><span class="token punctuation">,</span>
store_id <span class="token datatype">INT</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span>
<span class="token punctuation">)</span>
<span class="token keyword">PARTITION</span> <span class="token keyword">BY</span> <span class="token keyword">RANGE</span> <span class="token punctuation">(</span>store_id<span class="token punctuation">)</span> <span class="token punctuation">(</span>
<span class="token keyword">PARTITION</span> p0 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token punctuation">(</span><span class="token number">6</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">PARTITION</span> p1 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token punctuation">(</span><span class="token number">11</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">PARTITION</span> p2 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token punctuation">(</span><span class="token number">16</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword"></span><em><span class="token keyword">PARTITION</span> p3 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token keyword">MAXVALUE</span></em><span class="token keyword"></span>
<span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
(As with the other examples in this chapter, we assume that the
default storage engine is
<code class="literal">
InnoDB
</code>
.)
</p>
<p>
Another way to avoid an error when no matching value is found is
to use the
<code class="literal">
IGNORE
</code>
keyword as part of the
<a class="link" href="insert.html" title="15.2.7 INSERT Statement">
<code class="literal">
INSERT
</code>
</a>
statement. For an example,
see
<a class="xref" href="partitioning-list.html" title="26.2.2 LIST Partitioning">
Section 26.2.2, “LIST Partitioning”
</a>
.
</p>
<p>
<code class="literal">
MAXVALUE
</code>
represents an integer value that is
always greater than the largest possible integer value (in
mathematical language, it serves as a
<span class="firstterm">
least upper bound
</span>
). Now,
any rows whose
<code class="literal">
store_id
</code>
column value is
greater than or equal to 16 (the highest value defined) are
stored in partition
<code class="literal">
p3
</code>
. At some point in the
future—when the number of stores has increased to 25, 30,
or more—you can use an
<a class="link" href="alter-table-partition-operations.html" title="15.1.9.1 ALTER TABLE Partition Operations">
<code class="literal">
ALTER
TABLE
</code>
</a>
statement to add new partitions for stores
21-25, 26-30, and so on (see
<a class="xref" href="partitioning-management.html" title="26.3 Partition Management">
Section 26.3, “Partition Management”
</a>
, for details of how to
do this).
</p>
<p>
In much the same fashion, you could partition the table based on
employee job codes—that is, based on ranges of
<code class="literal">
job_code
</code>
column values. For
example—assuming that two-digit job codes are used for
regular (in-store) workers, three-digit codes are used for
office and support personnel, and four-digit codes are used for
management positions—you could create the partitioned
table using the following statement:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa4771991"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> employees <span class="token punctuation">(</span>
id <span class="token datatype">INT</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span><span class="token punctuation">,</span>
fname <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">30</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
lname <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">30</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
hired <span class="token datatype">DATE</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span> <span class="token keyword">DEFAULT</span> <span class="token string">'1970-01-01'</span><span class="token punctuation">,</span>
separated <span class="token datatype">DATE</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span> <span class="token keyword">DEFAULT</span> <span class="token string">'9999-12-31'</span><span class="token punctuation">,</span>
job_code <span class="token datatype">INT</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span><span class="token punctuation">,</span>
store_id <span class="token datatype">INT</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span>
<span class="token punctuation">)</span>
<span class="token keyword">PARTITION</span> <span class="token keyword">BY</span> <span class="token keyword">RANGE</span> <span class="token punctuation">(</span>job_code<span class="token punctuation">)</span> <span class="token punctuation">(</span>
<span class="token keyword">PARTITION</span> p0 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token punctuation">(</span><span class="token number">100</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">PARTITION</span> p1 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token punctuation">(</span><span class="token number">1000</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">PARTITION</span> p2 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token punctuation">(</span><span class="token number">10000</span><span class="token punctuation">)</span>
<span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
In this instance, all rows relating to in-store workers would be
stored in partition
<code class="literal">
p0
</code>
, those relating to
office and support staff in
<code class="literal">
p1
</code>
, and those
relating to managers in partition
<code class="literal">
p2
</code>
.
</p>
<p>
It is also possible to use an expression in
<code class="literal">
VALUES LESS
THAN
</code>
clauses. However, MySQL must be able to evaluate
the expression's return value as part of a
<code class="literal">
LESS
THAN
</code>
(
<code class="literal">
<
</code>
) comparison.
</p>
<a class="indexterm" name="idm46045084740592">
</a>
<p>
Rather than splitting up the table data according to store
number, you can use an expression based on one of the two
<a class="link" href="datetime.html" title="13.2.2 The DATE, DATETIME, and TIMESTAMP Types">
<code class="literal">
DATE
</code>
</a>
columns instead. For
example, let us suppose that you wish to partition based on the
year that each employee left the company; that is, the value of
<a class="link" href="date-and-time-functions.html#function_year">
<code class="literal">
YEAR(separated)
</code>
</a>
. An example of a
<a class="link" href="create-table.html" title="15.1.20 CREATE TABLE Statement">
<code class="literal">
CREATE TABLE
</code>
</a>
statement that
implements such a partitioning scheme is shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa58045171"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> employees <span class="token punctuation">(</span>
id <span class="token datatype">INT</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span><span class="token punctuation">,</span>
fname <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">30</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
lname <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">30</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
hired <span class="token datatype">DATE</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span> <span class="token keyword">DEFAULT</span> <span class="token string">'1970-01-01'</span><span class="token punctuation">,</span>
separated <span class="token datatype">DATE</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span> <span class="token keyword">DEFAULT</span> <span class="token string">'9999-12-31'</span><span class="token punctuation">,</span>
job_code <span class="token datatype">INT</span><span class="token punctuation">,</span>
store_id <span class="token datatype">INT</span>
<span class="token punctuation">)</span>
<span class="token keyword">PARTITION</span> <span class="token keyword">BY</span> <span class="token keyword">RANGE</span> <span class="token punctuation">(</span> <span class="token function">YEAR</span><span class="token punctuation">(</span>separated<span class="token punctuation">)</span> <span class="token punctuation">)</span> <span class="token punctuation">(</span>
<span class="token keyword">PARTITION</span> p0 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token punctuation">(</span><span class="token number">1991</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">PARTITION</span> p1 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token punctuation">(</span><span class="token number">1996</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">PARTITION</span> p2 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token punctuation">(</span><span class="token number">2001</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">PARTITION</span> p3 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token keyword">MAXVALUE</span>
<span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
In this scheme, for all employees who left before 1991, the rows
are stored in partition
<code class="literal">
p0
</code>
; for those who
left in the years 1991 through 1995, in
<code class="literal">
p1
</code>
;
for those who left in the years 1996 through 2000, in
<code class="literal">
p2
</code>
; and for any workers who left after the
year 2000, in
<code class="literal">
p3
</code>
.
</p>
<p>
It is also possible to partition a table by
<code class="literal">
RANGE
</code>
, based on the value of a
<a class="link" href="datetime.html" title="13.2.2 The DATE, DATETIME, and TIMESTAMP Types">
<code class="literal">
TIMESTAMP
</code>
</a>
column, using the
<a class="link" href="date-and-time-functions.html#function_unix-timestamp">
<code class="literal">
UNIX_TIMESTAMP()
</code>
</a>
function, as
shown in this example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa33777354"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> quarterly_report_status <span class="token punctuation">(</span>
report_id <span class="token datatype">INT</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span><span class="token punctuation">,</span>
report_status <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">20</span><span class="token punctuation">)</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span><span class="token punctuation">,</span>
report_updated <span class="token datatype">TIMESTAMP</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span> <span class="token keyword">DEFAULT</span> <span class="token keyword">CURRENT_TIMESTAMP</span> <span class="token keyword">ON</span> <span class="token keyword">UPDATE</span> <span class="token keyword">CURRENT_TIMESTAMP</span>
<span class="token punctuation">)</span>
<span class="token keyword">PARTITION</span> <span class="token keyword">BY</span> <span class="token keyword">RANGE</span> <span class="token punctuation">(</span> <span class="token function">UNIX_TIMESTAMP</span><span class="token punctuation">(</span>report_updated<span class="token punctuation">)</span> <span class="token punctuation">)</span> <span class="token punctuation">(</span>
<span class="token keyword">PARTITION</span> p0 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token punctuation">(</span> <span class="token function">UNIX_TIMESTAMP</span><span class="token punctuation">(</span><span class="token string">'2008-01-01 00:00:00'</span><span class="token punctuation">)</span> <span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">PARTITION</span> p1 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token punctuation">(</span> <span class="token function">UNIX_TIMESTAMP</span><span class="token punctuation">(</span><span class="token string">'2008-04-01 00:00:00'</span><span class="token punctuation">)</span> <span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">PARTITION</span> p2 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token punctuation">(</span> <span class="token function">UNIX_TIMESTAMP</span><span class="token punctuation">(</span><span class="token string">'2008-07-01 00:00:00'</span><span class="token punctuation">)</span> <span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">PARTITION</span> p3 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token punctuation">(</span> <span class="token function">UNIX_TIMESTAMP</span><span class="token punctuation">(</span><span class="token string">'2008-10-01 00:00:00'</span><span class="token punctuation">)</span> <span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">PARTITION</span> p4 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token punctuation">(</span> <span class="token function">UNIX_TIMESTAMP</span><span class="token punctuation">(</span><span class="token string">'2009-01-01 00:00:00'</span><span class="token punctuation">)</span> <span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">PARTITION</span> p5 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token punctuation">(</span> <span class="token function">UNIX_TIMESTAMP</span><span class="token punctuation">(</span><span class="token string">'2009-04-01 00:00:00'</span><span class="token punctuation">)</span> <span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">PARTITION</span> p6 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token punctuation">(</span> <span class="token function">UNIX_TIMESTAMP</span><span class="token punctuation">(</span><span class="token string">'2009-07-01 00:00:00'</span><span class="token punctuation">)</span> <span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">PARTITION</span> p7 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token punctuation">(</span> <span class="token function">UNIX_TIMESTAMP</span><span class="token punctuation">(</span><span class="token string">'2009-10-01 00:00:00'</span><span class="token punctuation">)</span> <span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">PARTITION</span> p8 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token punctuation">(</span> <span class="token function">UNIX_TIMESTAMP</span><span class="token punctuation">(</span><span class="token string">'2010-01-01 00:00:00'</span><span class="token punctuation">)</span> <span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">PARTITION</span> p9 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token punctuation">(</span><span class="token keyword">MAXVALUE</span><span class="token punctuation">)</span>
<span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Any other expressions involving
<a class="link" href="datetime.html" title="13.2.2 The DATE, DATETIME, and TIMESTAMP Types">
<code class="literal">
TIMESTAMP
</code>
</a>
values are not
permitted. (See Bug #42849.)
</p>
<p>
Range partitioning is particularly useful when one or more of
the following conditions is true:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
You want or need to delete
<span class="quote">
“
<span class="quote">
old
</span>
”
</span>
data. If you
are using the partitioning scheme shown previously for the
<code class="literal">
employees
</code>
table, you can simply use
<code class="literal">
ALTER TABLE employees DROP PARTITION p0;
</code>
to delete all rows relating to employees who stopped working
for the firm prior to 1991. (See
<a class="xref" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
Section 15.1.9, “ALTER TABLE Statement”
</a>
, and
<a class="xref" href="partitioning-management.html" title="26.3 Partition Management">
Section 26.3, “Partition Management”
</a>
, for more
information.) For a table with a great many rows, this can
be much more efficient than running a
<a class="link" href="delete.html" title="15.2.2 DELETE Statement">
<code class="literal">
DELETE
</code>
</a>
query such as
<code class="literal">
DELETE FROM employees WHERE YEAR(separated) <=
1990;
</code>
.
</p>
</li>
<li class="listitem">
<p>
You want to use a column containing date or time values, or
containing values arising from some other series.
</p>
</li>
<li class="listitem">
<p>
You frequently run queries that depend directly on the
column used for partitioning the table. For example, when
executing a query such as
<a class="link" href="explain.html" title="15.8.2 EXPLAIN Statement">
<code class="literal">
EXPLAIN SELECT
COUNT(*) FROM employees WHERE separated BETWEEN '2000-01-01'
AND '2000-12-31' GROUP BY store_id;
</code>
</a>
, MySQL can
quickly determine that only partition
<code class="literal">
p2
</code>
needs to be scanned because the remaining partitions cannot
contain any records satisfying the
<code class="literal">
WHERE
</code>
clause. See
<a class="xref" href="partitioning-pruning.html" title="26.4 Partition Pruning">
Section 26.4, “Partition Pruning”
</a>
, for more
information about how this is accomplished.
</p>
</li>
</ul>
</div>
<p>
A variant on this type of partitioning is
<code class="literal">
RANGE
COLUMNS
</code>
partitioning. Partitioning by
<code class="literal">
RANGE
COLUMNS
</code>
makes it possible to employ multiple columns
for defining partitioning ranges that apply both to placement of
rows in partitions and for determining the inclusion or
exclusion of specific partitions when performing partition
pruning. See
<a class="xref" href="partitioning-columns-range.html" title="26.2.3.1 RANGE COLUMNS partitioning">
Section 26.2.3.1, “RANGE COLUMNS partitioning”
</a>
, for
more information.
</p>
<p>
<a name="partitioning-time-intervals">
</a>
<b>
Partitioning schemes based on time intervals.
</b>
If you wish to implement a partitioning scheme based on ranges
or intervals of time in MySQL 8.4, you have two
options:
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
Partition the table by
<code class="literal">
RANGE
</code>
, and for the
partitioning expression, employ a function operating on a
<a class="link" href="datetime.html" title="13.2.2 The DATE, DATETIME, and TIMESTAMP Types">
<code class="literal">
DATE
</code>
</a>
,
<a class="link" href="time.html" title="13.2.3 The TIME Type">
<code class="literal">
TIME
</code>
</a>
, or
<a class="link" href="datetime.html" title="13.2.2 The DATE, DATETIME, and TIMESTAMP Types">
<code class="literal">
DATETIME
</code>
</a>
column and returning
an integer value, as shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa7635592"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> members <span class="token punctuation">(</span>
firstname <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">25</span><span class="token punctuation">)</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span><span class="token punctuation">,</span>
lastname <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">25</span><span class="token punctuation">)</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span><span class="token punctuation">,</span>
username <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">16</span><span class="token punctuation">)</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span><span class="token punctuation">,</span>
email <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">35</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
joined <span class="token datatype">DATE</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span>
<span class="token punctuation">)</span>
<span class="token keyword">PARTITION</span> <span class="token keyword">BY</span> <span class="token keyword">RANGE</span><span class="token punctuation">(</span> <span class="token function">YEAR</span><span class="token punctuation">(</span>joined<span class="token punctuation">)</span> <span class="token punctuation">)</span> <span class="token punctuation">(</span>
<span class="token keyword">PARTITION</span> p0 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token punctuation">(</span><span class="token number">1960</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">PARTITION</span> p1 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token punctuation">(</span><span class="token number">1970</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">PARTITION</span> p2 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token punctuation">(</span><span class="token number">1980</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">PARTITION</span> p3 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token punctuation">(</span><span class="token number">1990</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">PARTITION</span> p4 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token keyword">MAXVALUE</span>
<span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
In MySQL 8.4, it is also possible to partition
a table by
<code class="literal">
RANGE
</code>
based on the value of a
<a class="link" href="datetime.html" title="13.2.2 The DATE, DATETIME, and TIMESTAMP Types">
<code class="literal">
TIMESTAMP
</code>
</a>
column, using the
<a class="link" href="date-and-time-functions.html#function_unix-timestamp">
<code class="literal">
UNIX_TIMESTAMP()
</code>
</a>
function, as
shown in this example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa24610061"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> quarterly_report_status <span class="token punctuation">(</span>
report_id <span class="token datatype">INT</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span><span class="token punctuation">,</span>
report_status <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">20</span><span class="token punctuation">)</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span><span class="token punctuation">,</span>
report_updated <span class="token datatype">TIMESTAMP</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span> <span class="token keyword">DEFAULT</span> <span class="token keyword">CURRENT_TIMESTAMP</span> <span class="token keyword">ON</span> <span class="token keyword">UPDATE</span> <span class="token keyword">CURRENT_TIMESTAMP</span>
<span class="token punctuation">)</span>
<span class="token keyword">PARTITION</span> <span class="token keyword">BY</span> <span class="token keyword">RANGE</span> <span class="token punctuation">(</span> <span class="token function">UNIX_TIMESTAMP</span><span class="token punctuation">(</span>report_updated<span class="token punctuation">)</span> <span class="token punctuation">)</span> <span class="token punctuation">(</span>
<span class="token keyword">PARTITION</span> p0 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token punctuation">(</span> <span class="token function">UNIX_TIMESTAMP</span><span class="token punctuation">(</span><span class="token string">'2008-01-01 00:00:00'</span><span class="token punctuation">)</span> <span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">PARTITION</span> p1 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token punctuation">(</span> <span class="token function">UNIX_TIMESTAMP</span><span class="token punctuation">(</span><span class="token string">'2008-04-01 00:00:00'</span><span class="token punctuation">)</span> <span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">PARTITION</span> p2 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token punctuation">(</span> <span class="token function">UNIX_TIMESTAMP</span><span class="token punctuation">(</span><span class="token string">'2008-07-01 00:00:00'</span><span class="token punctuation">)</span> <span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">PARTITION</span> p3 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token punctuation">(</span> <span class="token function">UNIX_TIMESTAMP</span><span class="token punctuation">(</span><span class="token string">'2008-10-01 00:00:00'</span><span class="token punctuation">)</span> <span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">PARTITION</span> p4 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token punctuation">(</span> <span class="token function">UNIX_TIMESTAMP</span><span class="token punctuation">(</span><span class="token string">'2009-01-01 00:00:00'</span><span class="token punctuation">)</span> <span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">PARTITION</span> p5 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token punctuation">(</span> <span class="token function">UNIX_TIMESTAMP</span><span class="token punctuation">(</span><span class="token string">'2009-04-01 00:00:00'</span><span class="token punctuation">)</span> <span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">PARTITION</span> p6 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token punctuation">(</span> <span class="token function">UNIX_TIMESTAMP</span><span class="token punctuation">(</span><span class="token string">'2009-07-01 00:00:00'</span><span class="token punctuation">)</span> <span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">PARTITION</span> p7 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token punctuation">(</span> <span class="token function">UNIX_TIMESTAMP</span><span class="token punctuation">(</span><span class="token string">'2009-10-01 00:00:00'</span><span class="token punctuation">)</span> <span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">PARTITION</span> p8 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token punctuation">(</span> <span class="token function">UNIX_TIMESTAMP</span><span class="token punctuation">(</span><span class="token string">'2010-01-01 00:00:00'</span><span class="token punctuation">)</span> <span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">PARTITION</span> p9 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token punctuation">(</span><span class="token keyword">MAXVALUE</span><span class="token punctuation">)</span>
<span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
In MySQL 8.4, any other expressions involving
<a class="link" href="datetime.html" title="13.2.2 The DATE, DATETIME, and TIMESTAMP Types">
<code class="literal">
TIMESTAMP
</code>
</a>
values are not
permitted. (See Bug #42849.)
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
It is also possible in MySQL 8.4 to use
<a class="link" href="date-and-time-functions.html#function_unix-timestamp">
<code class="literal">
UNIX_TIMESTAMP(timestamp_column)
</code>
</a>
as a partitioning expression for tables that are
partitioned by
<code class="literal">
LIST
</code>
. However, it is
usually not practical to do so.
</p>
</div>
</li>
<li class="listitem">
<p>
Partition the table by
<code class="literal">
RANGE COLUMNS
</code>
,
using a
<a class="link" href="datetime.html" title="13.2.2 The DATE, DATETIME, and TIMESTAMP Types">
<code class="literal">
DATE
</code>
</a>
or
<a class="link" href="datetime.html" title="13.2.2 The DATE, DATETIME, and TIMESTAMP Types">
<code class="literal">
DATETIME
</code>
</a>
column as the
partitioning column. For example, the
<code class="literal">
members
</code>
table could be defined using the
<code class="literal">
joined
</code>
column directly, as shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa20772030"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> members <span class="token punctuation">(</span>
firstname <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">25</span><span class="token punctuation">)</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span><span class="token punctuation">,</span>
lastname <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">25</span><span class="token punctuation">)</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span><span class="token punctuation">,</span>
username <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">16</span><span class="token punctuation">)</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span><span class="token punctuation">,</span>
email <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">35</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
joined <span class="token datatype">DATE</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span>
<span class="token punctuation">)</span>
<span class="token keyword">PARTITION</span> <span class="token keyword">BY</span> <span class="token keyword">RANGE</span> <span class="token keyword">COLUMNS</span><span class="token punctuation">(</span>joined<span class="token punctuation">)</span> <span class="token punctuation">(</span>
<span class="token keyword">PARTITION</span> p0 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token punctuation">(</span><span class="token string">'1960-01-01'</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">PARTITION</span> p1 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token punctuation">(</span><span class="token string">'1970-01-01'</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">PARTITION</span> p2 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token punctuation">(</span><span class="token string">'1980-01-01'</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">PARTITION</span> p3 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token punctuation">(</span><span class="token string">'1990-01-01'</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">PARTITION</span> p4 <span class="token keyword">VALUES</span> <span class="token keyword">LESS</span> <span class="token keyword">THAN</span> <span class="token keyword">MAXVALUE</span>
<span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
</ol>
</div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
The use of partitioning columns employing date or time types
other than
<a class="link" href="datetime.html" title="13.2.2 The DATE, DATETIME, and TIMESTAMP Types">
<code class="literal">
DATE
</code>
</a>
or
<a class="link" href="datetime.html" title="13.2.2 The DATE, DATETIME, and TIMESTAMP Types">
<code class="literal">
DATETIME
</code>
</a>
is not supported with
<code class="literal">
RANGE COLUMNS
</code>
.
</p>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/repeat.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="repeat">
</a>
15.6.5.6 REPEAT Statement
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045176224336">
</a>
<a class="indexterm" name="idm46045176223264">
</a>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa16177768"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token punctuation">[</span><em class="replaceable">begin_label</em>:<span class="token punctuation">]</span> <span class="token keyword">REPEAT</span>
<em class="replaceable">statement_list</em>
<span class="token keyword">UNTIL</span> <em class="replaceable">search_condition</em>
<span class="token keyword">END</span> <span class="token keyword">REPEAT</span> <span class="token punctuation">[</span><em class="replaceable">end_label</em><span class="token punctuation">]</span></code></pre>
</div>
<p>
The statement list within a
<a class="link" href="repeat.html" title="15.6.5.6 REPEAT Statement">
<code class="literal">
REPEAT
</code>
</a>
statement is repeated
until the
<em class="replaceable">
<code>
search_condition
</code>
</em>
expression
is true. Thus, a
<a class="link" href="repeat.html" title="15.6.5.6 REPEAT Statement">
<code class="literal">
REPEAT
</code>
</a>
always
enters the loop at least once.
<em class="replaceable">
<code>
statement_list
</code>
</em>
consists of one or
more statements, each terminated by a semicolon
(
<code class="literal">
;
</code>
) statement delimiter.
</p>
<p>
A
<a class="link" href="repeat.html" title="15.6.5.6 REPEAT Statement">
<code class="literal">
REPEAT
</code>
</a>
statement can be
labeled. For the rules regarding label use, see
<a class="xref" href="statement-labels.html" title="15.6.2 Statement Labels">
Section 15.6.2, “Statement Labels”
</a>
.
</p>
<p>
Example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa46757851"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">delimiter</span> <span class="token comment" spellcheck="true">//</span>
<span class="token prompt">mysql></span> <span class="token keyword">CREATE</span> <span class="token keyword">PROCEDURE</span> dorepeat<span class="token punctuation">(</span>p1 <span class="token datatype">INT</span><span class="token punctuation">)</span>
<span class="token keyword">BEGIN</span>
<span class="token keyword">SET</span> <span class="token variable">@x</span> <span class="token operator">=</span> <span class="token number">0</span><span class="token punctuation">;</span>
<span class="token keyword">REPEAT</span>
<span class="token keyword">SET</span> <span class="token variable">@x</span> <span class="token operator">=</span> <span class="token variable">@x</span> <span class="token operator">+</span> <span class="token number">1</span><span class="token punctuation">;</span>
<span class="token keyword">UNTIL</span> <span class="token variable">@x</span> <span class="token operator">></span> p1 <span class="token keyword">END</span> <span class="token keyword">REPEAT</span><span class="token punctuation">;</span>
<span class="token keyword">END</span>
<span class="token comment" spellcheck="true">//</span>
<span class="token output">Query OK, 0 rows affected (0.00 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">CALL</span> dorepeat<span class="token punctuation">(</span><span class="token number">1000</span><span class="token punctuation">)</span><span class="token comment" spellcheck="true">//</span>
<span class="token output">Query OK, 0 rows affected (0.00 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token variable">@x</span><span class="token comment" spellcheck="true">//</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> @x <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 1001 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output">1 row in set (0.00 sec)</span></code></pre>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/document-store-interfaces.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title">
<a name="document-store-interfaces">
</a>
22.1 Interfaces to a MySQL Document Store
</h2>
</div>
</div>
</div>
<p>
To work with MySQL as a document store, you use dedicated
components and a choice of clients that support communicating with
the MySQL server to develop document based applications.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
The following MySQL products support X Protocol and enable
you to use X DevAPI in your chosen language to develop
applications that communicate with a MySQL Server functioning
as a document store:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
MySQL Shell (which provides implementations of X DevAPI
in JavaScript and Python)
</p>
</li>
<li class="listitem">
<p>
Connector/C++
</p>
</li>
<li class="listitem">
<p>
Connector/J
</p>
</li>
<li class="listitem">
<p>
Connector/Node.js
</p>
</li>
<li class="listitem">
<p>
Connector/NET
</p>
</li>
<li class="listitem">
<p>
Connector/Python
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
MySQL Shell is an interactive interface to MySQL supporting
JavaScript, Python, or SQL modes. You can use MySQL Shell to
prototype applications, execute queries and update data.
<a class="ulink" href="/doc/mysql-shell/8.4/en/mysql-shell-install.html" target="_top">
Installing MySQL Shell
</a>
has instructions to
download and install MySQL Shell.
</p>
</li>
<li class="listitem">
<p>
The quick-start guides (tutorials) in this chapter help you to
get started using MySQL Shell with MySQL as a document store.
</p>
<p>
The quick-start guide for JavaScript is here:
<a class="xref" href="mysql-shell-tutorial-javascript.html" title="22.3 JavaScript Quick-Start Guide: MySQL Shell for Document Store">
Section 22.3, “JavaScript Quick-Start Guide: MySQL Shell for Document Store”
</a>
.
</p>
<p>
The quick-start guide for Python is here:
<a class="xref" href="mysql-shell-tutorial-python.html" title="22.4 Python Quick-Start Guide: MySQL Shell for Document Store">
Section 22.4, “Python Quick-Start Guide: MySQL Shell for Document Store”
</a>
.
</p>
</li>
<li class="listitem">
<p>
The
<em class="citetitle">
MySQL Shell User Guide
</em>
at
<a class="ulink" href="/doc/mysql-shell/8.4/en/" target="_top">
MySQL Shell 8.4
</a>
provides detailed information
about configuring and using MySQL Shell.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/performance-schema-query-profiling.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="performance-schema-query-profiling">
</a>
29.19.1 Query Profiling Using Performance Schema
</h3>
</div>
</div>
</div>
<p>
The following example demonstrates how to use Performance Schema
statement events and stage events to retrieve data comparable to
profiling information provided by
<a class="link" href="show-profiles.html" title="15.7.7.33 SHOW PROFILES Statement">
<code class="literal">
SHOW
PROFILES
</code>
</a>
and
<a class="link" href="show-profile.html" title="15.7.7.32 SHOW PROFILE Statement">
<code class="literal">
SHOW
PROFILE
</code>
</a>
statements.
</p>
<p>
The
<a class="link" href="performance-schema-setup-actors-table.html" title="29.12.2.1 The setup_actors Table">
<code class="literal">
setup_actors
</code>
</a>
table can be used
to limit the collection of historical events by host, user, or
account to reduce runtime overhead and the amount of data
collected in history tables. The first step of the example shows
how to limit collection of historical events to a specific user.
</p>
<p>
Performance Schema displays event timer information in
picoseconds (trillionths of a second) to normalize timing data
to a standard unit. In the following example,
<code class="literal">
TIMER_WAIT
</code>
values are divided by
1000000000000 to show data in units of seconds. Values are also
truncated to 6 decimal places to display data in the same format
as
<a class="link" href="show-profiles.html" title="15.7.7.33 SHOW PROFILES Statement">
<code class="literal">
SHOW PROFILES
</code>
</a>
and
<a class="link" href="show-profile.html" title="15.7.7.32 SHOW PROFILE Statement">
<code class="literal">
SHOW PROFILE
</code>
</a>
statements.
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
Limit the collection of historical events to the user that
runs the query. By default,
<a class="link" href="performance-schema-setup-actors-table.html" title="29.12.2.1 The setup_actors Table">
<code class="literal">
setup_actors
</code>
</a>
is configured to
allow monitoring and historical event collection for all
foreground threads:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa4190989"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> performance_schema<span class="token punctuation">.</span>setup_actors<span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> HOST <span class="token punctuation">|</span> USER <span class="token punctuation">|</span> ROLE <span class="token punctuation">|</span> ENABLED <span class="token punctuation">|</span> HISTORY <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> % <span class="token punctuation">|</span> % <span class="token punctuation">|</span> % <span class="token punctuation">|</span> YES <span class="token punctuation">|</span> YES <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
<p>
Update the default row in the
<a class="link" href="performance-schema-setup-actors-table.html" title="29.12.2.1 The setup_actors Table">
<code class="literal">
setup_actors
</code>
</a>
table to disable
historical event collection and monitoring for all
foreground threads, and insert a new row that enables
monitoring and historical event collection for the user that
runs the query:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa74222585"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">UPDATE</span> performance_schema<span class="token punctuation">.</span>setup_actors
<span class="token keyword">SET</span> ENABLED <span class="token operator">=</span> <span class="token string">'NO'</span><span class="token punctuation">,</span> <span class="token keyword">HISTORY</span> <span class="token operator">=</span> <span class="token string">'NO'</span>
<span class="token keyword">WHERE</span> <span class="token keyword">HOST</span> <span class="token operator">=</span> <span class="token string">'%'</span> <span class="token operator">AND</span> <span class="token keyword">USER</span> <span class="token operator">=</span> <span class="token string">'%'</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">INSERT</span> <span class="token keyword">INTO</span> performance_schema<span class="token punctuation">.</span>setup_actors
<span class="token punctuation">(</span><span class="token keyword">HOST</span><span class="token punctuation">,</span><span class="token keyword">USER</span><span class="token punctuation">,</span><span class="token keyword">ROLE</span><span class="token punctuation">,</span>ENABLED<span class="token punctuation">,</span><span class="token keyword">HISTORY</span><span class="token punctuation">)</span>
<span class="token keyword">VALUES</span><span class="token punctuation">(</span><span class="token string">'localhost'</span><span class="token punctuation">,</span><span class="token string">'test_user'</span><span class="token punctuation">,</span><span class="token string">'%'</span><span class="token punctuation">,</span><span class="token string">'YES'</span><span class="token punctuation">,</span><span class="token string">'YES'</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Data in the
<a class="link" href="performance-schema-setup-actors-table.html" title="29.12.2.1 The setup_actors Table">
<code class="literal">
setup_actors
</code>
</a>
table
should now appear similar to the following:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa83309799"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> performance_schema<span class="token punctuation">.</span>setup_actors<span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> HOST <span class="token punctuation">|</span> USER <span class="token punctuation">|</span> ROLE <span class="token punctuation">|</span> ENABLED <span class="token punctuation">|</span> HISTORY <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> % <span class="token punctuation">|</span> % <span class="token punctuation">|</span> % <span class="token punctuation">|</span> NO <span class="token punctuation">|</span> NO <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> localhost <span class="token punctuation">|</span> test_user <span class="token punctuation">|</span> % <span class="token punctuation">|</span> YES <span class="token punctuation">|</span> YES <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
</li>
<li class="listitem">
<p>
Ensure that statement and stage instrumentation is enabled
by updating the
<a class="link" href="performance-schema-setup-instruments-table.html" title="29.12.2.3 The setup_instruments Table">
<code class="literal">
setup_instruments
</code>
</a>
table. Some
instruments may already be enabled by default.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa53753709"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">UPDATE</span> performance_schema<span class="token punctuation">.</span>setup_instruments
<span class="token keyword">SET</span> ENABLED <span class="token operator">=</span> <span class="token string">'YES'</span><span class="token punctuation">,</span> TIMED <span class="token operator">=</span> <span class="token string">'YES'</span>
<span class="token keyword">WHERE</span> <span class="token keyword">NAME</span> <span class="token operator">LIKE</span> <span class="token string">'%statement/%'</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">UPDATE</span> performance_schema<span class="token punctuation">.</span>setup_instruments
<span class="token keyword">SET</span> ENABLED <span class="token operator">=</span> <span class="token string">'YES'</span><span class="token punctuation">,</span> TIMED <span class="token operator">=</span> <span class="token string">'YES'</span>
<span class="token keyword">WHERE</span> <span class="token keyword">NAME</span> <span class="token operator">LIKE</span> <span class="token string">'%stage/%'</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
Ensure that
<code class="literal">
events_statements_*
</code>
and
<code class="literal">
events_stages_*
</code>
consumers are enabled.
Some consumers may already be enabled by default.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa8217053"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">UPDATE</span> performance_schema<span class="token punctuation">.</span>setup_consumers
<span class="token keyword">SET</span> ENABLED <span class="token operator">=</span> <span class="token string">'YES'</span>
<span class="token keyword">WHERE</span> <span class="token keyword">NAME</span> <span class="token operator">LIKE</span> <span class="token string">'%events_statements_%'</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">UPDATE</span> performance_schema<span class="token punctuation">.</span>setup_consumers
<span class="token keyword">SET</span> ENABLED <span class="token operator">=</span> <span class="token string">'YES'</span>
<span class="token keyword">WHERE</span> <span class="token keyword">NAME</span> <span class="token operator">LIKE</span> <span class="token string">'%events_stages_%'</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
Under the user account you are monitoring, run the statement
that you want to profile. For example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa17253038"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> employees<span class="token punctuation">.</span>employees <span class="token keyword">WHERE</span> emp_no <span class="token operator">=</span> <span class="token number">10001</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> emp_no <span class="token punctuation">|</span> birth_date <span class="token punctuation">|</span> first_name <span class="token punctuation">|</span> last_name <span class="token punctuation">|</span> gender <span class="token punctuation">|</span> hire_date <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 10001 <span class="token punctuation">|</span> 1953<span class="token punctuation">-</span>09<span class="token punctuation">-</span>02 <span class="token punctuation">|</span> Georgi <span class="token punctuation">|</span> Facello <span class="token punctuation">|</span> M <span class="token punctuation">|</span> 1986<span class="token punctuation">-</span>06<span class="token punctuation">-</span>26 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
</li>
<li class="listitem">
<p>
Identify the
<code class="literal">
EVENT_ID
</code>
of the statement by
querying the
<a class="link" href="performance-schema-events-statements-history-long-table.html" title="29.12.6.3 The events_statements_history_long Table">
<code class="literal">
events_statements_history_long
</code>
</a>
table. This step is similar to running
<a class="link" href="show-profiles.html" title="15.7.7.33 SHOW PROFILES Statement">
<code class="literal">
SHOW PROFILES
</code>
</a>
to identify the
<code class="literal">
Query_ID
</code>
. The following query produces
output similar to
<a class="link" href="show-profiles.html" title="15.7.7.33 SHOW PROFILES Statement">
<code class="literal">
SHOW
PROFILES
</code>
</a>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa42444901"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> EVENT_ID<span class="token punctuation">,</span> <span class="token function">TRUNCATE</span><span class="token punctuation">(</span>TIMER_WAIT<span class="token operator">/</span><span class="token number">1000000000000</span><span class="token punctuation">,</span><span class="token number">6</span><span class="token punctuation">)</span> <span class="token keyword">as</span> Duration<span class="token punctuation">,</span> SQL_TEXT
<span class="token keyword">FROM</span> performance_schema<span class="token punctuation">.</span>events_statements_history_long <span class="token keyword">WHERE</span> SQL_TEXT <span class="token operator">like</span> <span class="token string">'%10001%'</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> event_id <span class="token punctuation">|</span> duration <span class="token punctuation">|</span> sql_text <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 31 <span class="token punctuation">|</span> 0.028310 <span class="token punctuation">|</span> SELECT * FROM employees.employees WHERE emp_no = 10001 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
</li>
<li class="listitem">
<p>
Query the
<a class="link" href="performance-schema-events-stages-history-long-table.html" title="29.12.5.3 The events_stages_history_long Table">
<code class="literal">
events_stages_history_long
</code>
</a>
table to retrieve the statement's stage events. Stages are
linked to statements using event nesting. Each stage event
record has a
<code class="literal">
NESTING_EVENT_ID
</code>
column that
contains the
<code class="literal">
EVENT_ID
</code>
of the parent
statement.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa31863715"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> event_name <span class="token keyword">AS</span> Stage<span class="token punctuation">,</span> <span class="token function">TRUNCATE</span><span class="token punctuation">(</span>TIMER_WAIT<span class="token operator">/</span><span class="token number">1000000000000</span><span class="token punctuation">,</span><span class="token number">6</span><span class="token punctuation">)</span> <span class="token keyword">AS</span> Duration
<span class="token keyword">FROM</span> performance_schema<span class="token punctuation">.</span>events_stages_history_long <span class="token keyword">WHERE</span> NESTING_EVENT_ID<span class="token operator">=</span><span class="token number">31</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> Stage <span class="token punctuation">|</span> Duration <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> stage/sql/starting <span class="token punctuation">|</span> 0.000080 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> stage/sql/checking permissions <span class="token punctuation">|</span> 0.000005 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> stage/sql/Opening tables <span class="token punctuation">|</span> 0.027759 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> stage/sql/init <span class="token punctuation">|</span> 0.000052 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> stage/sql/System lock <span class="token punctuation">|</span> 0.000009 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> stage/sql/optimizing <span class="token punctuation">|</span> 0.000006 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> stage/sql/statistics <span class="token punctuation">|</span> 0.000082 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> stage/sql/preparing <span class="token punctuation">|</span> 0.000008 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> stage/sql/executing <span class="token punctuation">|</span> 0.000000 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> stage/sql/Sending data <span class="token punctuation">|</span> 0.000017 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> stage/sql/end <span class="token punctuation">|</span> 0.000001 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> stage/sql/query end <span class="token punctuation">|</span> 0.000004 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> stage/sql/closing tables <span class="token punctuation">|</span> 0.000006 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> stage/sql/freeing items <span class="token punctuation">|</span> 0.000272 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> stage/sql/cleaning up <span class="token punctuation">|</span> 0.000001 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
</li>
</ol>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/mysql-cluster-tde-limitations.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="mysql-cluster-tde-limitations">
</a>
25.6.14.3 NDB File System Encryption Limitations
</h4>
</div>
</div>
</div>
<p>
Transparent data encryption in NDB Cluster is subject to the
following restrictions and limitations:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
The file system password must be supplied to each individual
data node.
</p>
</li>
<li class="listitem">
<p>
File system password rotation requires an initial rolling
restart of the data nodes; this must be performed manually,
or by an application external to
<code class="literal">
NDB
</code>
).
</p>
</li>
<li class="listitem">
<p>
For a cluster with only a single replica
(
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-noofreplicas">
<code class="literal">
NoOfReplicas = 1
</code>
</a>
),
a full backup and restore is required for file system
password rotation.
</p>
</li>
<li class="listitem">
<p>
Rotation of all data encryption keys requires an initial
node restart.
</p>
</li>
</ul>
</div>
<p>
<a name="mysql-cluster-tde-limitations-replication">
</a>
<b>
NDB TDE and NDB Replication.
</b>
The use of an encrypted filesystem does not have any effect on
NDB Replication. All of the following scenarios are supported:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Replication of an NDB Cluster having an encrypted file
system to an NDB Cluster whose file system is not encrypted.
</p>
</li>
<li class="listitem">
<p>
Replication of an NDB Cluster whose file system is not
encrypted to an NDB Cluster whose file system is encrypted.
</p>
</li>
<li class="listitem">
<p>
Replication of an NDB Cluster whose file system is encrypted
to a standalone MySQL server using
<a class="link" href="innodb-storage-engine.html" title="Chapter 17 The InnoDB Storage Engine">
<code class="literal">
InnoDB
</code>
</a>
tables which are not
encrypted.
</p>
</li>
<li class="listitem">
<p>
Replication of an NDB Cluster with an unencrypted file
system to a standalone MySQL server using
<code class="literal">
InnoDB
</code>
tables with file sytem encryption.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/innodb-storage-engine.html | <div id="docs-body">
<div class="chapter">
<div class="titlepage">
<div>
<div>
<h1 class="title">
<a name="innodb-storage-engine">
</a>
Chapter 17 The InnoDB Storage Engine
</h1>
</div>
</div>
</div>
<div class="toc">
<p>
<b>
Table of Contents
</b>
</p>
<dl class="toc">
<dt>
<span class="section">
<a href="innodb-introduction.html">
17.1 Introduction to InnoDB
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="innodb-benefits.html">
17.1.1 Benefits of Using InnoDB Tables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-best-practices.html">
17.1.2 Best Practices for InnoDB Tables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-check-availability.html">
17.1.3 Verifying that InnoDB is the Default Storage Engine
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-benchmarking.html">
17.1.4 Testing and Benchmarking with InnoDB
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="mysql-acid.html">
17.2 InnoDB and the ACID Model
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-multi-versioning.html">
17.3 InnoDB Multi-Versioning
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-architecture.html">
17.4 InnoDB Architecture
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-in-memory-structures.html">
17.5 InnoDB In-Memory Structures
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="innodb-buffer-pool.html">
17.5.1 Buffer Pool
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-change-buffer.html">
17.5.2 Change Buffer
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-adaptive-hash.html">
17.5.3 Adaptive Hash Index
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-redo-log-buffer.html">
17.5.4 Log Buffer
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="innodb-on-disk-structures.html">
17.6 InnoDB On-Disk Structures
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="innodb-tables.html">
17.6.1 Tables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-indexes.html">
17.6.2 Indexes
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-tablespace.html">
17.6.3 Tablespaces
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-doublewrite-buffer.html">
17.6.4 Doublewrite Buffer
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-redo-log.html">
17.6.5 Redo Log
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-undo-logs.html">
17.6.6 Undo Logs
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="innodb-locking-transaction-model.html">
17.7 InnoDB Locking and Transaction Model
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="innodb-locking.html">
17.7.1 InnoDB Locking
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-transaction-model.html">
17.7.2 InnoDB Transaction Model
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-locks-set.html">
17.7.3 Locks Set by Different SQL Statements in InnoDB
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-next-key-locking.html">
17.7.4 Phantom Rows
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-deadlocks.html">
17.7.5 Deadlocks in InnoDB
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-transaction-scheduling.html">
17.7.6 Transaction Scheduling
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="innodb-configuration.html">
17.8 InnoDB Configuration
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="innodb-init-startup-configuration.html">
17.8.1 InnoDB Startup Configuration
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-read-only-instance.html">
17.8.2 Configuring InnoDB for Read-Only Operation
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-performance-buffer-pool.html">
17.8.3 InnoDB Buffer Pool Configuration
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-performance-thread_concurrency.html">
17.8.4 Configuring Thread Concurrency for InnoDB
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-performance-multiple_io_threads.html">
17.8.5 Configuring the Number of Background InnoDB I/O Threads
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-linux-native-aio.html">
17.8.6 Using Asynchronous I/O on Linux
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-configuring-io-capacity.html">
17.8.7 Configuring InnoDB I/O Capacity
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-performance-spin_lock_polling.html">
17.8.8 Configuring Spin Lock Polling
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-purge-configuration.html">
17.8.9 Purge Configuration
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-performance-optimizer-statistics.html">
17.8.10 Configuring Optimizer Statistics for InnoDB
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="index-page-merge-threshold.html">
17.8.11 Configuring the Merge Threshold for Index Pages
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-dedicated-server.html">
17.8.12 Enabling Automatic InnoDB Configuration for a Dedicated MySQL Server
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="innodb-compression.html">
17.9 InnoDB Table and Page Compression
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="innodb-table-compression.html">
17.9.1 InnoDB Table Compression
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-page-compression.html">
17.9.2 InnoDB Page Compression
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="innodb-row-format.html">
17.10 InnoDB Row Formats
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-disk-management.html">
17.11 InnoDB Disk I/O and File Space Management
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="innodb-disk-io.html">
17.11.1 InnoDB Disk I/O
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-file-space.html">
17.11.2 File Space Management
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-checkpoints.html">
17.11.3 InnoDB Checkpoints
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-file-defragmenting.html">
17.11.4 Defragmenting a Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-truncate-table-reclaim-space.html">
17.11.5 Reclaiming Disk Space with TRUNCATE TABLE
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="innodb-online-ddl.html">
17.12 InnoDB and Online DDL
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="innodb-online-ddl-operations.html">
17.12.1 Online DDL Operations
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-online-ddl-performance.html">
17.12.2 Online DDL Performance and Concurrency
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-online-ddl-space-requirements.html">
17.12.3 Online DDL Space Requirements
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="online-ddl-memory-management.html">
17.12.4 Online DDL Memory Management
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="online-ddl-parallel-thread-configuration.html">
17.12.5 Configuring Parallel Threads for Online DDL Operations
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-online-ddl-single-multi.html">
17.12.6 Simplifying DDL Statements with Online DDL
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-online-ddl-failure-conditions.html">
17.12.7 Online DDL Failure Conditions
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-online-ddl-limitations.html">
17.12.8 Online DDL Limitations
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="innodb-data-encryption.html">
17.13 InnoDB Data-at-Rest Encryption
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-parameters.html">
17.14 InnoDB Startup Options and System Variables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-information-schema.html">
17.15 InnoDB INFORMATION_SCHEMA Tables
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="innodb-information-schema-compression-tables.html">
17.15.1 InnoDB INFORMATION_SCHEMA Tables about Compression
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-information-schema-transactions.html">
17.15.2 InnoDB INFORMATION_SCHEMA Transaction and Locking Information
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-information-schema-system-tables.html">
17.15.3 InnoDB INFORMATION_SCHEMA Schema Object Tables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-information-schema-fulltext_index-tables.html">
17.15.4 InnoDB INFORMATION_SCHEMA FULLTEXT Index Tables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-information-schema-buffer-pool-tables.html">
17.15.5 InnoDB INFORMATION_SCHEMA Buffer Pool Tables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-information-schema-metrics-table.html">
17.15.6 InnoDB INFORMATION_SCHEMA Metrics Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-information-schema-temp-table-info.html">
17.15.7 InnoDB INFORMATION_SCHEMA Temporary Table Info Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-information-schema-files-table.html">
17.15.8 Retrieving InnoDB Tablespace Metadata from INFORMATION_SCHEMA.FILES
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="innodb-performance-schema.html">
17.16 InnoDB Integration with MySQL Performance Schema
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="monitor-alter-table-performance-schema.html">
17.16.1 Monitoring ALTER TABLE Progress for InnoDB Tables Using Performance
Schema
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="monitor-innodb-mutex-waits-performance-schema.html">
17.16.2 Monitoring InnoDB Mutex Waits Using Performance Schema
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="innodb-monitors.html">
17.17 InnoDB Monitors
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="innodb-monitor-types.html">
17.17.1 InnoDB Monitor Types
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-enabling-monitors.html">
17.17.2 Enabling InnoDB Monitors
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-standard-monitor.html">
17.17.3 InnoDB Standard Monitor and Lock Monitor Output
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="innodb-backup-recovery.html">
17.18 InnoDB Backup and Recovery
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="innodb-backup.html">
17.18.1 InnoDB Backup
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-recovery.html">
17.18.2 InnoDB Recovery
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="innodb-and-mysql-replication.html">
17.19 InnoDB and MySQL Replication
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-troubleshooting.html">
17.20 InnoDB Troubleshooting
</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="error-creating-innodb.html">
17.20.1 Troubleshooting InnoDB I/O Problems
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-troubleshooting-recovery.html">
17.20.2 Troubleshooting Recovery Failures
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="forcing-innodb-recovery.html">
17.20.3 Forcing InnoDB Recovery
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-troubleshooting-datadict.html">
17.20.4 Troubleshooting InnoDB Data Dictionary Operations
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-error-handling.html">
17.20.5 InnoDB Error Handling
</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="innodb-limits.html">
17.21 InnoDB Limits
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-restrictions-limitations.html">
17.22 InnoDB Restrictions and Limitations
</a>
</span>
</dt>
</dl>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/column-count-limit.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="column-count-limit">
</a>
10.4.7 Limits on Table Column Count and Row Size
</h3>
</div>
</div>
</div>
<p>
This section describes limits on the number of columns in tables
and the size of individual rows.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="xref" href="column-count-limit.html#column-count-limits" title="Column Count Limits">
Column Count Limits
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="column-count-limit.html#row-size-limits" title="Row Size Limits">
Row Size Limits
</a>
</p>
</li>
</ul>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="column-count-limits">
</a>
Column Count Limits
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045226394224">
</a>
<a class="indexterm" name="idm46045226392720">
</a>
<a class="indexterm" name="idm46045226391216">
</a>
<p>
MySQL has hard limit of 4096 columns per table, but the
effective maximum may be less for a given table. The exact
column limit depends on several factors:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
The maximum row size for a table constrains the number
(and possibly size) of columns because the total length of
all columns cannot exceed this size. See
<a class="xref" href="column-count-limit.html#row-size-limits" title="Row Size Limits">
Row Size Limits
</a>
.
</p>
</li>
<li class="listitem">
<p>
The storage requirements of individual columns constrain
the number of columns that fit within a given maximum row
size. Storage requirements for some data types depend on
factors such as storage engine, storage format, and
character set. See
<a class="xref" href="storage-requirements.html" title="13.7 Data Type Storage Requirements">
Section 13.7, “Data Type Storage Requirements”
</a>
.
</p>
</li>
<li class="listitem">
<p>
Storage engines may impose additional restrictions that
limit table column count. For example,
<a class="link" href="innodb-storage-engine.html" title="Chapter 17 The InnoDB Storage Engine">
<code class="literal">
InnoDB
</code>
</a>
has a limit of 1017
columns per table. See
<a class="xref" href="innodb-limits.html" title="17.21 InnoDB Limits">
Section 17.21, “InnoDB Limits”
</a>
.
For information about other storage engines, see
<a class="xref" href="storage-engines.html" title="Chapter 18 Alternative Storage Engines">
Chapter 18,
<i>
Alternative Storage Engines
</i>
</a>
.
</p>
</li>
<li class="listitem">
<p>
Functional key parts (see
<a class="xref" href="create-index.html" title="15.1.15 CREATE INDEX Statement">
Section 15.1.15, “CREATE INDEX Statement”
</a>
)
are implemented as hidden virtual generated stored
columns, so each functional key part in a table index
counts against the table total column limit.
</p>
</li>
</ul>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="row-size-limits">
</a>
Row Size Limits
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045226378592">
</a>
<a class="indexterm" name="idm46045226377104">
</a>
<a class="indexterm" name="idm46045226375616">
</a>
<p>
The maximum row size for a given table is determined by
several factors:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
The internal representation of a MySQL table has a maximum
row size limit of 65,535 bytes, even if the storage engine
is capable of supporting larger rows.
<a class="link" href="blob.html" title="13.3.4 The BLOB and TEXT Types">
<code class="literal">
BLOB
</code>
</a>
and
<a class="link" href="blob.html" title="13.3.4 The BLOB and TEXT Types">
<code class="literal">
TEXT
</code>
</a>
columns only
contribute 9 to 12 bytes toward the row size limit because
their contents are stored separately from the rest of the
row.
</p>
</li>
<li class="listitem">
<p>
The maximum row size for an
<code class="literal">
InnoDB
</code>
table, which applies to data stored locally within a
database page, is slightly less than half a page for 4KB,
8KB, 16KB, and 32KB
<a class="link" href="innodb-parameters.html#sysvar_innodb_page_size">
<code class="literal">
innodb_page_size
</code>
</a>
settings. For example, the maximum row size is slightly
less than 8KB for the default 16KB
<code class="literal">
InnoDB
</code>
page size. For 64KB pages, the
maximum row size is slightly less than 16KB. See
<a class="xref" href="innodb-limits.html" title="17.21 InnoDB Limits">
Section 17.21, “InnoDB Limits”
</a>
.
</p>
<p>
If a row containing
<a class="link" href="glossary.html#glos_variable_length_type" title="variable-length type">
variable-length
columns
</a>
exceeds the
<code class="literal">
InnoDB
</code>
maximum row size,
<code class="literal">
InnoDB
</code>
selects
variable-length columns for external off-page storage
until the row fits within the
<code class="literal">
InnoDB
</code>
row size limit. The amount of data stored locally for
variable-length columns that are stored off-page differs
by row format. For more information, see
<a class="xref" href="innodb-row-format.html" title="17.10 InnoDB Row Formats">
Section 17.10, “InnoDB Row Formats”
</a>
.
</p>
</li>
<li class="listitem">
<p>
Different storage formats use different amounts of page
header and trailer data, which affects the amount of
storage available for rows.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
For information about
<code class="literal">
InnoDB
</code>
row
formats, see
<a class="xref" href="innodb-row-format.html" title="17.10 InnoDB Row Formats">
Section 17.10, “InnoDB Row Formats”
</a>
.
</p>
</li>
<li class="listitem">
<p>
For information about
<code class="literal">
MyISAM
</code>
storage formats, see
<a class="xref" href="myisam-table-formats.html" title="18.2.3 MyISAM Table Storage Formats">
Section 18.2.3, “MyISAM Table Storage Formats”
</a>
.
</p>
</li>
</ul>
</div>
</li>
</ul>
</div>
<h5>
<a name="idm46045226354528">
</a>
Row Size Limit Examples
</h5>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
The MySQL maximum row size limit of 65,535 bytes is
demonstrated in the following
<code class="literal">
InnoDB
</code>
and
<code class="literal">
MyISAM
</code>
examples. The limit is
enforced regardless of storage engine, even though the
storage engine may be capable of supporting larger rows.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa48880282"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> t <span class="token punctuation">(</span>a <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">10000</span><span class="token punctuation">)</span><span class="token punctuation">,</span> b <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">10000</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
c <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">10000</span><span class="token punctuation">)</span><span class="token punctuation">,</span> d <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">10000</span><span class="token punctuation">)</span><span class="token punctuation">,</span> e <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">10000</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
f <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">10000</span><span class="token punctuation">)</span><span class="token punctuation">,</span> g <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">6000</span><span class="token punctuation">)</span><span class="token punctuation">)</span> <span class="token keyword">ENGINE</span><span class="token operator">=</span>InnoDB <span class="token keyword">CHARACTER</span> <span class="token keyword">SET</span> latin1<span class="token punctuation">;</span>
<span class="token output">ERROR 1118 (42000)<span class="token punctuation">:</span> Row size too large. The maximum row size for the used
table type, not counting BLOBs, is 65535. This includes storage overhead,
check the manual. You have to change some columns to TEXT or BLOBs</span></code></pre>
</div>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa28900191"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> t <span class="token punctuation">(</span>a <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">10000</span><span class="token punctuation">)</span><span class="token punctuation">,</span> b <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">10000</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
c <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">10000</span><span class="token punctuation">)</span><span class="token punctuation">,</span> d <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">10000</span><span class="token punctuation">)</span><span class="token punctuation">,</span> e <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">10000</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
f <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">10000</span><span class="token punctuation">)</span><span class="token punctuation">,</span> g <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">6000</span><span class="token punctuation">)</span><span class="token punctuation">)</span> <span class="token keyword">ENGINE</span><span class="token operator">=</span>MyISAM <span class="token keyword">CHARACTER</span> <span class="token keyword">SET</span> latin1<span class="token punctuation">;</span>
<span class="token output">ERROR 1118 (42000)<span class="token punctuation">:</span> Row size too large. The maximum row size for the used
table type, not counting BLOBs, is 65535. This includes storage overhead,
check the manual. You have to change some columns to TEXT or BLOBs</span></code></pre>
</div>
<p>
In the following
<code class="literal">
MyISAM
</code>
example,
changing a column to
<a class="link" href="blob.html" title="13.3.4 The BLOB and TEXT Types">
<code class="literal">
TEXT
</code>
</a>
avoids the 65,535-byte row size limit and permits the
operation to succeed because
<a class="link" href="blob.html" title="13.3.4 The BLOB and TEXT Types">
<code class="literal">
BLOB
</code>
</a>
and
<a class="link" href="blob.html" title="13.3.4 The BLOB and TEXT Types">
<code class="literal">
TEXT
</code>
</a>
columns only
contribute 9 to 12 bytes toward the row size.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa70365292"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> t <span class="token punctuation">(</span>a <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">10000</span><span class="token punctuation">)</span><span class="token punctuation">,</span> b <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">10000</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
c <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">10000</span><span class="token punctuation">)</span><span class="token punctuation">,</span> d <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">10000</span><span class="token punctuation">)</span><span class="token punctuation">,</span> e <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">10000</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
f <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">10000</span><span class="token punctuation">)</span><span class="token punctuation">,</span> g <span class="token datatype">TEXT</span><span class="token punctuation">(</span><span class="token number">6000</span><span class="token punctuation">)</span><span class="token punctuation">)</span> <span class="token keyword">ENGINE</span><span class="token operator">=</span>MyISAM <span class="token keyword">CHARACTER</span> <span class="token keyword">SET</span> latin1<span class="token punctuation">;</span>
<span class="token output">Query OK, 0 rows affected (0.02 sec)</span></code></pre>
</div>
<p>
The operation succeeds for an
<code class="literal">
InnoDB
</code>
table because changing a column to
<a class="link" href="blob.html" title="13.3.4 The BLOB and TEXT Types">
<code class="literal">
TEXT
</code>
</a>
avoids the MySQL
65,535-byte row size limit, and
<code class="literal">
InnoDB
</code>
off-page storage of variable-length columns avoids the
<code class="literal">
InnoDB
</code>
row size limit.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa48947448"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> t <span class="token punctuation">(</span>a <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">10000</span><span class="token punctuation">)</span><span class="token punctuation">,</span> b <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">10000</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
c <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">10000</span><span class="token punctuation">)</span><span class="token punctuation">,</span> d <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">10000</span><span class="token punctuation">)</span><span class="token punctuation">,</span> e <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">10000</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
f <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">10000</span><span class="token punctuation">)</span><span class="token punctuation">,</span> g <span class="token datatype">TEXT</span><span class="token punctuation">(</span><span class="token number">6000</span><span class="token punctuation">)</span><span class="token punctuation">)</span> <span class="token keyword">ENGINE</span><span class="token operator">=</span>InnoDB <span class="token keyword">CHARACTER</span> <span class="token keyword">SET</span> latin1<span class="token punctuation">;</span>
<span class="token output">Query OK, 0 rows affected (0.02 sec)</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
Storage for variable-length columns includes length bytes,
which are counted toward the row size. For example, a
<a class="link" href="char.html" title="13.3.2 The CHAR and VARCHAR Types">
<code class="literal">
VARCHAR(255)
CHARACTER SET utf8mb3
</code>
</a>
column takes two bytes to
store the length of the value, so each value can take up
to 767 bytes.
</p>
<p>
The statement to create table
<code class="literal">
t1
</code>
succeeds because the columns require 32,765 + 2 bytes and
32,766 + 2 bytes, which falls within the maximum row size
of 65,535 bytes:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa39838191"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> t1
<span class="token punctuation">(</span>c1 <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">32765</span><span class="token punctuation">)</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span><span class="token punctuation">,</span> c2 <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">32766</span><span class="token punctuation">)</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span><span class="token punctuation">)</span>
<span class="token keyword">ENGINE</span> <span class="token operator">=</span> InnoDB <span class="token keyword">CHARACTER</span> <span class="token keyword">SET</span> latin1<span class="token punctuation">;</span>
<span class="token output">Query OK, 0 rows affected (0.02 sec)</span></code></pre>
</div>
<p>
The statement to create table
<code class="literal">
t2
</code>
fails
because, although the column length is within the maximum
length of 65,535 bytes, two additional bytes are required
to record the length, which causes the row size to exceed
65,535 bytes:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa59029670"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> t2
<span class="token punctuation">(</span>c1 <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">65535</span><span class="token punctuation">)</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span><span class="token punctuation">)</span>
<span class="token keyword">ENGINE</span> <span class="token operator">=</span> InnoDB <span class="token keyword">CHARACTER</span> <span class="token keyword">SET</span> latin1<span class="token punctuation">;</span>
<span class="token output">ERROR 1118 (42000)<span class="token punctuation">:</span> Row size too large. The maximum row size for the used
table type, not counting BLOBs, is 65535. This includes storage overhead,
check the manual. You have to change some columns to TEXT or BLOBs</span></code></pre>
</div>
<p>
Reducing the column length to 65,533 or less permits the
statement to succeed.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa61986750"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> t2
<span class="token punctuation">(</span>c1 <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">65533</span><span class="token punctuation">)</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span><span class="token punctuation">)</span>
<span class="token keyword">ENGINE</span> <span class="token operator">=</span> InnoDB <span class="token keyword">CHARACTER</span> <span class="token keyword">SET</span> latin1<span class="token punctuation">;</span>
<span class="token output">Query OK, 0 rows affected (0.01 sec)</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
For
<a class="link" href="myisam-storage-engine.html" title="18.2 The MyISAM Storage Engine">
<code class="literal">
MyISAM
</code>
</a>
tables,
<code class="literal">
NULL
</code>
columns require additional space
in the row to record whether their values are
<code class="literal">
NULL
</code>
. Each
<code class="literal">
NULL
</code>
column takes one bit extra, rounded up to the nearest
byte.
</p>
<p>
The statement to create table
<code class="literal">
t3
</code>
fails
because
<a class="link" href="myisam-storage-engine.html" title="18.2 The MyISAM Storage Engine">
<code class="literal">
MyISAM
</code>
</a>
requires space
for
<code class="literal">
NULL
</code>
columns in addition to the
space required for variable-length column length bytes,
causing the row size to exceed 65,535 bytes:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa95072317"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> t3
<span class="token punctuation">(</span>c1 <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">32765</span><span class="token punctuation">)</span> <span class="token boolean">NULL</span><span class="token punctuation">,</span> c2 <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">32766</span><span class="token punctuation">)</span> <span class="token boolean">NULL</span><span class="token punctuation">)</span>
<span class="token keyword">ENGINE</span> <span class="token operator">=</span> MyISAM <span class="token keyword">CHARACTER</span> <span class="token keyword">SET</span> latin1<span class="token punctuation">;</span>
<span class="token output">ERROR 1118 (42000)<span class="token punctuation">:</span> Row size too large. The maximum row size for the used
table type, not counting BLOBs, is 65535. This includes storage overhead,
check the manual. You have to change some columns to TEXT or BLOBs</span></code></pre>
</div>
<p>
For information about
<a class="link" href="innodb-storage-engine.html" title="Chapter 17 The InnoDB Storage Engine">
<code class="literal">
InnoDB
</code>
</a>
<code class="literal">
NULL
</code>
column storage, see
<a class="xref" href="innodb-row-format.html" title="17.10 InnoDB Row Formats">
Section 17.10, “InnoDB Row Formats”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
InnoDB
</code>
restricts row size (for data
stored locally within the database page) to slightly less
than half a database page for 4KB, 8KB, 16KB, and 32KB
<a class="link" href="innodb-parameters.html#sysvar_innodb_page_size">
<code class="literal">
innodb_page_size
</code>
</a>
settings, and to slightly less than 16KB for 64KB pages.
</p>
<p>
The statement to create table
<code class="literal">
t4
</code>
fails
because the defined columns exceed the row size limit for
a 16KB
<code class="literal">
InnoDB
</code>
page.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa52425944"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> t4 <span class="token punctuation">(</span>
c1 <span class="token datatype">CHAR</span><span class="token punctuation">(</span><span class="token number">255</span><span class="token punctuation">)</span><span class="token punctuation">,</span>c2 <span class="token datatype">CHAR</span><span class="token punctuation">(</span><span class="token number">255</span><span class="token punctuation">)</span><span class="token punctuation">,</span>c3 <span class="token datatype">CHAR</span><span class="token punctuation">(</span><span class="token number">255</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
c4 <span class="token datatype">CHAR</span><span class="token punctuation">(</span><span class="token number">255</span><span class="token punctuation">)</span><span class="token punctuation">,</span>c5 <span class="token datatype">CHAR</span><span class="token punctuation">(</span><span class="token number">255</span><span class="token punctuation">)</span><span class="token punctuation">,</span>c6 <span class="token datatype">CHAR</span><span class="token punctuation">(</span><span class="token number">255</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
c7 <span class="token datatype">CHAR</span><span class="token punctuation">(</span><span class="token number">255</span><span class="token punctuation">)</span><span class="token punctuation">,</span>c8 <span class="token datatype">CHAR</span><span class="token punctuation">(</span><span class="token number">255</span><span class="token punctuation">)</span><span class="token punctuation">,</span>c9 <span class="token datatype">CHAR</span><span class="token punctuation">(</span><span class="token number">255</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
c10 <span class="token datatype">CHAR</span><span class="token punctuation">(</span><span class="token number">255</span><span class="token punctuation">)</span><span class="token punctuation">,</span>c11 <span class="token datatype">CHAR</span><span class="token punctuation">(</span><span class="token number">255</span><span class="token punctuation">)</span><span class="token punctuation">,</span>c12 <span class="token datatype">CHAR</span><span class="token punctuation">(</span><span class="token number">255</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
c13 <span class="token datatype">CHAR</span><span class="token punctuation">(</span><span class="token number">255</span><span class="token punctuation">)</span><span class="token punctuation">,</span>c14 <span class="token datatype">CHAR</span><span class="token punctuation">(</span><span class="token number">255</span><span class="token punctuation">)</span><span class="token punctuation">,</span>c15 <span class="token datatype">CHAR</span><span class="token punctuation">(</span><span class="token number">255</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
c16 <span class="token datatype">CHAR</span><span class="token punctuation">(</span><span class="token number">255</span><span class="token punctuation">)</span><span class="token punctuation">,</span>c17 <span class="token datatype">CHAR</span><span class="token punctuation">(</span><span class="token number">255</span><span class="token punctuation">)</span><span class="token punctuation">,</span>c18 <span class="token datatype">CHAR</span><span class="token punctuation">(</span><span class="token number">255</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
c19 <span class="token datatype">CHAR</span><span class="token punctuation">(</span><span class="token number">255</span><span class="token punctuation">)</span><span class="token punctuation">,</span>c20 <span class="token datatype">CHAR</span><span class="token punctuation">(</span><span class="token number">255</span><span class="token punctuation">)</span><span class="token punctuation">,</span>c21 <span class="token datatype">CHAR</span><span class="token punctuation">(</span><span class="token number">255</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
c22 <span class="token datatype">CHAR</span><span class="token punctuation">(</span><span class="token number">255</span><span class="token punctuation">)</span><span class="token punctuation">,</span>c23 <span class="token datatype">CHAR</span><span class="token punctuation">(</span><span class="token number">255</span><span class="token punctuation">)</span><span class="token punctuation">,</span>c24 <span class="token datatype">CHAR</span><span class="token punctuation">(</span><span class="token number">255</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
c25 <span class="token datatype">CHAR</span><span class="token punctuation">(</span><span class="token number">255</span><span class="token punctuation">)</span><span class="token punctuation">,</span>c26 <span class="token datatype">CHAR</span><span class="token punctuation">(</span><span class="token number">255</span><span class="token punctuation">)</span><span class="token punctuation">,</span>c27 <span class="token datatype">CHAR</span><span class="token punctuation">(</span><span class="token number">255</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
c28 <span class="token datatype">CHAR</span><span class="token punctuation">(</span><span class="token number">255</span><span class="token punctuation">)</span><span class="token punctuation">,</span>c29 <span class="token datatype">CHAR</span><span class="token punctuation">(</span><span class="token number">255</span><span class="token punctuation">)</span><span class="token punctuation">,</span>c30 <span class="token datatype">CHAR</span><span class="token punctuation">(</span><span class="token number">255</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
c31 <span class="token datatype">CHAR</span><span class="token punctuation">(</span><span class="token number">255</span><span class="token punctuation">)</span><span class="token punctuation">,</span>c32 <span class="token datatype">CHAR</span><span class="token punctuation">(</span><span class="token number">255</span><span class="token punctuation">)</span><span class="token punctuation">,</span>c33 <span class="token datatype">CHAR</span><span class="token punctuation">(</span><span class="token number">255</span><span class="token punctuation">)</span>
<span class="token punctuation">)</span> <span class="token keyword">ENGINE</span><span class="token operator">=</span>InnoDB <span class="token keyword">ROW_FORMAT</span><span class="token operator">=</span><span class="token keyword">DYNAMIC</span> <span class="token keyword">DEFAULT</span> <span class="token keyword">CHARSET</span> latin1<span class="token punctuation">;</span>
<span class="token output">ERROR 1118 (42000)<span class="token punctuation">:</span> Row size too large (> 8126). Changing some columns to TEXT or BLOB may help.
In current row format, BLOB prefix of 0 bytes is stored inline.</span></code></pre>
</div>
</li>
</ul>
</div>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/date-calculations.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="date-calculations">
</a>
5.3.4.5 Date Calculations
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045325190144">
</a>
<a class="indexterm" name="idm46045325189072">
</a>
<a class="indexterm" name="idm46045325187584">
</a>
<a class="indexterm" name="idm46045325186096">
</a>
<p>
MySQL provides several functions that you can use to perform
calculations on dates, for example, to calculate ages or
extract parts of dates.
</p>
<p>
To determine how many years old each of your pets is, use the
<a class="link" href="date-and-time-functions.html#function_timestampdiff">
<code class="literal">
TIMESTAMPDIFF()
</code>
</a>
function. Its
arguments are the unit in which you want the result expressed,
and the two dates for which to take the difference. The
following query shows, for each pet, the birth date, the
current date, and the age in years. An
<span class="emphasis">
<em>
alias
</em>
</span>
(
<code class="literal">
age
</code>
) is used to
make the final output column label more meaningful.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa26924748"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token keyword">name</span><span class="token punctuation">,</span> birth<span class="token punctuation">,</span> <span class="token function">CURDATE</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token function">TIMESTAMPDIFF</span><span class="token punctuation">(</span><span class="token datatype">YEAR</span><span class="token punctuation">,</span>birth<span class="token punctuation">,</span><span class="token function">CURDATE</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span> <span class="token keyword">AS</span> age
<span class="token keyword">FROM</span> pet<span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> name <span class="token punctuation">|</span> birth <span class="token punctuation">|</span> CURDATE() <span class="token punctuation">|</span> age <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> Fluffy <span class="token punctuation">|</span> 1993<span class="token punctuation">-</span>02<span class="token punctuation">-</span>04 <span class="token punctuation">|</span> 2003<span class="token punctuation">-</span>08<span class="token punctuation">-</span>19 <span class="token punctuation">|</span> 10 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Claws <span class="token punctuation">|</span> 1994<span class="token punctuation">-</span>03<span class="token punctuation">-</span>17 <span class="token punctuation">|</span> 2003<span class="token punctuation">-</span>08<span class="token punctuation">-</span>19 <span class="token punctuation">|</span> 9 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Buffy <span class="token punctuation">|</span> 1989<span class="token punctuation">-</span>05<span class="token punctuation">-</span>13 <span class="token punctuation">|</span> 2003<span class="token punctuation">-</span>08<span class="token punctuation">-</span>19 <span class="token punctuation">|</span> 14 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Fang <span class="token punctuation">|</span> 1990<span class="token punctuation">-</span>08<span class="token punctuation">-</span>27 <span class="token punctuation">|</span> 2003<span class="token punctuation">-</span>08<span class="token punctuation">-</span>19 <span class="token punctuation">|</span> 12 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Bowser <span class="token punctuation">|</span> 1989<span class="token punctuation">-</span>08<span class="token punctuation">-</span>31 <span class="token punctuation">|</span> 2003<span class="token punctuation">-</span>08<span class="token punctuation">-</span>19 <span class="token punctuation">|</span> 13 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Chirpy <span class="token punctuation">|</span> 1998<span class="token punctuation">-</span>09<span class="token punctuation">-</span>11 <span class="token punctuation">|</span> 2003<span class="token punctuation">-</span>08<span class="token punctuation">-</span>19 <span class="token punctuation">|</span> 4 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Whistler <span class="token punctuation">|</span> 1997<span class="token punctuation">-</span>12<span class="token punctuation">-</span>09 <span class="token punctuation">|</span> 2003<span class="token punctuation">-</span>08<span class="token punctuation">-</span>19 <span class="token punctuation">|</span> 5 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Slim <span class="token punctuation">|</span> 1996<span class="token punctuation">-</span>04<span class="token punctuation">-</span>29 <span class="token punctuation">|</span> 2003<span class="token punctuation">-</span>08<span class="token punctuation">-</span>19 <span class="token punctuation">|</span> 7 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Puffball <span class="token punctuation">|</span> 1999<span class="token punctuation">-</span>03<span class="token punctuation">-</span>30 <span class="token punctuation">|</span> 2003<span class="token punctuation">-</span>08<span class="token punctuation">-</span>19 <span class="token punctuation">|</span> 4 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
<p>
The query works, but the result could be scanned more easily
if the rows were presented in some order. This can be done by
adding an
<code class="literal">
ORDER BY name
</code>
clause to sort the
output by name:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa10088138"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token keyword">name</span><span class="token punctuation">,</span> birth<span class="token punctuation">,</span> <span class="token function">CURDATE</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token function">TIMESTAMPDIFF</span><span class="token punctuation">(</span><span class="token datatype">YEAR</span><span class="token punctuation">,</span>birth<span class="token punctuation">,</span><span class="token function">CURDATE</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span> <span class="token keyword">AS</span> age
<span class="token keyword">FROM</span> pet <span class="token keyword">ORDER</span> <span class="token keyword">BY</span> <span class="token keyword">name</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> name <span class="token punctuation">|</span> birth <span class="token punctuation">|</span> CURDATE() <span class="token punctuation">|</span> age <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> Bowser <span class="token punctuation">|</span> 1989<span class="token punctuation">-</span>08<span class="token punctuation">-</span>31 <span class="token punctuation">|</span> 2003<span class="token punctuation">-</span>08<span class="token punctuation">-</span>19 <span class="token punctuation">|</span> 13 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Buffy <span class="token punctuation">|</span> 1989<span class="token punctuation">-</span>05<span class="token punctuation">-</span>13 <span class="token punctuation">|</span> 2003<span class="token punctuation">-</span>08<span class="token punctuation">-</span>19 <span class="token punctuation">|</span> 14 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Chirpy <span class="token punctuation">|</span> 1998<span class="token punctuation">-</span>09<span class="token punctuation">-</span>11 <span class="token punctuation">|</span> 2003<span class="token punctuation">-</span>08<span class="token punctuation">-</span>19 <span class="token punctuation">|</span> 4 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Claws <span class="token punctuation">|</span> 1994<span class="token punctuation">-</span>03<span class="token punctuation">-</span>17 <span class="token punctuation">|</span> 2003<span class="token punctuation">-</span>08<span class="token punctuation">-</span>19 <span class="token punctuation">|</span> 9 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Fang <span class="token punctuation">|</span> 1990<span class="token punctuation">-</span>08<span class="token punctuation">-</span>27 <span class="token punctuation">|</span> 2003<span class="token punctuation">-</span>08<span class="token punctuation">-</span>19 <span class="token punctuation">|</span> 12 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Fluffy <span class="token punctuation">|</span> 1993<span class="token punctuation">-</span>02<span class="token punctuation">-</span>04 <span class="token punctuation">|</span> 2003<span class="token punctuation">-</span>08<span class="token punctuation">-</span>19 <span class="token punctuation">|</span> 10 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Puffball <span class="token punctuation">|</span> 1999<span class="token punctuation">-</span>03<span class="token punctuation">-</span>30 <span class="token punctuation">|</span> 2003<span class="token punctuation">-</span>08<span class="token punctuation">-</span>19 <span class="token punctuation">|</span> 4 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Slim <span class="token punctuation">|</span> 1996<span class="token punctuation">-</span>04<span class="token punctuation">-</span>29 <span class="token punctuation">|</span> 2003<span class="token punctuation">-</span>08<span class="token punctuation">-</span>19 <span class="token punctuation">|</span> 7 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Whistler <span class="token punctuation">|</span> 1997<span class="token punctuation">-</span>12<span class="token punctuation">-</span>09 <span class="token punctuation">|</span> 2003<span class="token punctuation">-</span>08<span class="token punctuation">-</span>19 <span class="token punctuation">|</span> 5 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
<p>
To sort the output by
<code class="literal">
age
</code>
rather than
<code class="literal">
name
</code>
, just use a different
<code class="literal">
ORDER
BY
</code>
clause:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa27967240"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token keyword">name</span><span class="token punctuation">,</span> birth<span class="token punctuation">,</span> <span class="token function">CURDATE</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token function">TIMESTAMPDIFF</span><span class="token punctuation">(</span><span class="token datatype">YEAR</span><span class="token punctuation">,</span>birth<span class="token punctuation">,</span><span class="token function">CURDATE</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span> <span class="token keyword">AS</span> age
<span class="token keyword">FROM</span> pet <span class="token keyword">ORDER</span> <span class="token keyword">BY</span> age<span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> name <span class="token punctuation">|</span> birth <span class="token punctuation">|</span> CURDATE() <span class="token punctuation">|</span> age <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> Chirpy <span class="token punctuation">|</span> 1998<span class="token punctuation">-</span>09<span class="token punctuation">-</span>11 <span class="token punctuation">|</span> 2003<span class="token punctuation">-</span>08<span class="token punctuation">-</span>19 <span class="token punctuation">|</span> 4 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Puffball <span class="token punctuation">|</span> 1999<span class="token punctuation">-</span>03<span class="token punctuation">-</span>30 <span class="token punctuation">|</span> 2003<span class="token punctuation">-</span>08<span class="token punctuation">-</span>19 <span class="token punctuation">|</span> 4 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Whistler <span class="token punctuation">|</span> 1997<span class="token punctuation">-</span>12<span class="token punctuation">-</span>09 <span class="token punctuation">|</span> 2003<span class="token punctuation">-</span>08<span class="token punctuation">-</span>19 <span class="token punctuation">|</span> 5 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Slim <span class="token punctuation">|</span> 1996<span class="token punctuation">-</span>04<span class="token punctuation">-</span>29 <span class="token punctuation">|</span> 2003<span class="token punctuation">-</span>08<span class="token punctuation">-</span>19 <span class="token punctuation">|</span> 7 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Claws <span class="token punctuation">|</span> 1994<span class="token punctuation">-</span>03<span class="token punctuation">-</span>17 <span class="token punctuation">|</span> 2003<span class="token punctuation">-</span>08<span class="token punctuation">-</span>19 <span class="token punctuation">|</span> 9 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Fluffy <span class="token punctuation">|</span> 1993<span class="token punctuation">-</span>02<span class="token punctuation">-</span>04 <span class="token punctuation">|</span> 2003<span class="token punctuation">-</span>08<span class="token punctuation">-</span>19 <span class="token punctuation">|</span> 10 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Fang <span class="token punctuation">|</span> 1990<span class="token punctuation">-</span>08<span class="token punctuation">-</span>27 <span class="token punctuation">|</span> 2003<span class="token punctuation">-</span>08<span class="token punctuation">-</span>19 <span class="token punctuation">|</span> 12 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Bowser <span class="token punctuation">|</span> 1989<span class="token punctuation">-</span>08<span class="token punctuation">-</span>31 <span class="token punctuation">|</span> 2003<span class="token punctuation">-</span>08<span class="token punctuation">-</span>19 <span class="token punctuation">|</span> 13 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Buffy <span class="token punctuation">|</span> 1989<span class="token punctuation">-</span>05<span class="token punctuation">-</span>13 <span class="token punctuation">|</span> 2003<span class="token punctuation">-</span>08<span class="token punctuation">-</span>19 <span class="token punctuation">|</span> 14 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
<p>
A similar query can be used to determine age at death for
animals that have died. You determine which animals these are
by checking whether the
<code class="literal">
death
</code>
value is
<code class="literal">
NULL
</code>
. Then, for those with
non-
<code class="literal">
NULL
</code>
values, compute the difference
between the
<code class="literal">
death
</code>
and
<code class="literal">
birth
</code>
values:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa52403723"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token keyword">name</span><span class="token punctuation">,</span> birth<span class="token punctuation">,</span> death<span class="token punctuation">,</span>
<span class="token function">TIMESTAMPDIFF</span><span class="token punctuation">(</span><span class="token datatype">YEAR</span><span class="token punctuation">,</span>birth<span class="token punctuation">,</span>death<span class="token punctuation">)</span> <span class="token keyword">AS</span> age
<span class="token keyword">FROM</span> pet <span class="token keyword">WHERE</span> death <span class="token operator">IS</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span> <span class="token keyword">ORDER</span> <span class="token keyword">BY</span> age<span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> name <span class="token punctuation">|</span> birth <span class="token punctuation">|</span> death <span class="token punctuation">|</span> age <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> Bowser <span class="token punctuation">|</span> 1989<span class="token punctuation">-</span>08<span class="token punctuation">-</span>31 <span class="token punctuation">|</span> 1995<span class="token punctuation">-</span>07<span class="token punctuation">-</span>29 <span class="token punctuation">|</span> 5 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
<p>
The query uses
<code class="literal">
death IS NOT NULL
</code>
rather
than
<code class="literal">
death <> NULL
</code>
because
<code class="literal">
NULL
</code>
is a special value that cannot be
compared using the usual comparison operators. This is
discussed later. See
<a class="xref" href="working-with-null.html" title="5.3.4.6 Working with NULL Values">
Section 5.3.4.6, “Working with NULL Values”
</a>
.
</p>
<p>
What if you want to know which animals have birthdays next
month? For this type of calculation, year and day are
irrelevant; you simply want to extract the month part of the
<code class="literal">
birth
</code>
column. MySQL provides several
functions for extracting parts of dates, such as
<a class="link" href="date-and-time-functions.html#function_year">
<code class="literal">
YEAR()
</code>
</a>
,
<a class="link" href="date-and-time-functions.html#function_month">
<code class="literal">
MONTH()
</code>
</a>
, and
<a class="link" href="date-and-time-functions.html#function_dayofmonth">
<code class="literal">
DAYOFMONTH()
</code>
</a>
.
<a class="link" href="date-and-time-functions.html#function_month">
<code class="literal">
MONTH()
</code>
</a>
is the appropriate
function here. To see how it works, run a simple query that
displays the value of both
<code class="literal">
birth
</code>
and
<a class="link" href="date-and-time-functions.html#function_month">
<code class="literal">
MONTH(birth)
</code>
</a>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa37011226"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token keyword">name</span><span class="token punctuation">,</span> birth<span class="token punctuation">,</span> <span class="token function">MONTH</span><span class="token punctuation">(</span>birth<span class="token punctuation">)</span> <span class="token keyword">FROM</span> pet<span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> name <span class="token punctuation">|</span> birth <span class="token punctuation">|</span> MONTH(birth) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> Fluffy <span class="token punctuation">|</span> 1993<span class="token punctuation">-</span>02<span class="token punctuation">-</span>04 <span class="token punctuation">|</span> 2 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Claws <span class="token punctuation">|</span> 1994<span class="token punctuation">-</span>03<span class="token punctuation">-</span>17 <span class="token punctuation">|</span> 3 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Buffy <span class="token punctuation">|</span> 1989<span class="token punctuation">-</span>05<span class="token punctuation">-</span>13 <span class="token punctuation">|</span> 5 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Fang <span class="token punctuation">|</span> 1990<span class="token punctuation">-</span>08<span class="token punctuation">-</span>27 <span class="token punctuation">|</span> 8 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Bowser <span class="token punctuation">|</span> 1989<span class="token punctuation">-</span>08<span class="token punctuation">-</span>31 <span class="token punctuation">|</span> 8 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Chirpy <span class="token punctuation">|</span> 1998<span class="token punctuation">-</span>09<span class="token punctuation">-</span>11 <span class="token punctuation">|</span> 9 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Whistler <span class="token punctuation">|</span> 1997<span class="token punctuation">-</span>12<span class="token punctuation">-</span>09 <span class="token punctuation">|</span> 12 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Slim <span class="token punctuation">|</span> 1996<span class="token punctuation">-</span>04<span class="token punctuation">-</span>29 <span class="token punctuation">|</span> 4 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Puffball <span class="token punctuation">|</span> 1999<span class="token punctuation">-</span>03<span class="token punctuation">-</span>30 <span class="token punctuation">|</span> 3 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
<p>
Finding animals with birthdays in the upcoming month is also
simple. Suppose that the current month is April. Then the
month value is
<code class="literal">
4
</code>
and you can look for
animals born in May (month
<code class="literal">
5
</code>
) like this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa97150340"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token keyword">name</span><span class="token punctuation">,</span> birth <span class="token keyword">FROM</span> pet <span class="token keyword">WHERE</span> <span class="token function">MONTH</span><span class="token punctuation">(</span>birth<span class="token punctuation">)</span> <span class="token operator">=</span> <span class="token number">5</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> name <span class="token punctuation">|</span> birth <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> Buffy <span class="token punctuation">|</span> 1989<span class="token punctuation">-</span>05<span class="token punctuation">-</span>13 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
<p>
There is a small complication if the current month is
December. You cannot merely add one to the month number
(
<code class="literal">
12
</code>
) and look for animals born in month
<code class="literal">
13
</code>
, because there is no such month.
Instead, you look for animals born in January (month
<code class="literal">
1
</code>
).
</p>
<p>
You can write the query so that it works no matter what the
current month is, so that you do not have to use the number
for a particular month.
<a class="link" href="date-and-time-functions.html#function_date-add">
<code class="literal">
DATE_ADD()
</code>
</a>
enables you to add a
time interval to a given date. If you add a month to the value
of
<a class="link" href="date-and-time-functions.html#function_curdate">
<code class="literal">
CURDATE()
</code>
</a>
, then extract the
month part with
<a class="link" href="date-and-time-functions.html#function_month">
<code class="literal">
MONTH()
</code>
</a>
, the
result produces the month in which to look for birthdays:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa49557792"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token keyword">name</span><span class="token punctuation">,</span> birth <span class="token keyword">FROM</span> pet
<span class="token keyword">WHERE</span> <span class="token function">MONTH</span><span class="token punctuation">(</span>birth<span class="token punctuation">)</span> <span class="token operator">=</span> <span class="token function">MONTH</span><span class="token punctuation">(</span><span class="token function">DATE_ADD</span><span class="token punctuation">(</span><span class="token function">CURDATE</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">,</span><span class="token keyword">INTERVAL</span> <span class="token number">1</span> <span class="token keyword">MONTH</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
A different way to accomplish the same task is to add
<code class="literal">
1
</code>
to get the next month after the current
one after using the modulo function (
<code class="literal">
MOD
</code>
)
to wrap the month value to
<code class="literal">
0
</code>
if it is
currently
<code class="literal">
12
</code>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa15928194"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token keyword">name</span><span class="token punctuation">,</span> birth <span class="token keyword">FROM</span> pet
<span class="token keyword">WHERE</span> <span class="token function">MONTH</span><span class="token punctuation">(</span>birth<span class="token punctuation">)</span> <span class="token operator">=</span> <span class="token function">MOD</span><span class="token punctuation">(</span><span class="token function">MONTH</span><span class="token punctuation">(</span><span class="token function">CURDATE</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token number">12</span><span class="token punctuation">)</span> <span class="token operator">+</span> <span class="token number">1</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
<a class="link" href="date-and-time-functions.html#function_month">
<code class="literal">
MONTH()
</code>
</a>
returns a number
between
<code class="literal">
1
</code>
and
<code class="literal">
12
</code>
. And
<a class="link" href="mathematical-functions.html#function_mod">
<code class="literal">
MOD(something,12)
</code>
</a>
returns a
number between
<code class="literal">
0
</code>
and
<code class="literal">
11
</code>
.
So the addition has to be after the
<a class="link" href="mathematical-functions.html#function_mod">
<code class="literal">
MOD()
</code>
</a>
, otherwise we would go
from November (
<code class="literal">
11
</code>
) to January
(
<code class="literal">
1
</code>
).
</p>
<p>
If a calculation uses invalid dates, the calculation fails and
produces warnings:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa98994132"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token string">'2018-10-31'</span> <span class="token operator">+</span> <span class="token keyword">INTERVAL</span> <span class="token number">1</span> <span class="token keyword">DAY</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> '2018<span class="token punctuation">-</span>10<span class="token punctuation">-</span>31' <span class="token punctuation">+</span> INTERVAL 1 DAY <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 2018<span class="token punctuation">-</span>11<span class="token punctuation">-</span>01 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token string">'2018-10-32'</span> <span class="token operator">+</span> <span class="token keyword">INTERVAL</span> <span class="token number">1</span> <span class="token keyword">DAY</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> '2018<span class="token punctuation">-</span>10<span class="token punctuation">-</span>32' <span class="token punctuation">+</span> INTERVAL 1 DAY <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> NULL <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token prompt">mysql></span> <span class="token keyword">SHOW</span> <span class="token keyword">WARNINGS</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> Level <span class="token punctuation">|</span> Code <span class="token punctuation">|</span> Message <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> Warning <span class="token punctuation">|</span> 1292 <span class="token punctuation">|</span> Incorrect datetime value: '2018<span class="token punctuation">-</span>10<span class="token punctuation">-</span>32' <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/ldml-collation-example.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="ldml-collation-example">
</a>
12.14.4.1 Defining a UCA Collation Using LDML Syntax
</h4>
</div>
</div>
</div>
<p>
To add a UCA collation for a Unicode character set without
recompiling MySQL, use the following procedure. If you are
unfamiliar with the LDML rules used to describe the
collation's sort characteristics, see
<a class="xref" href="ldml-rules.html" title="12.14.4.2 LDML Syntax Supported in MySQL">
Section 12.14.4.2, “LDML Syntax Supported in MySQL”
</a>
.
</p>
<p>
The example adds a collation named
<code class="literal">
utf8mb4_phone_ci
</code>
to the
<code class="literal">
utf8mb4
</code>
character set. The collation is
designed for a scenario involving a Web application for which
users post their names and phone numbers. Phone numbers can be
given in very different formats:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-none"><div class="docs-select-all right" id="sa65265715"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-none">+7-12345-67
+7-12-345-67
+7 12 345 67
+7 (12) 345 67
+71234567</code></pre>
</div>
<p>
The problem raised by dealing with these kinds of values is
that the varying permissible formats make searching for a
specific phone number very difficult. The solution is to
define a new collation that reorders punctuation characters,
making them ignorable.
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
Choose a collation ID, as shown in
<a class="xref" href="adding-collation-choosing-id.html" title="12.14.2 Choosing a Collation ID">
Section 12.14.2, “Choosing a Collation ID”
</a>
. The
following steps use an ID of 1029.
</p>
</li>
<li class="listitem">
<p>
To modify the
<code class="literal">
Index.xml
</code>
configuration
file. This file is located in the directory named by the
<a class="link" href="server-system-variables.html#sysvar_character_sets_dir">
<code class="literal">
character_sets_dir
</code>
</a>
system
variable. You can check the variable value as follows,
although the path name might be different on your system:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa71148245"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SHOW</span> <span class="token keyword">VARIABLES</span> <span class="token operator">LIKE</span> <span class="token string">'character_sets_dir'</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> Variable_name <span class="token punctuation">|</span> Value <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> character_sets_dir <span class="token punctuation">|</span> /user/local/mysql/share/mysql/charsets/ <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
</li>
<li class="listitem">
<p>
Choose a name for the collation and list it in the
<code class="filename">
Index.xml
</code>
file. In addition, you must
provide the collation ordering rules. Find the
<code class="literal">
<charset>
</code>
element for the
character set to which the collation is being added, and
add a
<code class="literal">
<collation>
</code>
element that
indicates the collation name and ID, to associate the name
with the ID. Within the
<code class="literal">
<collation>
</code>
element, provide a
<code class="literal">
<rules>
</code>
element containing the
ordering rules:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-xml"><div class="docs-select-all right" id="sa99791741"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-xml"><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>charset</span> <span class="token attr-name">name</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>utf8mb4<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>
...
<span class="token tag"><span class="token tag"><span class="token punctuation"><</span>collation</span> <span class="token attr-name">name</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>utf8mb4_phone_ci<span class="token punctuation">"</span></span> <span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>1029<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation"><</span>rules</span><span class="token punctuation">></span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation"><</span>reset</span><span class="token punctuation">></span></span>\u0000<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>reset</span><span class="token punctuation">></span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation"><</span>i</span><span class="token punctuation">></span></span>\u0020<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>i</span><span class="token punctuation">></span></span> <span class="token comment" spellcheck="true"><!-- space --></span>
<span class="token tag"><span class="token tag"><span class="token punctuation"><</span>i</span><span class="token punctuation">></span></span>\u0028<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>i</span><span class="token punctuation">></span></span> <span class="token comment" spellcheck="true"><!-- left parenthesis --></span>
<span class="token tag"><span class="token tag"><span class="token punctuation"><</span>i</span><span class="token punctuation">></span></span>\u0029<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>i</span><span class="token punctuation">></span></span> <span class="token comment" spellcheck="true"><!-- right parenthesis --></span>
<span class="token tag"><span class="token tag"><span class="token punctuation"><</span>i</span><span class="token punctuation">></span></span>\u002B<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>i</span><span class="token punctuation">></span></span> <span class="token comment" spellcheck="true"><!-- plus --></span>
<span class="token tag"><span class="token tag"><span class="token punctuation"><</span>i</span><span class="token punctuation">></span></span>\u002D<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>i</span><span class="token punctuation">></span></span> <span class="token comment" spellcheck="true"><!-- hyphen --></span>
<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>rules</span><span class="token punctuation">></span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>collation</span><span class="token punctuation">></span></span>
...
<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>charset</span><span class="token punctuation">></span></span></code></pre>
</div>
</li>
<li class="listitem">
<p>
If you want a similar collation for other Unicode
character sets, add other
<code class="literal">
<collation>
</code>
elements. For
example, to define
<code class="literal">
ucs2_phone_ci
</code>
, add a
<code class="literal">
<collation>
</code>
element to the
<code class="literal">
<charset name="ucs2">
</code>
element.
Remember that each collation must have its own unique ID.
</p>
</li>
<li class="listitem">
<p>
Restart the server and use this statement to verify that
the collation is present:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa50441835"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SHOW</span> <span class="token keyword">COLLATION</span> <span class="token keyword">WHERE</span> <span class="token keyword">Collation</span> <span class="token operator">=</span> <span class="token string">'utf8mb4_phone_ci'</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> Collation <span class="token punctuation">|</span> Charset <span class="token punctuation">|</span> Id <span class="token punctuation">|</span> Default <span class="token punctuation">|</span> Compiled <span class="token punctuation">|</span> Sortlen <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> utf8mb4_phone_ci <span class="token punctuation">|</span> utf8mb4 <span class="token punctuation">|</span> 1029 <span class="token punctuation">|</span> <span class="token punctuation">|</span> <span class="token punctuation">|</span> 8 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
</li>
</ol>
</div>
<p>
Now test the collation to make sure that it has the desired
properties.
</p>
<p>
Create a table containing some sample phone numbers using the
new collation:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa94016225"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> phonebook <span class="token punctuation">(</span>
<span class="token keyword">name</span> <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">64</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
phone <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">64</span><span class="token punctuation">)</span> <span class="token keyword">CHARACTER</span> <span class="token keyword">SET</span> utf8mb4 <span class="token keyword">COLLATE</span> utf8mb4_phone_ci
<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 0 rows affected (0.09 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">INSERT</span> <span class="token keyword">INTO</span> phonebook <span class="token keyword">VALUES</span> <span class="token punctuation">(</span><span class="token string">'Svoj'</span><span class="token punctuation">,</span><span class="token string">'+7 912 800 80 02'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 1 row affected (0.00 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">INSERT</span> <span class="token keyword">INTO</span> phonebook <span class="token keyword">VALUES</span> <span class="token punctuation">(</span><span class="token string">'Hf'</span><span class="token punctuation">,</span><span class="token string">'+7 (912) 800 80 04'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 1 row affected (0.00 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">INSERT</span> <span class="token keyword">INTO</span> phonebook <span class="token keyword">VALUES</span> <span class="token punctuation">(</span><span class="token string">'Bar'</span><span class="token punctuation">,</span><span class="token string">'+7-912-800-80-01'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 1 row affected (0.00 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">INSERT</span> <span class="token keyword">INTO</span> phonebook <span class="token keyword">VALUES</span> <span class="token punctuation">(</span><span class="token string">'Ramil'</span><span class="token punctuation">,</span><span class="token string">'(7912) 800 80 03'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 1 row affected (0.00 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">INSERT</span> <span class="token keyword">INTO</span> phonebook <span class="token keyword">VALUES</span> <span class="token punctuation">(</span><span class="token string">'Sanja'</span><span class="token punctuation">,</span><span class="token string">'+380 (912) 8008005'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 1 row affected (0.00 sec)</span></code></pre>
</div>
<p>
Run some queries to see whether the ignored punctuation
characters are in fact ignored for comparison and sorting:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa8997779"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> phonebook <span class="token keyword">ORDER</span> <span class="token keyword">BY</span> phone<span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> name <span class="token punctuation">|</span> phone <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> Sanja <span class="token punctuation">|</span> <span class="token punctuation">+</span>380 (912) 8008005 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Bar <span class="token punctuation">|</span> <span class="token punctuation">+</span>7<span class="token punctuation">-</span>912<span class="token punctuation">-</span>800<span class="token punctuation">-</span>80<span class="token punctuation">-</span>01 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Svoj <span class="token punctuation">|</span> <span class="token punctuation">+</span>7 912 800 80 02 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Ramil <span class="token punctuation">|</span> (7912) 800 80 03 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Hf <span class="token punctuation">|</span> <span class="token punctuation">+</span>7 (912) 800 80 04 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output">5 rows in set (0.00 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> phonebook <span class="token keyword">WHERE</span> phone<span class="token operator">=</span><span class="token string">'+7(912)800-80-01'</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> name <span class="token punctuation">|</span> phone <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> Bar <span class="token punctuation">|</span> <span class="token punctuation">+</span>7<span class="token punctuation">-</span>912<span class="token punctuation">-</span>800<span class="token punctuation">-</span>80<span class="token punctuation">-</span>01 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output">1 row in set (0.00 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> phonebook <span class="token keyword">WHERE</span> phone<span class="token operator">=</span><span class="token string">'79128008001'</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> name <span class="token punctuation">|</span> phone <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> Bar <span class="token punctuation">|</span> <span class="token punctuation">+</span>7<span class="token punctuation">-</span>912<span class="token punctuation">-</span>800<span class="token punctuation">-</span>80<span class="token punctuation">-</span>01 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output">1 row in set (0.00 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> phonebook <span class="token keyword">WHERE</span> phone<span class="token operator">=</span><span class="token string">'7 9 1 2 8 0 0 8 0 0 1'</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> name <span class="token punctuation">|</span> phone <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> Bar <span class="token punctuation">|</span> <span class="token punctuation">+</span>7<span class="token punctuation">-</span>912<span class="token punctuation">-</span>800<span class="token punctuation">-</span>80<span class="token punctuation">-</span>01 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output">1 row in set (0.00 sec)</span></code></pre>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/mysql-server-side-help.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="mysql-server-side-help">
</a>
6.5.1.4 mysql Client Server-Side Help
</h4>
</div>
</div>
</div>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-none"><div class="docs-select-all right" id="sa22003661"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-none">mysql> help <em class="replaceable">search_string</em></code></pre>
</div>
<p>
If you provide an argument to the
<code class="literal">
help
</code>
command,
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
uses it as a search string to
access server-side help from the contents of the MySQL Reference
Manual. The proper operation of this command requires that the
help tables in the
<code class="literal">
mysql
</code>
database be
initialized with help topic information (see
<a class="xref" href="server-side-help-support.html" title="7.1.17 Server-Side Help Support">
Section 7.1.17, “Server-Side Help Support”
</a>
).
</p>
<p>
If there is no match for the search string, the search fails:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-none"><div class="docs-select-all right" id="sa34782381"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-none">mysql> help me
Nothing found
Please try to run 'help contents' for a list of all accessible topics</code></pre>
</div>
<p>
Use
<a class="link" href="help.html" title="15.8.3 HELP Statement">
<span class="command">
<strong>
help contents
</strong>
</span>
</a>
to see a list of the help
categories:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-none"><div class="docs-select-all right" id="sa85748789"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-none">mysql> help contents
You asked for help about help category: "Contents"
For more information, type 'help <item>', where <item> is one of the
following categories:
Account Management
Administration
Data Definition
Data Manipulation
Data Types
Functions
Functions and Modifiers for Use with GROUP BY
Geographic Features
Language Structure
Plugins
Storage Engines
Stored Routines
Table Maintenance
Transactions
Triggers</code></pre>
</div>
<p>
If the search string matches multiple items,
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
shows a list of matching topics:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-none"><div class="docs-select-all right" id="sa48356450"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-none">mysql> help logs
Many help items for your request exist.
To make a more specific request, please type 'help <item>',
where <item> is one of the following topics:
SHOW
SHOW BINARY LOGS
SHOW ENGINE
SHOW LOGS</code></pre>
</div>
<p>
Use a topic as the search string to see the help entry for that
topic:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-none"><div class="docs-select-all right" id="sa99101358"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-none">mysql> help show binary logs
Name: 'SHOW BINARY LOGS'
Description:
Syntax:
SHOW BINARY LOGS
Lists the binary log files on the server. This statement is used as
part of the procedure described in [purge-binary-logs], that shows how
to determine which logs can be purged.</code></pre>
</div>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa55659438"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SHOW</span> <span class="token datatype">BINARY</span> <span class="token keyword">LOGS</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> Log_name <span class="token punctuation">|</span> File_size <span class="token punctuation">|</span> Encrypted <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> binlog.000015 <span class="token punctuation">|</span> 724935 <span class="token punctuation">|</span> Yes <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> binlog.000016 <span class="token punctuation">|</span> 733481 <span class="token punctuation">|</span> Yes <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
<p>
The search string can contain the wildcard characters
<code class="literal">
%
</code>
and
<code class="literal">
_
</code>
. These have the
same meaning as for pattern-matching operations performed with
the
<a class="link" href="string-comparison-functions.html#operator_like">
<code class="literal">
LIKE
</code>
</a>
operator. For example,
<code class="literal">
HELP rep%
</code>
returns a list of topics that begin
with
<code class="literal">
rep
</code>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-none"><div class="docs-select-all right" id="sa60192382"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-none">mysql> HELP rep%
Many help items for your request exist.
To make a more specific request, please type 'help <item>',
where <item> is one of the following
topics:
REPAIR TABLE
REPEAT FUNCTION
REPEAT LOOP
REPLACE
REPLACE FUNCTION</code></pre>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/mysql-cluster-ndbinfo-index-stats.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="mysql-cluster-ndbinfo-index-stats">
</a>
25.6.17.41 The ndbinfo index_stats Table
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045089102352">
</a>
<p>
The
<code class="literal">
index_stats
</code>
table provides basic
information about
<code class="literal">
NDB
</code>
index statistics.
</p>
<p>
More complete index statistics information can be obtained using
the
<a class="link" href="mysql-cluster-programs-ndb-index-stat.html" title="25.5.14 ndb_index_stat — NDB Index Statistics Utility">
<span class="command">
<strong>
ndb_index_stat
</strong>
</span>
</a>
utility.
</p>
<p>
The
<code class="literal">
index_stats
</code>
table contains the following
columns:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
index_id
</code>
</p>
<p>
Index ID
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
index_version
</code>
</p>
<p>
Index version
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
sample_version
</code>
</p>
<p>
Sample version
</p>
</li>
</ul>
</div>
<h5>
<a name="idm46045089090032">
</a>
Notes
</h5>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/performance-schema-replication-asynchronous-connection-failover-managed-table.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="performance-schema-replication-asynchronous-connection-failover-managed-table">
</a>
29.12.11.9 The replication_asynchronous_connection_failover_managed Table
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045071179632">
</a>
<a class="indexterm" name="idm46045071178112">
</a>
<p>
This table holds configuration information used by the
replica's asynchronous connection failover mechanism to
handle managed groups, including Group Replication topologies.
</p>
<p>
When you add a group member to the source list and define it
as part of a managed group, the asynchronous connection
failover mechanism updates the source list to keep it in line
with membership changes, adding and removing group members
automatically as they join or leave. When asynchronous
connection failover is enabled for a group of replicas managed
by Group Replication, the source lists are broadcast to all
group members when they join, and also when the lists change.
</p>
<p>
The asynchronous connection failover mechanism fails over the
connection if another available server on the source list has
a higher priority (weight) setting. For a managed group, a
source’s weight is assigned depending on whether it is a
primary or a secondary server. So assuming that you set up the
managed group to give a higher weight to a primary and a lower
weight to a secondary, when the primary changes, the higher
weight is assigned to the new primary, so the replica changes
over the connection to it. The asynchronous connection
failover mechanism additionally changes connection if the
currently connected managed source server leaves the managed
group, or is no longer in the majority in the managed group.
For more information, see
<a class="xref" href="replication-asynchronous-connection-failover.html" title="19.4.9 Switching Sources and Replicas with Asynchronous Connection Failover">
Section 19.4.9, “Switching Sources and Replicas with Asynchronous Connection Failover”
</a>
.
</p>
<p>
The
<a class="link" href="performance-schema-replication-asynchronous-connection-failover-managed-table.html" title="29.12.11.9 The replication_asynchronous_connection_failover_managed Table">
<code class="literal">
replication_asynchronous_connection_failover_managed
</code>
</a>
table has these columns:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
CHANNEL_NAME
</code>
</p>
<p>
The replication channel where the servers for this managed
group operate.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
MANAGED_NAME
</code>
</p>
<p>
The identifier for the managed group. For the
<code class="literal">
GroupReplication
</code>
managed service, the
identifier is the value of the
<a class="link" href="group-replication-system-variables.html#sysvar_group_replication_group_name">
<code class="literal">
group_replication_group_name
</code>
</a>
system variable.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
MANAGED_TYPE
</code>
</p>
<p>
The type of managed service that the asynchronous
connection failover mechanism provides for this group. The
only value currently available is
<code class="literal">
GroupReplication
</code>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
CONFIGURATION
</code>
</p>
<p>
The configuration information for this managed group. For
the
<code class="literal">
GroupReplication
</code>
managed service,
the configuration shows the weights assigned to the
group's primary server and to the group's
secondary servers. For example:
<code class="literal">
{"Primary_weight": 80, "Secondary_weight":
60}
</code>
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<code class="literal">
Primary_weight
</code>
: Integer between 0
and 100. Default value is 80.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
Secondary_weight
</code>
: Integer between 0
and 100. Default value is 60.
</p>
</li>
</ul>
</div>
</li>
</ul>
</div>
<p>
The
<a class="link" href="performance-schema-replication-asynchronous-connection-failover-managed-table.html" title="29.12.11.9 The replication_asynchronous_connection_failover_managed Table">
<code class="literal">
replication_asynchronous_connection_failover_managed
</code>
</a>
table has these indexes:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Primary key on (
<code class="literal">
CHANNEL_NAME,
MANAGED_NAME
</code>
)
</p>
</li>
</ul>
</div>
<p>
<a class="link" href="truncate-table.html" title="15.1.37 TRUNCATE TABLE Statement">
<code class="literal">
TRUNCATE TABLE
</code>
</a>
is not permitted
for the
<a class="link" href="performance-schema-replication-asynchronous-connection-failover-managed-table.html" title="29.12.11.9 The replication_asynchronous_connection_failover_managed Table">
<code class="literal">
replication_asynchronous_connection_failover_managed
</code>
</a>
table.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/replication-features-transaction-inconsistencies.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="replication-features-transaction-inconsistencies">
</a>
19.5.1.34 Replication and Transaction Inconsistencies
</h4>
</div>
</div>
</div>
<p>
Inconsistencies in the sequence of transactions that have been
executed from the relay log can occur depending on your
replication configuration. This section explains how to avoid
inconsistencies and solve any problems they cause.
</p>
<p>
The following types of inconsistencies can exist:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<span class="emphasis">
<em>
Half-applied transactions
</em>
</span>
. A
transaction which updates non-transactional tables has
applied some but not all of its changes.
</p>
</li>
<li class="listitem">
<p>
<span class="emphasis">
<em>
Gaps
</em>
</span>
. A gap in the externalized
transaction set appears when, given an ordered sequence of
transactions, a transaction that is later in the sequence is
applied before some other transaction that is prior in the
sequence. Gaps can only appear when using a multithreaded
replica.
</p>
<p>
To avoid gaps occurring on a multithreaded replica, set
<a class="link" href="replication-options-replica.html#sysvar_replica_preserve_commit_order">
<code class="literal">
replica_preserve_commit_order=ON
</code>
</a>
.
This is the default, because all replicas are multithreaded
by default.
</p>
<p>
Binary logging and replica update logging are not required
on the replica to set
<a class="link" href="replication-options-replica.html#sysvar_replica_preserve_commit_order">
<code class="literal">
replica_preserve_commit_order=ON
</code>
</a>
,
and can be disabled if wanted.
</p>
<p>
Setting
<a class="link" href="replication-options-replica.html#sysvar_replica_preserve_commit_order">
<code class="literal">
replica_preserve_commit_order=ON
</code>
</a>
requires that
<a class="link" href="replication-options-replica.html#sysvar_replica_parallel_type">
<code class="literal">
replica_parallel_type
</code>
</a>
is
set to
<code class="literal">
LOGICAL_CLOCK
</code>
. In MySQL
8.4, this is the default.
</p>
<p>
In some specific situations, as listed in the description
for
<a class="link" href="replication-options-replica.html#sysvar_replica_preserve_commit_order">
<code class="literal">
replica_preserve_commit_order
</code>
</a>
,
setting
<a class="link" href="replication-options-replica.html#sysvar_replica_preserve_commit_order">
<code class="literal">
replica_preserve_commit_order=ON
</code>
</a>
cannot preserve commit order on the replica, so in these
cases gaps might still appear in the sequence of
transactions that have been executed from the replica's
relay log.
</p>
<p>
Setting
<code class="literal">
replica_preserve_commit_order=ON
</code>
does not prevent source binary log position lag.
</p>
</li>
<li class="listitem">
<p>
<span class="emphasis">
<em>
Source binary log position lag
</em>
</span>
. Even in
the absence of gaps, it is possible that transactions after
<code class="literal">
Exec_master_log_pos
</code>
have been applied.
That is, all transactions up to point
<code class="literal">
N
</code>
have been applied, and no transactions after
<code class="literal">
N
</code>
have been applied, but
<code class="literal">
Exec_master_log_pos
</code>
has a value smaller
than
<code class="literal">
N
</code>
. In this situation,
<code class="literal">
Exec_master_log_pos
</code>
is a
<span class="quote">
“
<span class="quote">
low-water
mark
</span>
”
</span>
of the transactions applied, and lags behind
the position of the most recently applied transaction. This
can only happen on multithreaded replicas. Enabling
<a class="link" href="replication-options-replica.html#sysvar_replica_preserve_commit_order">
<code class="literal">
replica_preserve_commit_order
</code>
</a>
does not prevent source binary log position lag.
</p>
</li>
</ul>
</div>
<p>
The following scenarios are relevant to the existence of
half-applied transactions, gaps, and source binary log position
lag:
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
While replication threads are running, there may be gaps and
half-applied transactions.
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
shuts down. Both clean and unclean
shutdown abort ongoing transactions and may leave gaps and
half-applied transactions.
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="kill.html" title="15.7.8.4 KILL Statement">
<code class="literal">
KILL
</code>
</a>
of replication threads
(the SQL thread when using a single-threaded replica, the
coordinator thread when using a multithreaded replica). This
aborts ongoing transactions and may leave gaps and
half-applied transactions.
</p>
</li>
<li class="listitem">
<p>
Error in applier threads. This may leave gaps. If the error
is in a mixed transaction, that transaction is half-applied.
When using a multithreaded replica, workers which have not
received an error complete their queues, so it may take time
to stop all threads.
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="stop-replica.html" title="15.4.2.5 STOP REPLICA Statement">
<code class="literal">
STOP REPLICA
</code>
</a>
when using a
multithreaded replica. After issuing
<a class="link" href="stop-replica.html" title="15.4.2.5 STOP REPLICA Statement">
<code class="literal">
STOP REPLICA
</code>
</a>
, the replica
waits for any gaps to be filled and then updates
<code class="literal">
Exec_master_log_pos
</code>
. This ensures it
never leaves gaps or source binary log position lag, unless
any of the cases above applies, in other words, before
<a class="link" href="stop-replica.html" title="15.4.2.5 STOP REPLICA Statement">
<code class="literal">
STOP REPLICA
</code>
</a>
completes,
either an error happens, or another thread issues
<a class="link" href="kill.html" title="15.7.8.4 KILL Statement">
<code class="literal">
KILL
</code>
</a>
, or the server restarts.
In these cases,
<a class="link" href="stop-replica.html" title="15.4.2.5 STOP REPLICA Statement">
<code class="literal">
STOP REPLICA
</code>
</a>
returns successfully.
</p>
</li>
<li class="listitem">
<p>
If the last transaction in the relay log is only
half-received and the multithreaded replica's coordinator
thread has started to schedule the transaction to a worker,
then
<a class="link" href="stop-replica.html" title="15.4.2.5 STOP REPLICA Statement">
<code class="literal">
STOP REPLICA
</code>
</a>
waits up to
60 seconds for the transaction to be received. After this
timeout, the coordinator gives up and aborts the
transaction. If the transaction is mixed, it may be left
half-completed.
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="stop-replica.html" title="15.4.2.5 STOP REPLICA Statement">
<code class="literal">
STOP REPLICA
</code>
</a>
when the ongoing
transaction updates transactional tables only, in which case
it is rolled back and
<a class="link" href="stop-replica.html" title="15.4.2.5 STOP REPLICA Statement">
<code class="literal">
STOP
REPLICA
</code>
</a>
stops immediately. If the ongoing
transaction is mixed,
<a class="link" href="stop-replica.html" title="15.4.2.5 STOP REPLICA Statement">
<code class="literal">
STOP
REPLICA
</code>
</a>
waits up to 60 seconds for the transaction
to complete. After this timeout, it aborts the transaction,
so it may be left half-completed.
</p>
</li>
</ol>
</div>
<p>
The global setting for the system variable
<a class="link" href="replication-options-replica.html#sysvar_rpl_stop_replica_timeout">
<code class="literal">
rpl_stop_replica_timeout
</code>
</a>
is
unrelated to the process of stopping the replication threads. It
only makes the client that issues
<a class="link" href="stop-replica.html" title="15.4.2.5 STOP REPLICA Statement">
<code class="literal">
STOP
REPLICA
</code>
</a>
return to the client, but the replication
threads continue to try to stop.
</p>
<p>
If a replication channel has gaps, it has the following
consequences:
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
The replica database is in a state that may never have
existed on the source.
</p>
</li>
<li class="listitem">
<p>
The field
<code class="literal">
Exec_master_log_pos
</code>
in
<a class="link" href="show-replica-status.html" title="15.7.7.35 SHOW REPLICA STATUS Statement">
<code class="literal">
SHOW REPLICA STATUS
</code>
</a>
is only a
<span class="quote">
“
<span class="quote">
low-water mark
</span>
”
</span>
. In other words, transactions
appearing before the position are guaranteed to have
committed, but transactions after the position may have
committed or not.
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="change-replication-source-to.html" title="15.4.2.2 CHANGE REPLICATION SOURCE TO Statement">
<code class="literal">
CHANGE REPLICATION SOURCE TO
</code>
</a>
statements for that channel fail with an error, unless the
applier threads are running and the statement only sets
receiver options.
</p>
</li>
<li class="listitem">
<p>
If
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
is started with
<a class="link" href="replication-options-replica.html#sysvar_relay_log_recovery">
<code class="option">
--relay-log-recovery
</code>
</a>
, no
recovery is done for that channel, and a warning is printed.
</p>
</li>
<li class="listitem">
<p>
If
<a class="link" href="mysqldump.html" title="6.5.4 mysqldump — A Database Backup Program">
<span class="command">
<strong>
mysqldump
</strong>
</span>
</a>
is used with
<a class="link" href="mysqldump.html#option_mysqldump_dump-replica">
<code class="option">
--dump-replica
</code>
</a>
, it does
not record the existence of gaps; thus it prints
<a class="link" href="change-replication-source-to.html" title="15.4.2.2 CHANGE REPLICATION SOURCE TO Statement">
<code class="literal">
CHANGE REPLICATION SOURCE TO
</code>
</a>
with
<code class="literal">
RELAY_LOG_POS
</code>
set to the
<span class="quote">
“
<span class="quote">
low-water mark
</span>
”
</span>
position in
<code class="literal">
Exec_master_log_pos
</code>
.
</p>
<p>
After applying the dump on another server, and starting the
replication threads, transactions appearing after the
position are replicated again. Note that this is harmless if
GTIDs are enabled (however, in that case it is not
recommended to use
<a class="link" href="mysqldump.html#option_mysqldump_dump-replica">
<code class="option">
--dump-replica
</code>
</a>
).
</p>
</li>
</ol>
</div>
<p>
If a replication channel has source binary log position lag but
no gaps, cases 2 to 5 above apply, but case 1 does not.
</p>
<p>
The source binary log position information is persisted in
binary format in the internal table
<code class="literal">
mysql.slave_worker_info
</code>
.
<a class="link" href="start-replica.html" title="15.4.2.4 START REPLICA Statement">
<code class="literal">
START REPLICA
[SQL_THREAD]
</code>
</a>
always consults this information so that
it applies only the correct transactions. This remains true even
if
<a class="link" href="replication-options-replica.html#sysvar_replica_parallel_workers">
<code class="literal">
replica_parallel_workers
</code>
</a>
has
been changed to 0 before
<a class="link" href="start-replica.html" title="15.4.2.4 START REPLICA Statement">
<code class="literal">
START
REPLICA
</code>
</a>
, and even if
<code class="literal">
START REPLICA
</code>
is used with
<code class="literal">
UNTIL
</code>
.
<code class="literal">
START REPLICA
UNTIL SQL_AFTER_MTS_GAPS
</code>
applies only as many
transactions as needed in order to fill in the gaps. If
<code class="literal">
START REPLICA
</code>
is used with
<code class="literal">
UNTIL
</code>
clauses that tell it to stop before it
has consumed all the gaps, then it leaves remaining gaps.
</p>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Warning
</div>
<p>
<a class="link" href="reset-replica.html" title="15.4.2.3 RESET REPLICA Statement">
<code class="literal">
RESET REPLICA
</code>
</a>
removes the relay
logs and resets the replication position. Thus issuing
<a class="link" href="reset-replica.html" title="15.4.2.3 RESET REPLICA Statement">
<code class="literal">
RESET REPLICA
</code>
</a>
on a
multithreaded replica with gaps means the replica loses any
information about the gaps, without correcting the gaps. In
this situation, if binary log position based replication is in
use, the recovery process fails.
</p>
</div>
<p>
When GTID-based replication is in use
(
<a class="link" href="replication-options-gtids.html#sysvar_gtid_mode">
<code class="literal">
GTID_MODE=ON
</code>
</a>
) and
<code class="literal">
SOURCE_AUTO_POSITION
</code>
is set for the
replication channel using the
<a class="link" href="change-replication-source-to.html" title="15.4.2.2 CHANGE REPLICATION SOURCE TO Statement">
<code class="literal">
CHANGE
REPLICATION SOURCE TO
</code>
</a>
statement, the old relay logs
are not required for the recovery process. Instead, the replica
can use GTID auto-positioning to calculate what transactions it
is missing compared to the source. The process used for binary
log position based replication to resolve gaps on a
multithreaded replica is skipped entirely when GTID-based
replication is in use. When the process is skipped, a
<a class="link" href="start-replica.html" title="15.4.2.4 START REPLICA Statement">
<code class="literal">
START REPLICA
UNTIL SQL_AFTER_MTS_GAPS
</code>
</a>
statement behaves
differently, and does not attempt to check for gaps in the
sequence of transactions. You can also issue
<a class="link" href="change-replication-source-to.html" title="15.4.2.2 CHANGE REPLICATION SOURCE TO Statement">
<code class="literal">
CHANGE REPLICATION SOURCE TO
</code>
</a>
statements, which are not permitted on a non-GTID replica where
there are gaps.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/sys-memory-global-by-current-bytes.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="sys-memory-global-by-current-bytes">
</a>
30.4.3.19 The memory_global_by_current_bytes and x$memory_global_by_current_bytes
Views
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045062797536">
</a>
<a class="indexterm" name="idm46045062796080">
</a>
<a class="indexterm" name="idm46045062794576">
</a>
<a class="indexterm" name="idm46045062793072">
</a>
<p>
These views summarize memory use, grouped by allocation type
(that is, by event). By default, rows are sorted by descending
amount of memory used.
</p>
<p>
The
<a class="link" href="sys-memory-global-by-current-bytes.html" title="30.4.3.19 The memory_global_by_current_bytes and x$memory_global_by_current_bytes Views">
<code class="literal">
memory_global_by_current_bytes
</code>
</a>
and
<a class="link" href="sys-memory-global-by-current-bytes.html" title="30.4.3.19 The memory_global_by_current_bytes and x$memory_global_by_current_bytes Views">
<code class="literal">
x$memory_global_by_current_bytes
</code>
</a>
views have these columns:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
event_name
</code>
</p>
<p>
The memory event name.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
current_count
</code>
</p>
<p>
The total number of occurrences of the event.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
current_alloc
</code>
</p>
<p>
The current number of allocated bytes that have not been
freed yet for the event.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
current_avg_alloc
</code>
</p>
<p>
The current number of allocated bytes per memory block for
the event.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
high_count
</code>
</p>
<p>
The high-water mark for number of memory blocks allocated
for the event.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
high_alloc
</code>
</p>
<p>
The high-water mark for number of bytes allocated for the
event.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
high_avg_alloc
</code>
</p>
<p>
The high-water mark for average number of bytes per memory
block allocated for the event.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/create-table-like.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="create-table-like">
</a>
15.1.20.3 CREATE TABLE ... LIKE Statement
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045185348800">
</a>
<a class="indexterm" name="idm46045185347760">
</a>
<p>
Use
<code class="literal">
CREATE TABLE ... LIKE
</code>
to create an empty
table based on the definition of another table, including any
column attributes and indexes defined in the original table:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa29545273"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> <em class="replaceable">new_tbl</em> <span class="token operator">LIKE</span> <em class="replaceable">orig_tbl</em><span class="token punctuation">;</span></code></pre>
</div>
<p>
The copy is created using the same version of the table storage
format as the original table. The
<a class="link" href="privileges-provided.html#priv_select">
<code class="literal">
SELECT
</code>
</a>
privilege is required on
the original table.
</p>
<p>
<code class="literal">
LIKE
</code>
works only for base tables, not for
views.
</p>
<div class="important" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Important
</div>
<p>
You cannot execute
<code class="literal">
CREATE TABLE
</code>
or
<code class="literal">
CREATE TABLE ... LIKE
</code>
while a
<a class="link" href="lock-tables.html" title="15.3.6 LOCK TABLES and UNLOCK TABLES Statements">
<code class="literal">
LOCK TABLES
</code>
</a>
statement is in
effect.
</p>
<p>
<a class="link" href="create-table.html" title="15.1.20 CREATE TABLE Statement">
<code class="literal">
CREATE TABLE ...
LIKE
</code>
</a>
makes the same checks as
<a class="link" href="create-table.html" title="15.1.20 CREATE TABLE Statement">
<code class="literal">
CREATE TABLE
</code>
</a>
. This means that
if the current SQL mode is different from the mode in effect
when the original table was created, the table definition
might be considered invalid for the new mode and cause the
statement to fail.
</p>
</div>
<p>
For
<code class="literal">
CREATE TABLE ... LIKE
</code>
, the destination
table preserves generated column information from the original
table.
</p>
<p>
For
<code class="literal">
CREATE TABLE ... LIKE
</code>
, the destination
table preserves expression default values from the original
table.
</p>
<p>
For
<code class="literal">
CREATE TABLE ... LIKE
</code>
, the destination
table preserves
<code class="literal">
CHECK
</code>
constraints from the
original table, except that all the constraint names are
generated.
</p>
<p>
<code class="literal">
CREATE TABLE ... LIKE
</code>
does not preserve any
<code class="literal">
DATA DIRECTORY
</code>
or
<code class="literal">
INDEX
DIRECTORY
</code>
table options that were specified for the
original table, or any foreign key definitions.
</p>
<p>
If the original table is a
<code class="literal">
TEMPORARY
</code>
table,
<code class="literal">
CREATE TABLE ... LIKE
</code>
does not preserve
<code class="literal">
TEMPORARY
</code>
. To create a
<code class="literal">
TEMPORARY
</code>
destination table, use
<code class="literal">
CREATE TEMPORARY TABLE ... LIKE
</code>
.
</p>
<p>
<a class="link" href="create-table-like.html" title="15.1.20.3 CREATE TABLE ... LIKE Statement">
<code class="literal">
CREATE TABLE
... LIKE
</code>
</a>
operations apply all
<code class="literal">
ENGINE_ATTRIBUTE
</code>
and
<code class="literal">
SECONDARY_ENGINE_ATTRIBUTE
</code>
values to the new
table.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/data-dictionary.html | <div id="docs-body">
<div class="chapter">
<div class="titlepage">
<div>
<div>
<h1 class="title">
<a name="data-dictionary">
</a>
Chapter 16 MySQL Data Dictionary
</h1>
</div>
</div>
</div>
<div class="toc">
<p>
<b>
Table of Contents
</b>
</p>
<dl class="toc">
<dt>
<span class="section">
<a href="data-dictionary-schema.html">
16.1 Data Dictionary Schema
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="data-dictionary-file-removal.html">
16.2 Removal of File-based Metadata Storage
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="data-dictionary-transactional-storage.html">
16.3 Transactional Storage of Dictionary Data
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="data-dictionary-object-cache.html">
16.4 Dictionary Object Cache
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="data-dictionary-information-schema.html">
16.5 INFORMATION_SCHEMA and Data Dictionary Integration
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="serialized-dictionary-information.html">
16.6 Serialized Dictionary Information (SDI)
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="data-dictionary-usage-differences.html">
16.7 Data Dictionary Usage Differences
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="data-dictionary-limitations.html">
16.8 Data Dictionary Limitations
</a>
</span>
</dt>
</dl>
</div>
<a class="indexterm" name="idm46045167825600">
</a>
<a class="indexterm" name="idm46045167824528">
</a>
<p>
MySQL Server incorporates a transactional data dictionary that
stores information about database objects. In previous MySQL
releases, dictionary data was stored in metadata files,
nontransactional tables, and storage engine-specific data
dictionaries.
</p>
<p>
This chapter describes the main features, benefits, usage
differences, and limitations of the data dictionary. For other
implications of the data dictionary feature, refer to the
<span class="quote">
“
<span class="quote">
Data Dictionary Notes
</span>
”
</span>
section in the
<a class="ulink" href="/doc/relnotes/mysql/8.4/en/" target="_top">
MySQL 8.4
Release Notes
</a>
.
</p>
<p>
Benefits of the MySQL data dictionary include:
</p>
<a class="indexterm" name="idm46045167820528">
</a>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Simplicity of a centralized data dictionary schema that
uniformly stores dictionary data. See
<a class="xref" href="data-dictionary-schema.html" title="16.1 Data Dictionary Schema">
Section 16.1, “Data Dictionary Schema”
</a>
.
</p>
</li>
<li class="listitem">
<p>
Removal of file-based metadata storage. See
<a class="xref" href="data-dictionary-file-removal.html" title="16.2 Removal of File-based Metadata Storage">
Section 16.2, “Removal of File-based Metadata Storage”
</a>
.
</p>
</li>
<li class="listitem">
<p>
Transactional, crash-safe storage of dictionary data. See
<a class="xref" href="data-dictionary-transactional-storage.html" title="16.3 Transactional Storage of Dictionary Data">
Section 16.3, “Transactional Storage of Dictionary Data”
</a>
.
</p>
</li>
<li class="listitem">
<p>
Uniform and centralized caching for dictionary objects. See
<a class="xref" href="data-dictionary-object-cache.html" title="16.4 Dictionary Object Cache">
Section 16.4, “Dictionary Object Cache”
</a>
.
</p>
</li>
<li class="listitem">
<p>
A simpler and improved implementation for some
<a class="link" href="information-schema.html" title="Chapter 28 INFORMATION_SCHEMA Tables">
<code class="literal">
INFORMATION_SCHEMA
</code>
</a>
tables. See
<a class="xref" href="data-dictionary-information-schema.html" title="16.5 INFORMATION_SCHEMA and Data Dictionary Integration">
Section 16.5, “INFORMATION_SCHEMA and Data Dictionary Integration”
</a>
.
</p>
</li>
<li class="listitem">
<p>
Atomic DDL. See
<a class="xref" href="atomic-ddl.html" title="15.1.1 Atomic Data Definition Statement Support">
Section 15.1.1, “Atomic Data Definition Statement Support”
</a>
.
</p>
</li>
</ul>
</div>
<div class="important" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Important
</div>
<p>
A data dictionary-enabled server entails some general operational
differences compared to a server that does not have a data
dictionary; see
<a class="xref" href="data-dictionary-usage-differences.html" title="16.7 Data Dictionary Usage Differences">
Section 16.7, “Data Dictionary Usage Differences”
</a>
. Also, for
upgrades to MySQL 8.0, the upgrade procedure differs somewhat from
previous MySQL releases and requires that you verify the upgrade
readiness of your installation by checking specific prerequisites.
For more information, see
<a class="xref" href="upgrading.html" title="Chapter 3 Upgrading MySQL">
Chapter 3,
<i>
Upgrading MySQL
</i>
</a>
,
particularly
<a class="xref" href="upgrade-prerequisites.html" title="3.6 Preparing Your Installation for Upgrade">
Section 3.6, “Preparing Your Installation for Upgrade”
</a>
.
</p>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/mysql-cluster-install-windows-source.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="mysql-cluster-install-windows-source">
</a>
25.3.2.2 Compiling and Installing NDB Cluster from Source on Windows
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045122446544">
</a>
<a class="indexterm" name="idm46045122445056">
</a>
<p>
Oracle provides precompiled NDB Cluster binaries for Windows
which should be adequate for most users. However, if you wish,
it is also possible to compile NDB Cluster for Windows from
source code. The procedure for doing this is almost identical to
the procedure used to compile the standard MySQL Server binaries
for Windows, and uses the same tools. However, there are two
major differences:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
MySQL NDB Cluster 8.4 is built from the MySQL
Server 8.4 sources, available from the MySQL
downloads page at
<a class="ulink" href="https://dev.mysql.com/downloads/" target="_top">
https://dev.mysql.com/downloads/
</a>
. The
archived source file should have a name similar to
<code class="filename">
mysql-8.4.0.tar.gz
</code>
.
You can also obtain the sources from GitHub at
<a class="ulink" href="https://github.com/mysql/mysql-server" target="_blank">
https://github.com/mysql/mysql-server
</a>
.
</p>
</li>
<li class="listitem">
<p>
You must configure the build using the
<a class="link" href="source-configuration-options.html#option_cmake_with_ndb">
<code class="option">
WITH_NDB
</code>
</a>
option in addition to
any other build options you wish to use with
<span class="command">
<strong>
CMake
</strong>
</span>
.
<a class="link" href="source-configuration-options.html#option_cmake_with_ndbcluster">
<code class="option">
WITH_NDBCLUSTER
</code>
</a>
is also
supported for backwards compatibility, but is deprecated and
subject to future removal.
</p>
</li>
</ul>
</div>
<div class="important" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Important
</div>
<p>
The
<a class="link" href="source-configuration-options.html#option_cmake_with_ndb_java">
<code class="option">
WITH_NDB_JAVA
</code>
</a>
option is
enabled by default. This means that, by default, if
<span class="command">
<strong>
CMake
</strong>
</span>
cannot find the location of Java on
your system, the configuration process fails; if you do not
wish to enable Java and ClusterJ support, you must indicate
this explicitly by configuring the build using
<code class="option">
-DWITH_NDB_JAVA=OFF
</code>
. (Bug #12379735) Use
<a class="link" href="source-configuration-options.html#option_cmake_with_classpath">
<code class="option">
WITH_CLASSPATH
</code>
</a>
to provide the
Java classpath if needed.
</p>
</div>
<p>
For more information about
<span class="command">
<strong>
CMake
</strong>
</span>
options
specific to building NDB Cluster, see
<a class="xref" href="source-configuration-options.html#cmake-mysql-cluster-options" title="CMake Options for Compiling NDB Cluster">
CMake Options for Compiling NDB Cluster
</a>
.
</p>
<p>
Once the build process is complete, you can create a Zip archive
containing the compiled binaries;
<a class="xref" href="installing-source-distribution.html" title="2.8.4 Installing MySQL Using a Standard Source Distribution">
Section 2.8.4, “Installing MySQL Using a Standard Source Distribution”
</a>
provides the
commands needed to perform this task on Windows systems. The NDB
Cluster binaries can be found in the
<code class="filename">
bin
</code>
directory of the resulting archive, which is equivalent to the
<code class="literal">
no-install
</code>
archive, and which can be
installed and configured in the same manner. For more
information, see
<a class="xref" href="mysql-cluster-install-windows-binary.html" title="25.3.2.1 Installing NDB Cluster on Windows from a Binary Release">
Section 25.3.2.1, “Installing NDB Cluster on Windows from a Binary Release”
</a>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/replication-features-sql-mode.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="replication-features-sql-mode">
</a>
19.5.1.30 Replication and Server SQL Mode
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045135139344">
</a>
<a class="indexterm" name="idm46045135137856">
</a>
<a class="indexterm" name="idm46045135136368">
</a>
<a class="indexterm" name="idm46045135134880">
</a>
<a class="indexterm" name="idm46045135133392">
</a>
<a class="indexterm" name="idm46045135131904">
</a>
<p>
Using different server SQL mode settings on the source and the
replica may cause the same
<a class="link" href="insert.html" title="15.2.7 INSERT Statement">
<code class="literal">
INSERT
</code>
</a>
statements to be handled differently on the source and the
replica, leading the source and replica to diverge. For best
results, you should always use the same server SQL mode on the
source and on the replica. This advice applies whether you are
using statement-based or row-based replication.
</p>
<p>
If you are replicating partitioned tables, using different SQL
modes on the source and the replica is likely to cause issues.
At a minimum, this is likely to cause the distribution of data
among partitions to be different in the source's and replica's
copies of a given table. It may also cause inserts into
partitioned tables that succeed on the source to fail on the
replica.
</p>
<p>
For more information, see
<a class="xref" href="sql-mode.html" title="7.1.11 Server SQL Modes">
Section 7.1.11, “Server SQL Modes”
</a>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/events-metadata.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="events-metadata">
</a>
27.4.4 Event Metadata
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045082098112">
</a>
<a class="indexterm" name="idm46045082096624">
</a>
<p>
To obtain metadata about events:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Query the
<a class="link" href="information-schema-events-table.html" title="28.3.14 The INFORMATION_SCHEMA EVENTS Table">
<code class="literal">
EVENTS
</code>
</a>
table of the
<code class="literal">
INFORMATION_SCHEMA
</code>
database. See
<a class="xref" href="information-schema-events-table.html" title="28.3.14 The INFORMATION_SCHEMA EVENTS Table">
Section 28.3.14, “The INFORMATION_SCHEMA EVENTS Table”
</a>
.
</p>
</li>
<li class="listitem">
<p>
Use the
<a class="link" href="show-create-event.html" title="15.7.7.8 SHOW CREATE EVENT Statement">
<code class="literal">
SHOW CREATE EVENT
</code>
</a>
statement. See
<a class="xref" href="show-create-event.html" title="15.7.7.8 SHOW CREATE EVENT Statement">
Section 15.7.7.8, “SHOW CREATE EVENT Statement”
</a>
.
</p>
</li>
<li class="listitem">
<p>
Use the
<a class="link" href="show-events.html" title="15.7.7.19 SHOW EVENTS Statement">
<code class="literal">
SHOW EVENTS
</code>
</a>
statement.
See
<a class="xref" href="show-events.html" title="15.7.7.19 SHOW EVENTS Statement">
Section 15.7.7.19, “SHOW EVENTS Statement”
</a>
.
</p>
</li>
</ul>
</div>
<p>
<span class="bold">
<strong>
Event Scheduler Time
Representation
</strong>
</span>
</p>
<a class="indexterm" name="idm46045082084240">
</a>
<a class="indexterm" name="idm46045082082752">
</a>
<p>
Each session in MySQL has a session time zone (STZ). This is the
session
<a class="link" href="server-system-variables.html#sysvar_time_zone">
<code class="literal">
time_zone
</code>
</a>
value that is
initialized from the server's global
<a class="link" href="server-system-variables.html#sysvar_time_zone">
<code class="literal">
time_zone
</code>
</a>
value when the session
begins but may be changed during the session.
</p>
<p>
The session time zone that is current when a
<a class="link" href="create-event.html" title="15.1.13 CREATE EVENT Statement">
<code class="literal">
CREATE EVENT
</code>
</a>
or
<a class="link" href="alter-event.html" title="15.1.3 ALTER EVENT Statement">
<code class="literal">
ALTER EVENT
</code>
</a>
statement executes is
used to interpret times specified in the event definition. This
becomes the event time zone (ETZ); that is, the time zone that is
used for event scheduling and is in effect within the event as it
executes.
</p>
<p>
For representation of event information in the data dictionary,
the
<code class="literal">
execute_at
</code>
,
<code class="literal">
starts
</code>
, and
<code class="literal">
ends
</code>
times are converted to UTC and stored
along with the event time zone. This enables event execution to
proceed as defined regardless of any subsequent changes to the
server time zone or daylight saving time effects. The
<code class="literal">
last_executed
</code>
time is also stored in UTC.
</p>
<p>
Event times can be obtained by selecting from the Information
Schema
<a class="link" href="information-schema-events-table.html" title="28.3.14 The INFORMATION_SCHEMA EVENTS Table">
<code class="literal">
EVENTS
</code>
</a>
table or from
<a class="link" href="show-events.html" title="15.7.7.19 SHOW EVENTS Statement">
<code class="literal">
SHOW EVENTS
</code>
</a>
, but they are reported
as ETZ or STZ values. The following table summarizes
representation of event times.
</p>
<div class="informaltable">
<table summary="Summary of event time representation (as UTC, EZT, or STZ values) from INFORMATION_SCHEMA.EVENTS, and SHOW EVENTS.">
<colgroup>
<col style="width: 25%"/>
<col style="width: 25%"/>
<col style="width: 25%"/>
</colgroup>
<thead>
<tr>
<th scope="col">
Value
</th>
<th scope="col">
<a class="link" href="information-schema-events-table.html" title="28.3.14 The INFORMATION_SCHEMA EVENTS Table">
<code class="literal">
EVENTS
</code>
</a>
Table
</th>
<th scope="col">
<a class="link" href="show-events.html" title="15.7.7.19 SHOW EVENTS Statement">
<code class="literal">
SHOW EVENTS
</code>
</a>
</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">
Execute at
</th>
<td>
ETZ
</td>
<td>
ETZ
</td>
</tr>
<tr>
<th scope="row">
Starts
</th>
<td>
ETZ
</td>
<td>
ETZ
</td>
</tr>
<tr>
<th scope="row">
Ends
</th>
<td>
ETZ
</td>
<td>
ETZ
</td>
</tr>
<tr>
<th scope="row">
Last executed
</th>
<td>
ETZ
</td>
<td>
n/a
</td>
</tr>
<tr>
<th scope="row">
Created
</th>
<td>
STZ
</td>
<td>
n/a
</td>
</tr>
<tr>
<th scope="row">
Last altered
</th>
<td>
STZ
</td>
<td>
n/a
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/connection-options.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="connection-options">
</a>
6.2.3 Command Options for Connecting to the Server
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045323566208">
</a>
<p>
This section describes options supported by most MySQL client
programs that control how client programs establish connections to
the server, whether connections are encrypted, and whether
connections are compressed. These options can be given on the
command line or in an option file.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="xref" href="connection-options.html#connection-establishment-options" title="Command Options for Connection Establishment">
Command Options for Connection Establishment
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="connection-options.html#encrypted-connection-options" title="Command Options for Encrypted Connections">
Command Options for Encrypted Connections
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="connection-options.html#connection-compression-options" title="Command Options for Connection Compression">
Command Options for Connection Compression
</a>
</p>
</li>
</ul>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="connection-establishment-options">
</a>
Command Options for Connection Establishment
</h4>
</div>
</div>
</div>
<p>
This section describes options that control how client programs
establish connections to the server. For additional information
and examples showing how to use them, see
<a class="xref" href="connecting.html" title="6.2.4 Connecting to the MySQL Server Using Command Options">
Section 6.2.4, “Connecting to the MySQL Server Using Command Options”
</a>
.
</p>
<div class="table">
<a name="idm46045323558128">
</a>
<p class="title">
<b>
Table 6.4 Connection-Establishment Option Summary
</b>
</p>
<div class="table-contents">
<table frame="box" rules="all" summary="Command-line options available for establishing connections to the server.">
<colgroup>
<col style="width: 35%"/>
<col style="width: 64%"/>
</colgroup>
<thead>
<tr>
<th>
Option Name
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a class="link" href="connection-options.html#option_general_default-auth">
--default-auth
</a>
</td>
<td>
Authentication plugin to use
</td>
</tr>
<tr>
<td>
<a class="link" href="connection-options.html#option_general_host">
--host
</a>
</td>
<td>
Host on which MySQL server is located
</td>
</tr>
<tr>
<td>
<a class="link" href="connection-options.html#option_general_password">
--password
</a>
</td>
<td>
Password to use when connecting to server
</td>
</tr>
<tr>
<td>
<a class="link" href="connection-options.html#option_general_password1">
--password1
</a>
</td>
<td>
First multifactor authentication password to use when connecting to server
</td>
</tr>
<tr>
<td>
<a class="link" href="connection-options.html#option_general_password2">
--password2
</a>
</td>
<td>
Second multifactor authentication password to use when connecting to server
</td>
</tr>
<tr>
<td>
<a class="link" href="connection-options.html#option_general_password3">
--password3
</a>
</td>
<td>
Third multifactor authentication password to use when connecting to server
</td>
</tr>
<tr>
<td>
<a class="link" href="connection-options.html#option_general_pipe">
--pipe
</a>
</td>
<td>
Connect to server using named pipe (Windows only)
</td>
</tr>
<tr>
<td>
<a class="link" href="connection-options.html#option_general_plugin-dir">
--plugin-dir
</a>
</td>
<td>
Directory where plugins are installed
</td>
</tr>
<tr>
<td>
<a class="link" href="connection-options.html#option_general_port">
--port
</a>
</td>
<td>
TCP/IP port number for connection
</td>
</tr>
<tr>
<td>
<a class="link" href="connection-options.html#option_general_protocol">
--protocol
</a>
</td>
<td>
Transport protocol to use
</td>
</tr>
<tr>
<td>
<a class="link" href="connection-options.html#option_general_shared-memory-base-name">
--shared-memory-base-name
</a>
</td>
<td>
Shared-memory name for shared-memory connections (Windows only)
</td>
</tr>
<tr>
<td>
<a class="link" href="connection-options.html#option_general_socket">
--socket
</a>
</td>
<td>
Unix socket file or Windows named pipe to use
</td>
</tr>
<tr>
<td>
<a class="link" href="connection-options.html#option_general_user">
--user
</a>
</td>
<td>
MySQL user name to use when connecting to server
</td>
</tr>
</tbody>
</table>
</div>
<div class="table-contents">
<table cellpadding="0" cellspacing="0" style="position: fixed; top: 0px; display: none; left: 401px; width: 739px;">
<thead>
<tr>
<th style="width: 260.906px;">
Option Name
</th>
<th style="width: 477.094px;">
Description
</th>
</tr>
</thead>
</table>
</div>
</div>
<br class="table-break"/>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a name="option_general_default-auth">
</a>
<a class="link" href="connection-options.html#option_general_default-auth">
<code class="option">
--default-auth=
<em class="replaceable">
<code>
plugin
</code>
</em>
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for default-auth">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--default-auth=plugin
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045323506704">
</a>
<p>
A hint about which client-side authentication plugin to use.
See
<a class="xref" href="pluggable-authentication.html" title="8.2.17 Pluggable Authentication">
Section 8.2.17, “Pluggable Authentication”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_general_host">
</a>
<a class="link" href="connection-options.html#option_general_host">
<code class="option">
--host=
<em class="replaceable">
<code>
host_name
</code>
</em>
</code>
</a>
,
<code class="option">
-h
<em class="replaceable">
<code>
host_name
</code>
</em>
</code>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for host">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--host=host_name
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
localhost
</code>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045323491136">
</a>
<p>
The host on which the MySQL server is running. The value can
be a host name, IPv4 address, or IPv6 address. The default
value is
<code class="literal">
localhost
</code>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_general_password">
</a>
<a class="link" href="connection-options.html#option_general_password">
<code class="option">
--password[=
<em class="replaceable">
<code>
pass_val
</code>
</em>
]
</code>
</a>
,
<code class="option">
-p[
<em class="replaceable">
<code>
pass_val
</code>
</em>
]
</code>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for password">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--password[=password]
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
[none]
</code>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045323475360">
</a>
<p>
The password of the MySQL account used for connecting to the
server. The password value is optional. If not given, the
client program prompts for one. If given, there must be
<span class="emphasis">
<em>
no space
</em>
</span>
between
<a class="link" href="connection-options.html#option_general_password">
<code class="option">
--password=
</code>
</a>
or
<code class="option">
-p
</code>
and the password following it. If no
password option is specified, the default is to send no
password.
</p>
<p>
Specifying a password on the command line should be
considered insecure. To avoid giving the password on the
command line, use an option file. See
<a class="xref" href="password-security-user.html" title="8.1.2.1 End-User Guidelines for Password Security">
Section 8.1.2.1, “End-User Guidelines for Password Security”
</a>
.
</p>
<p>
To explicitly specify that there is no password and that the
client program should not prompt for one, use the
<a class="link" href="connection-options.html#option_general_password">
<code class="option">
--skip-password
</code>
</a>
option.
</p>
</li>
<li class="listitem">
<p>
<a name="option_general_password1">
</a>
<a class="link" href="connection-options.html#option_general_password1">
<code class="option">
--password1[=
<em class="replaceable">
<code>
pass_val
</code>
</em>
]
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for password1">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--password1[=password]
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045323458576">
</a>
<p>
The password for multifactor authentication factor 1 of the
MySQL account used for connecting to the server. The
password value is optional. If not given, the client program
prompts for one. If given, there must be
<span class="emphasis">
<em>
no
space
</em>
</span>
between
<a class="link" href="connection-options.html#option_general_password1">
<code class="option">
--password1=
</code>
</a>
and the
password following it. If no password option is specified,
the default is to send no password.
</p>
<p>
Specifying a password on the command line should be
considered insecure. To avoid giving the password on the
command line, use an option file. See
<a class="xref" href="password-security-user.html" title="8.1.2.1 End-User Guidelines for Password Security">
Section 8.1.2.1, “End-User Guidelines for Password Security”
</a>
.
</p>
<p>
To explicitly specify that there is no password and that the
client program should not prompt for one, use the
<a class="link" href="connection-options.html#option_general_password1">
<code class="option">
--skip-password1
</code>
</a>
option.
</p>
<p>
<a class="link" href="connection-options.html#option_general_password1">
<code class="option">
--password1
</code>
</a>
and
<a class="link" href="connection-options.html#option_general_password">
<code class="option">
--password
</code>
</a>
are synonymous,
as are
<a class="link" href="connection-options.html#option_general_password1">
<code class="option">
--skip-password1
</code>
</a>
and
<a class="link" href="connection-options.html#option_general_password">
<code class="option">
--skip-password
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_general_password2">
</a>
<a class="link" href="connection-options.html#option_general_password2">
<code class="option">
--password2[=
<em class="replaceable">
<code>
pass_val
</code>
</em>
]
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for password2">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--password2[=password]
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045323437936">
</a>
<p>
The password for multifactor authentication factor 2 of the
MySQL account used for connecting to the server. The
semantics of this option are similar to the semantics for
<a class="link" href="connection-options.html#option_general_password1">
<code class="option">
--password1
</code>
</a>
; see the
description of that option for details.
</p>
</li>
<li class="listitem">
<p>
<a name="option_general_password3">
</a>
<a class="link" href="connection-options.html#option_general_password3">
<code class="option">
--password3[=
<em class="replaceable">
<code>
pass_val
</code>
</em>
]
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for password3">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--password3[=password]
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045323425008">
</a>
<p>
The password for multifactor authentication factor 3 of the
MySQL account used for connecting to the server. The
semantics of this option are similar to the semantics for
<a class="link" href="connection-options.html#option_general_password1">
<code class="option">
--password1
</code>
</a>
; see the
description of that option for details.
</p>
</li>
<li class="listitem">
<p>
<a name="option_general_pipe">
</a>
<a class="link" href="connection-options.html#option_general_pipe">
<code class="option">
--pipe
</code>
</a>
,
<code class="option">
-W
</code>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for pipe">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--pipe
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045323412144">
</a>
<p>
On Windows, connect to the server using a named pipe. This
option applies only if the server was started with the
<a class="link" href="server-system-variables.html#sysvar_named_pipe">
<code class="literal">
named_pipe
</code>
</a>
system variable
enabled to support named-pipe connections. In addition, the
user making the connection must be a member of the Windows
group specified by the
<a class="link" href="server-system-variables.html#sysvar_named_pipe_full_access_group">
<code class="literal">
named_pipe_full_access_group
</code>
</a>
system variable.
</p>
</li>
<li class="listitem">
<p>
<a name="option_general_plugin-dir">
</a>
<a class="link" href="connection-options.html#option_general_plugin-dir">
<code class="option">
--plugin-dir=
<em class="replaceable">
<code>
dir_name
</code>
</em>
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for plugin-dir">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--plugin-dir=dir_name
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
Directory name
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045323397632">
</a>
<p>
The directory in which to look for plugins. Specify this
option if the
<a class="link" href="connection-options.html#option_general_default-auth">
<code class="option">
--default-auth
</code>
</a>
option is used to specify an authentication plugin but the
client program does not find it. See
<a class="xref" href="pluggable-authentication.html" title="8.2.17 Pluggable Authentication">
Section 8.2.17, “Pluggable Authentication”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_general_port">
</a>
<a class="link" href="connection-options.html#option_general_port">
<code class="option">
--port=
<em class="replaceable">
<code>
port_num
</code>
</em>
</code>
</a>
,
<code class="option">
-P
<em class="replaceable">
<code>
port_num
</code>
</em>
</code>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for port">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--port=port_num
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
Numeric
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
3306
</code>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045323381088">
</a>
<p>
For TCP/IP connections, the port number to use. The default
port number is 3306.
</p>
</li>
<li class="listitem">
<p>
<a name="option_general_protocol">
</a>
<a class="link" href="connection-options.html#option_general_protocol">
<code class="option">
--protocol={TCP|SOCKET|PIPE|MEMORY}
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for protocol">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--protocol=type
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
[see text]
</code>
</td>
</tr>
<tr>
<th>
Valid Values
</th>
<td>
<p class="valid-value">
<code class="literal">
TCP
</code>
</p>
<p class="valid-value">
<code class="literal">
SOCKET
</code>
</p>
<p class="valid-value">
<code class="literal">
PIPE
</code>
</p>
<p class="valid-value">
<code class="literal">
MEMORY
</code>
</p>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045323361616">
</a>
<p>
This option explicitly specifies which transport protocol to
use for connecting to the server. It is useful when other
connection parameters normally result in use of a protocol
other than the one you want. For example, connections on
Unix to
<code class="literal">
localhost
</code>
are made using a Unix
socket file by default:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa80438885"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal">mysql <span class="token constant">--host</span><span class="token attr-value"><span class="token punctuation">=</span>localhost</span></code></pre>
</div>
<p>
To force TCP/IP transport to be used instead, specify a
<a class="link" href="connection-options.html#option_general_protocol">
<code class="option">
--protocol
</code>
</a>
option:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa53770698"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal">mysql <span class="token constant">--host</span><span class="token attr-value"><span class="token punctuation">=</span>localhost</span> <span class="token constant">--protocol</span><span class="token attr-value"><span class="token punctuation">=</span>TCP</span></code></pre>
</div>
<p>
The following table shows the permissible
<a class="link" href="connection-options.html#option_general_protocol">
<code class="option">
--protocol
</code>
</a>
option values and
indicates the applicable platforms for each value. The
values are not case-sensitive.
</p>
<div class="informaltable">
<table summary="Permissible transport protocol values, the resulting transport protocol used, and the applicable platforms for each value.">
<colgroup>
<col style="width: 20%"/>
<col style="width: 50%"/>
<col style="width: 30%"/>
</colgroup>
<thead>
<tr>
<th scope="col">
<a class="link" href="connection-options.html#option_general_protocol">
<code class="option">
--protocol
</code>
</a>
Value
</th>
<th scope="col">
Transport Protocol Used
</th>
<th scope="col">
Applicable Platforms
</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">
<code class="literal">
TCP
</code>
</th>
<td>
TCP/IP transport to local or remote server
</td>
<td>
All
</td>
</tr>
<tr>
<th scope="row">
<code class="literal">
SOCKET
</code>
</th>
<td>
Unix socket-file transport to local server
</td>
<td>
Unix and Unix-like systems
</td>
</tr>
<tr>
<th scope="row">
<code class="literal">
PIPE
</code>
</th>
<td>
Named-pipe transport to local server
</td>
<td>
Windows
</td>
</tr>
<tr>
<th scope="row">
<code class="literal">
MEMORY
</code>
</th>
<td>
Shared-memory transport to local server
</td>
<td>
Windows
</td>
</tr>
</tbody>
</table>
</div>
<p>
See also
<a class="xref" href="transport-protocols.html" title="6.2.7 Connection Transport Protocols">
Section 6.2.7, “Connection Transport Protocols”
</a>
</p>
</li>
<li class="listitem">
<p>
<a name="option_general_shared-memory-base-name">
</a>
<a class="link" href="connection-options.html#option_general_shared-memory-base-name">
<code class="option">
--shared-memory-base-name=
<em class="replaceable">
<code>
name
</code>
</em>
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for shared-memory-base-name">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--shared-memory-base-name=name
</code>
</td>
</tr>
<tr>
<th>
Platform Specific
</th>
<td>
Windows
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045323318592">
</a>
<p>
On Windows, the shared-memory name to use for connections
made using shared memory to a local server. The default
value is
<code class="literal">
MYSQL
</code>
. The shared-memory name is
case-sensitive.
</p>
<p>
This option applies only if the server was started with the
<a class="link" href="server-system-variables.html#sysvar_shared_memory">
<code class="literal">
shared_memory
</code>
</a>
system
variable enabled to support shared-memory connections.
</p>
</li>
<li class="listitem">
<p>
<a name="option_general_socket">
</a>
<a class="link" href="connection-options.html#option_general_socket">
<code class="option">
--socket=
<em class="replaceable">
<code>
path
</code>
</em>
</code>
</a>
,
<code class="option">
-S
<em class="replaceable">
<code>
path
</code>
</em>
</code>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for socket">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--socket={file_name|pipe_name}
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045323303712">
</a>
<p>
On Unix, the name of the Unix socket file to use for
connections made using a named pipe to a local server. The
default Unix socket file name is
<code class="filename">
/tmp/mysql.sock
</code>
.
</p>
<p>
On Windows, the name of the named pipe to use for
connections to a local server. The default Windows pipe name
is
<code class="literal">
MySQL
</code>
. The pipe name is not
case-sensitive.
</p>
<p>
On Windows, this option applies only if the server was
started with the
<a class="link" href="server-system-variables.html#sysvar_named_pipe">
<code class="literal">
named_pipe
</code>
</a>
system variable enabled to support named-pipe connections.
In addition, the user making the connection must be a member
of the Windows group specified by the
<a class="link" href="server-system-variables.html#sysvar_named_pipe_full_access_group">
<code class="literal">
named_pipe_full_access_group
</code>
</a>
system variable.
</p>
</li>
<li class="listitem">
<p>
<a name="option_general_user">
</a>
<a class="link" href="connection-options.html#option_general_user">
<code class="option">
--user=
<em class="replaceable">
<code>
user_name
</code>
</em>
</code>
</a>
,
<code class="option">
-u
<em class="replaceable">
<code>
user_name
</code>
</em>
</code>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for user">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--user=user_name
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045323286112">
</a>
<p>
The user name of the MySQL account to use for connecting to
the server. The default user name is
<code class="literal">
ODBC
</code>
on Windows or your Unix login name on Unix.
</p>
</li>
</ul>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="encrypted-connection-options">
</a>
Command Options for Encrypted Connections
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045323282144">
</a>
<a class="indexterm" name="idm46045323280656">
</a>
<a class="indexterm" name="idm46045323279168">
</a>
<a class="indexterm" name="idm46045323277712">
</a>
<p>
This section describes options for client programs that specify
whether to use encrypted connections to the server, the names of
certificate and key files, and other parameters related to
encrypted-connection support. For examples of suggested use and
how to check whether a connection is encrypted, see
<a class="xref" href="using-encrypted-connections.html" title="8.3.1 Configuring MySQL to Use Encrypted Connections">
Section 8.3.1, “Configuring MySQL to Use Encrypted Connections”
</a>
.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
These options have an effect only for connections that use a
transport protocol subject to encryption; that is, TCP/IP and
Unix socket-file connections. See
<a class="xref" href="transport-protocols.html" title="6.2.7 Connection Transport Protocols">
Section 6.2.7, “Connection Transport Protocols”
</a>
</p>
</div>
<p>
For information about using encrypted connections from the MySQL
C API, see
<a class="ulink" href="/doc/c-api/8.4/en/c-api-encrypted-connections.html" target="_top">
Support for Encrypted Connections
</a>
.
</p>
<div class="table">
<a name="idm46045323271856">
</a>
<p class="title">
<b>
Table 6.5 Connection-Encryption Option Summary
</b>
</p>
<div class="table-contents">
<table frame="box" rules="all" summary="Command-line options available for establishing encrypted connections.">
<colgroup>
<col style="width: 35%"/>
<col style="width: 64%"/>
</colgroup>
<thead>
<tr>
<th>
Option Name
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a class="link" href="connection-options.html#option_general_get-server-public-key">
--get-server-public-key
</a>
</td>
<td>
Request RSA public key from server
</td>
</tr>
<tr>
<td>
<a class="link" href="connection-options.html#option_general_server-public-key-path">
--server-public-key-path
</a>
</td>
<td>
Path name to file containing RSA public key
</td>
</tr>
<tr>
<td>
<a class="link" href="connection-options.html#option_general_ssl-ca">
--ssl-ca
</a>
</td>
<td>
File that contains list of trusted SSL Certificate Authorities
</td>
</tr>
<tr>
<td>
<a class="link" href="connection-options.html#option_general_ssl-capath">
--ssl-capath
</a>
</td>
<td>
Directory that contains trusted SSL Certificate Authority certificate files
</td>
</tr>
<tr>
<td>
<a class="link" href="connection-options.html#option_general_ssl-cert">
--ssl-cert
</a>
</td>
<td>
File that contains X.509 certificate
</td>
</tr>
<tr>
<td>
<a class="link" href="connection-options.html#option_general_ssl-cipher">
--ssl-cipher
</a>
</td>
<td>
Permissible ciphers for connection encryption
</td>
</tr>
<tr>
<td>
<a class="link" href="connection-options.html#option_general_ssl-crl">
--ssl-crl
</a>
</td>
<td>
File that contains certificate revocation lists
</td>
</tr>
<tr>
<td>
<a class="link" href="connection-options.html#option_general_ssl-crlpath">
--ssl-crlpath
</a>
</td>
<td>
Directory that contains certificate revocation-list files
</td>
</tr>
<tr>
<td>
<a class="link" href="connection-options.html#option_general_ssl-fips-mode">
--ssl-fips-mode
</a>
</td>
<td>
Whether to enable FIPS mode on client side
</td>
</tr>
<tr>
<td>
<a class="link" href="connection-options.html#option_general_ssl-key">
--ssl-key
</a>
</td>
<td>
File that contains X.509 key
</td>
</tr>
<tr>
<td>
<a class="link" href="connection-options.html#option_general_ssl-mode">
--ssl-mode
</a>
</td>
<td>
Desired security state of connection to server
</td>
</tr>
<tr>
<td>
<a class="link" href="connection-options.html#option_general_ssl-session-data">
--ssl-session-data
</a>
</td>
<td>
File that contains SSL session data
</td>
</tr>
<tr>
<td>
<a class="link" href="connection-options.html#option_general_ssl-session-data-continue-on-failed-reuse">
--ssl-session-data-continue-on-failed-reuse
</a>
</td>
<td>
Whether to establish connections if session reuse fails
</td>
</tr>
<tr>
<td>
<a class="link" href="connection-options.html#option_general_tls-ciphersuites">
--tls-ciphersuites
</a>
</td>
<td>
Permissible TLSv1.3 ciphersuites for encrypted connections
</td>
</tr>
<tr>
<td>
<a class="link" href="connection-options.html#option_general_tls-version">
--tls-version
</a>
</td>
<td>
Permissible TLS protocols for encrypted connections
</td>
</tr>
</tbody>
</table>
</div>
<div class="table-contents">
<table cellpadding="0" cellspacing="0" style="position: fixed; top: 0px; display: none; left: 401px; width: 739px;">
<thead>
<tr>
<th style="width: 260.906px;">
Option Name
</th>
<th style="width: 477.094px;">
Description
</th>
</tr>
</thead>
</table>
</div>
</div>
<br class="table-break"/>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a name="option_general_get-server-public-key">
</a>
<a class="link" href="connection-options.html#option_general_get-server-public-key">
<code class="option">
--get-server-public-key
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for get-server-public-key">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--get-server-public-key
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
Boolean
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045323213904">
</a>
<p>
Request from the server the public key required for RSA key
pair-based password exchange. This option applies to clients
that authenticate with the
<code class="literal">
caching_sha2_password
</code>
authentication
plugin. For that plugin, the server does not send the public
key unless requested. This option is ignored for accounts
that do not authenticate with that plugin. It is also
ignored if RSA-based password exchange is not used, as is
the case when the client connects to the server using a
secure connection.
</p>
<p>
If
<a class="link" href="connection-options.html#option_general_server-public-key-path">
<code class="option">
--server-public-key-path=
<em class="replaceable">
<code>
file_name
</code>
</em>
</code>
</a>
is given and specifies a valid public key file, it takes
precedence over
<a class="link" href="connection-options.html#option_general_get-server-public-key">
<code class="option">
--get-server-public-key
</code>
</a>
.
</p>
<p>
For information about the
<code class="literal">
caching_sha2_password
</code>
plugin, see
<a class="xref" href="caching-sha2-pluggable-authentication.html" title="8.4.1.2 Caching SHA-2 Pluggable Authentication">
Section 8.4.1.2, “Caching SHA-2 Pluggable Authentication”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_general_server-public-key-path">
</a>
<a class="link" href="connection-options.html#option_general_server-public-key-path">
<code class="option">
--server-public-key-path=
<em class="replaceable">
<code>
file_name
</code>
</em>
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for server-public-key-path">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--server-public-key-path=file_name
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
File name
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045323196160">
</a>
<p>
The path name to a file in PEM format containing a
client-side copy of the public key required by the server
for RSA key pair-based password exchange. This option
applies to clients that authenticate with the
<code class="literal">
sha256_password
</code>
(deprecated) or
<code class="literal">
caching_sha2_password
</code>
authentication
plugin. This option is ignored for accounts that do not
authenticate with one of those plugins. It is also ignored
if RSA-based password exchange is not used, as is the case
when the client connects to the server using a secure
connection.
</p>
<p>
If
<a class="link" href="connection-options.html#option_general_server-public-key-path">
<code class="option">
--server-public-key-path=
<em class="replaceable">
<code>
file_name
</code>
</em>
</code>
</a>
is given and specifies a valid public key file, it takes
precedence over
<a class="link" href="connection-options.html#option_general_get-server-public-key">
<code class="option">
--get-server-public-key
</code>
</a>
.
</p>
<p>
This option is available only if MySQL was built using
OpenSSL.
</p>
<p>
For information about the
<code class="literal">
sha256_password
</code>
(deprecated) and
<code class="literal">
caching_sha2_password
</code>
plugins, see
<a class="xref" href="sha256-pluggable-authentication.html" title="8.4.1.3 SHA-256 Pluggable Authentication">
Section 8.4.1.3, “SHA-256 Pluggable Authentication”
</a>
, and
<a class="xref" href="caching-sha2-pluggable-authentication.html" title="8.4.1.2 Caching SHA-2 Pluggable Authentication">
Section 8.4.1.2, “Caching SHA-2 Pluggable Authentication”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_general_ssl-ca">
</a>
<a class="link" href="connection-options.html#option_general_ssl-ca">
<code class="option">
--ssl-ca=
<em class="replaceable">
<code>
file_name
</code>
</em>
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for ssl-ca">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--ssl-ca=file_name
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
File name
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045323175872">
</a>
<p>
The path name of the Certificate Authority (CA) certificate
file in PEM format. The file contains a list of trusted SSL
Certificate Authorities.
</p>
<p>
To tell the client not to authenticate the server
certificate when establishing an encrypted connection to the
server, specify neither
<a class="link" href="connection-options.html#option_general_ssl-ca">
<code class="option">
--ssl-ca
</code>
</a>
nor
<a class="link" href="connection-options.html#option_general_ssl-capath">
<code class="option">
--ssl-capath
</code>
</a>
. The server
still verifies the client according to any applicable
requirements established for the client account, and it
still uses any
<a class="link" href="server-system-variables.html#sysvar_ssl_ca">
<code class="literal">
ssl_ca
</code>
</a>
or
<a class="link" href="server-system-variables.html#sysvar_ssl_capath">
<code class="literal">
ssl_capath
</code>
</a>
system variable
values specified on the server side.
</p>
<p>
To specify the CA file for the server, set the
<a class="link" href="server-system-variables.html#sysvar_ssl_ca">
<code class="literal">
ssl_ca
</code>
</a>
system variable.
</p>
</li>
<li class="listitem">
<p>
<a name="option_general_ssl-capath">
</a>
<a class="link" href="connection-options.html#option_general_ssl-capath">
<code class="option">
--ssl-capath=
<em class="replaceable">
<code>
dir_name
</code>
</em>
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for ssl-capath">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--ssl-capath=dir_name
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
Directory name
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045323157200">
</a>
<p>
The path name of the directory that contains trusted SSL
certificate authority (CA) certificate files in PEM format.
</p>
<p>
To tell the client not to authenticate the server
certificate when establishing an encrypted connection to the
server, specify neither
<a class="link" href="connection-options.html#option_general_ssl-ca">
<code class="option">
--ssl-ca
</code>
</a>
nor
<a class="link" href="connection-options.html#option_general_ssl-capath">
<code class="option">
--ssl-capath
</code>
</a>
. The server
still verifies the client according to any applicable
requirements established for the client account, and it
still uses any
<a class="link" href="server-system-variables.html#sysvar_ssl_ca">
<code class="literal">
ssl_ca
</code>
</a>
or
<a class="link" href="server-system-variables.html#sysvar_ssl_capath">
<code class="literal">
ssl_capath
</code>
</a>
system variable
values specified on the server side.
</p>
<p>
To specify the CA directory for the server, set the
<a class="link" href="server-system-variables.html#sysvar_ssl_capath">
<code class="literal">
ssl_capath
</code>
</a>
system variable.
</p>
</li>
<li class="listitem">
<p>
<a name="option_general_ssl-cert">
</a>
<a class="link" href="connection-options.html#option_general_ssl-cert">
<code class="option">
--ssl-cert=
<em class="replaceable">
<code>
file_name
</code>
</em>
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for ssl-cert">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--ssl-cert=file_name
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
File name
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045323138640">
</a>
<p>
The path name of the client SSL public key certificate file
in PEM format. Chained SSL certificates are supported.
</p>
<p>
To specify the server SSL public key certificate file, set
the
<a class="link" href="server-system-variables.html#sysvar_ssl_cert">
<code class="literal">
ssl_cert
</code>
</a>
system
variable.
</p>
</li>
<li class="listitem">
<p>
<a name="option_general_ssl-cipher">
</a>
<a class="link" href="connection-options.html#option_general_ssl-cipher">
<code class="option">
--ssl-cipher=
<em class="replaceable">
<code>
cipher_list
</code>
</em>
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for ssl-cipher">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--ssl-cipher=name
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045323125216">
</a>
<p>
The list of permissible encryption ciphers for connections
that use TLSv1.2. If no cipher in the list is supported,
encrypted connections that use these TLS protocols do not
work.
</p>
<p>
For greatest portability,
<em class="replaceable">
<code>
cipher_list
</code>
</em>
should be a list of
one or more cipher names, separated by colons. Examples:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa38345685"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token constant">--ssl-cipher</span><span class="token attr-value"><span class="token punctuation">=</span>AES128-SHA</span>
<span class="token constant">--ssl-cipher</span><span class="token attr-value"><span class="token punctuation">=</span>DHE-RSA-AES128-GCM-SHA256:AES128-SHA</span></code></pre>
</div>
<p>
OpenSSL supports the syntax for specifying ciphers described
in the OpenSSL documentation at
<a class="ulink" href="https://www.openssl.org/docs/manmaster/man1/ciphers.html" target="_blank">
https://www.openssl.org/docs/manmaster/man1/ciphers.html
</a>
.
</p>
<p>
For information about which encryption ciphers MySQL
supports, see
<a class="xref" href="encrypted-connection-protocols-ciphers.html" title="8.3.2 Encrypted Connection TLS Protocols and Ciphers">
Section 8.3.2, “Encrypted Connection TLS Protocols and Ciphers”
</a>
.
</p>
<p>
To specify the encryption ciphers for the server, set the
<a class="link" href="server-system-variables.html#sysvar_ssl_cipher">
<code class="literal">
ssl_cipher
</code>
</a>
system variable.
</p>
</li>
<li class="listitem">
<p>
<a name="option_general_ssl-crl">
</a>
<a class="link" href="connection-options.html#option_general_ssl-crl">
<code class="option">
--ssl-crl=
<em class="replaceable">
<code>
file_name
</code>
</em>
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for ssl-crl">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--ssl-crl=file_name
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
File name
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045323107392">
</a>
<p>
The path name of the file containing certificate revocation
lists in PEM format.
</p>
<p>
If neither
<a class="link" href="connection-options.html#option_general_ssl-crl">
<code class="option">
--ssl-crl
</code>
</a>
nor
<a class="link" href="connection-options.html#option_general_ssl-crlpath">
<code class="option">
--ssl-crlpath
</code>
</a>
is given, no
CRL checks are performed, even if the CA path contains
certificate revocation lists.
</p>
<p>
To specify the revocation-list file for the server, set the
<a class="link" href="server-system-variables.html#sysvar_ssl_crl">
<code class="literal">
ssl_crl
</code>
</a>
system variable.
</p>
</li>
<li class="listitem">
<p>
<a name="option_general_ssl-crlpath">
</a>
<a class="link" href="connection-options.html#option_general_ssl-crlpath">
<code class="option">
--ssl-crlpath=
<em class="replaceable">
<code>
dir_name
</code>
</em>
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for ssl-crlpath">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--ssl-crlpath=dir_name
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
Directory name
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045323091536">
</a>
<p>
The path name of the directory that contains certificate
revocation-list files in PEM format.
</p>
<p>
If neither
<a class="link" href="connection-options.html#option_general_ssl-crl">
<code class="option">
--ssl-crl
</code>
</a>
nor
<a class="link" href="connection-options.html#option_general_ssl-crlpath">
<code class="option">
--ssl-crlpath
</code>
</a>
is given, no
CRL checks are performed, even if the CA path contains
certificate revocation lists.
</p>
<p>
To specify the revocation-list directory for the server, set
the
<a class="link" href="server-system-variables.html#sysvar_ssl_crlpath">
<code class="literal">
ssl_crlpath
</code>
</a>
system
variable.
</p>
</li>
<li class="listitem">
<p>
<a name="option_general_ssl-fips-mode">
</a>
<a class="link" href="connection-options.html#option_general_ssl-fips-mode">
<code class="option">
--ssl-fips-mode={OFF|ON|STRICT}
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for ssl-fips-mode">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--ssl-fips-mode={OFF|ON|STRICT}
</code>
</td>
</tr>
<tr>
<th>
Deprecated
</th>
<td>
Yes
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
Enumeration
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
OFF
</code>
</td>
</tr>
<tr>
<th>
Valid Values
</th>
<td>
<p class="valid-value">
<code class="literal">
OFF
</code>
</p>
<p class="valid-value">
<code class="literal">
ON
</code>
</p>
<p class="valid-value">
<code class="literal">
STRICT
</code>
</p>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045323066704">
</a>
<p>
Controls whether to enable FIPS mode on the client side. The
<a class="link" href="connection-options.html#option_general_ssl-fips-mode">
<code class="option">
--ssl-fips-mode
</code>
</a>
option
differs from other
<code class="option">
--ssl-
<em class="replaceable">
<code>
xxx
</code>
</em>
</code>
options in that it is not used to establish encrypted
connections, but rather to affect which cryptographic
operations to permit. See
<a class="xref" href="fips-mode.html" title="8.8 FIPS Support">
Section 8.8, “FIPS Support”
</a>
.
</p>
<p>
These
<a class="link" href="connection-options.html#option_general_ssl-fips-mode">
<code class="option">
--ssl-fips-mode
</code>
</a>
values
are permissible:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<code class="literal">
OFF
</code>
: Disable FIPS mode.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
ON
</code>
: Enable FIPS mode.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
STRICT
</code>
: Enable
<span class="quote">
“
<span class="quote">
strict
</span>
”
</span>
FIPS mode.
</p>
</li>
</ul>
</div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
If the OpenSSL FIPS Object Module is not available, the
only permissible value for
<a class="link" href="connection-options.html#option_general_ssl-fips-mode">
<code class="option">
--ssl-fips-mode
</code>
</a>
is
<code class="literal">
OFF
</code>
. In this case, setting
<a class="link" href="connection-options.html#option_general_ssl-fips-mode">
<code class="option">
--ssl-fips-mode
</code>
</a>
to
<code class="literal">
ON
</code>
or
<code class="literal">
STRICT
</code>
causes
the client to produce a warning at startup and to operate
in non-FIPS mode.
</p>
</div>
<p>
To specify the FIPS mode for the server, set the
<a class="link" href="server-system-variables.html#sysvar_ssl_fips_mode">
<code class="literal">
ssl_fips_mode
</code>
</a>
system
variable.
</p>
</li>
<li class="listitem">
<p>
<a name="option_general_ssl-key">
</a>
<a class="link" href="connection-options.html#option_general_ssl-key">
<code class="option">
--ssl-key=
<em class="replaceable">
<code>
file_name
</code>
</em>
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for ssl-key">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--ssl-key=file_name
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
File name
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045323038672">
</a>
<p>
The path name of the client SSL private key file in PEM
format. For better security, use a certificate with an RSA
key size of at least 2048 bits.
</p>
<p>
If the key file is protected by a passphrase, the client
program prompts the user for the passphrase. The password
must be given interactively; it cannot be stored in a file.
If the passphrase is incorrect, the program continues as if
it could not read the key.
</p>
<p>
To specify the server SSL private key file, set the
<a class="link" href="server-system-variables.html#sysvar_ssl_key">
<code class="literal">
ssl_key
</code>
</a>
system variable.
</p>
</li>
<li class="listitem">
<p>
<a name="option_general_ssl-mode">
</a>
<a class="link" href="connection-options.html#option_general_ssl-mode">
<code class="option">
--ssl-mode=
<em class="replaceable">
<code>
mode
</code>
</em>
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for ssl-mode">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--ssl-mode=mode
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
Enumeration
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
PREFERRED
</code>
</td>
</tr>
<tr>
<th>
Valid Values
</th>
<td>
<p class="valid-value">
<code class="literal">
DISABLED
</code>
</p>
<p class="valid-value">
<code class="literal">
PREFERRED
</code>
</p>
<p class="valid-value">
<code class="literal">
REQUIRED
</code>
</p>
<p class="valid-value">
<code class="literal">
VERIFY_CA
</code>
</p>
<p class="valid-value">
<code class="literal">
VERIFY_IDENTITY
</code>
</p>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045323015440">
</a>
<p>
This option specifies the desired security state of the
connection to the server. These mode values are permissible,
in order of increasing strictness:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<code class="literal">
DISABLED
</code>
: Establish an unencrypted
connection.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
PREFERRED
</code>
: Establish an encrypted
connection if the server supports encrypted connections,
falling back to an unencrypted connection if an
encrypted connection cannot be established. This is the
default if
<a class="link" href="connection-options.html#option_general_ssl-mode">
<code class="option">
--ssl-mode
</code>
</a>
is
not specified.
</p>
<p>
Connections over Unix socket files are not encrypted
with a mode of
<code class="literal">
PREFERRED
</code>
. To enforce
encryption for Unix socket-file connections, use a mode
of
<code class="literal">
REQUIRED
</code>
or stricter. (However,
socket-file transport is secure by default, so
encrypting a socket-file connection makes it no more
secure and increases CPU load.)
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
REQUIRED
</code>
: Establish an encrypted
connection if the server supports encrypted connections.
The connection attempt fails if an encrypted connection
cannot be established.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
VERIFY_CA
</code>
: Like
<code class="literal">
REQUIRED
</code>
, but additionally verify the
server Certificate Authority (CA) certificate against
the configured CA certificates. The connection attempt
fails if no valid matching CA certificates are found.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
VERIFY_IDENTITY
</code>
: Like
<code class="literal">
VERIFY_CA
</code>
, but additionally perform
host name identity verification by checking the host
name the client uses for connecting to the server
against the identity in the certificate that the server
sends to the client:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: square; ">
<li class="listitem">
<p>
If the client uses OpenSSL 1.0.2 or higher, the
client checks whether the host name that it uses for
connecting matches either the Subject Alternative
Name value or the Common Name value in the server
certificate. Host name identity verification also
works with certificates that specify the Common Name
using wildcards.
</p>
</li>
<li class="listitem">
<p>
Otherwise, the client checks whether the host name
that it uses for connecting matches the Common Name
value in the server certificate.
</p>
</li>
</ul>
</div>
<p>
The connection fails if there is a mismatch. For
encrypted connections, this option helps prevent
man-in-the-middle attacks.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
Host name identity verification with
<code class="literal">
VERIFY_IDENTITY
</code>
does not work with
self-signed certificates that are created
automatically by the server (see
<a class="xref" href="creating-ssl-rsa-files-using-mysql.html" title="8.3.3.1 Creating SSL and RSA Certificates and Keys using MySQL">
Section 8.3.3.1, “Creating SSL and RSA Certificates and Keys using MySQL”
</a>
).
Such self-signed certificates do not contain the
server name as the Common Name value.
</p>
</div>
</li>
</ul>
</div>
<div class="important" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Important
</div>
<p>
The default setting,
<a class="link" href="connection-options.html#option_general_ssl-mode">
<code class="option">
--ssl-mode=PREFERRED
</code>
</a>
,
produces an encrypted connection if the other default
settings are unchanged. However, to help prevent
sophisticated man-in-the-middle attacks, it is important
for the client to verify the server’s identity. The
settings
<a class="link" href="connection-options.html#option_general_ssl-mode">
<code class="option">
--ssl-mode=VERIFY_CA
</code>
</a>
and
<a class="link" href="connection-options.html#option_general_ssl-mode">
<code class="option">
--ssl-mode=VERIFY_IDENTITY
</code>
</a>
are a better choice than the default setting to help
prevent this type of attack. To implement one of these
settings, you must first ensure that the CA certificate
for the server is reliably available to all the clients
that use it in your environment, otherwise availability
issues will result. For this reason, they are not the
default setting.
</p>
</div>
<p>
The
<a class="link" href="connection-options.html#option_general_ssl-mode">
<code class="option">
--ssl-mode
</code>
</a>
option
interacts with CA certificate options as follows:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
If
<a class="link" href="connection-options.html#option_general_ssl-mode">
<code class="option">
--ssl-mode
</code>
</a>
is not
explicitly set otherwise, use of
<a class="link" href="connection-options.html#option_general_ssl-ca">
<code class="option">
--ssl-ca
</code>
</a>
or
<a class="link" href="connection-options.html#option_general_ssl-capath">
<code class="option">
--ssl-capath
</code>
</a>
implies
<a class="link" href="connection-options.html#option_general_ssl-mode">
<code class="option">
--ssl-mode=VERIFY_CA
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
For
<a class="link" href="connection-options.html#option_general_ssl-mode">
<code class="option">
--ssl-mode
</code>
</a>
values of
<code class="literal">
VERIFY_CA
</code>
or
<code class="literal">
VERIFY_IDENTITY
</code>
,
<a class="link" href="connection-options.html#option_general_ssl-ca">
<code class="option">
--ssl-ca
</code>
</a>
or
<a class="link" href="connection-options.html#option_general_ssl-capath">
<code class="option">
--ssl-capath
</code>
</a>
is also
required, to supply a CA certificate that matches the
one used by the server.
</p>
</li>
<li class="listitem">
<p>
An explicit
<a class="link" href="connection-options.html#option_general_ssl-mode">
<code class="option">
--ssl-mode
</code>
</a>
option with a value other than
<code class="literal">
VERIFY_CA
</code>
or
<code class="literal">
VERIFY_IDENTITY
</code>
, together with an
explicit
<a class="link" href="connection-options.html#option_general_ssl-ca">
<code class="option">
--ssl-ca
</code>
</a>
or
<a class="link" href="connection-options.html#option_general_ssl-capath">
<code class="option">
--ssl-capath
</code>
</a>
option,
produces a warning that no verification of the server
certificate is performed, despite a CA certificate
option being specified.
</p>
</li>
</ul>
</div>
<p>
To require use of encrypted connections by a MySQL account,
use
<a class="link" href="create-user.html" title="15.7.1.3 CREATE USER Statement">
<code class="literal">
CREATE USER
</code>
</a>
to create the
account with a
<code class="literal">
REQUIRE SSL
</code>
clause, or use
<a class="link" href="alter-user.html" title="15.7.1.1 ALTER USER Statement">
<code class="literal">
ALTER USER
</code>
</a>
for an existing
account to add a
<code class="literal">
REQUIRE SSL
</code>
clause. This
causes connection attempts by clients that use the account
to be rejected unless MySQL supports encrypted connections
and an encrypted connection can be established.
</p>
<p>
The
<code class="literal">
REQUIRE
</code>
clause permits other
encryption-related options, which can be used to enforce
security requirements stricter than
<code class="literal">
REQUIRE
SSL
</code>
. For additional details about which command
options may or must be specified by clients that connect
using accounts configured using the various
<code class="literal">
REQUIRE
</code>
options, see
<a class="xref" href="create-user.html#create-user-tls" title="CREATE USER SSL/TLS Options">
CREATE USER SSL/TLS Options
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_general_ssl-session-data">
</a>
<a class="link" href="connection-options.html#option_general_ssl-session-data">
<code class="option">
--ssl-session-data=
<em class="replaceable">
<code>
file_name
</code>
</em>
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for ssl-session-data">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--ssl-session-data=file_name
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
File name
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045322953488">
</a>
<p>
The path name of the client SSL session data file in PEM
format for session reuse.
</p>
<p>
When you invoke a MySQL client program with the
<a class="link" href="connection-options.html#option_general_ssl-session-data">
<code class="option">
--ssl-session-data
</code>
</a>
option,
the client attempts to deserialize session data from the
file, if provided, and then use it to establish a new
connection. If you supply a file, but the session is not
reused, then the connection fails unless you also specified
the
<a class="link" href="connection-options.html#option_general_ssl-session-data-continue-on-failed-reuse">
<code class="option">
--ssl-session-data-continue-on-failed-reuse
</code>
</a>
option on the command line when you invoked the client
program.
</p>
<p>
The
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
command,
<code class="literal">
ssl_session_data_print
</code>
, generates the
session data file (see
<a class="xref" href="mysql-commands.html" title="6.5.1.2 mysql Client Commands">
Section 6.5.1.2, “mysql Client Commands”
</a>
).
</p>
</li>
<li class="listitem">
<p>
<a name="option_general_ssl-session-data-continue-on-failed-reuse">
</a>
<a class="link" href="connection-options.html#option_general_ssl-session-data-continue-on-failed-reuse">
<code class="option">
ssl-session-data-continue-on-failed-reuse
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for ssl-session-data-continue-on-failed-reuse">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--ssl-session-data-continue-on-failed-reuse
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
Boolean
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
OFF
</code>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045322933360">
</a>
<p>
Controls whether a new connection is started to replace an
attempted connection that tried but failed to reuse session
data specified with the
<a class="link" href="connection-options.html#option_general_ssl-session-data">
<code class="option">
--ssl-session-data
</code>
</a>
command-line option. By default, the
<a class="link" href="connection-options.html#option_general_ssl-session-data-continue-on-failed-reuse">
<code class="option">
--ssl-session-data-continue-on-failed-reuse
</code>
</a>
command-line option is off, which causes a client program to
return a connect failure when session data are supplied and
not reused.
</p>
<p>
To ensure that a new, unrelated connection opens after
session reuse fails silently, invoke MySQL client programs
with both the
<a class="link" href="connection-options.html#option_general_ssl-session-data">
<code class="option">
--ssl-session-data
</code>
</a>
and
<a class="link" href="connection-options.html#option_general_ssl-session-data-continue-on-failed-reuse">
<code class="option">
--ssl-session-data-continue-on-failed-reuse
</code>
</a>
command-line options.
</p>
</li>
<li class="listitem">
<p>
<a name="option_general_tls-ciphersuites">
</a>
<a class="link" href="connection-options.html#option_general_tls-ciphersuites">
<code class="option">
--tls-ciphersuites=
<em class="replaceable">
<code>
ciphersuite_list
</code>
</em>
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for tls-ciphersuites">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--tls-ciphersuites=ciphersuite_list
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
empty string
</code>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045322914096">
</a>
<p>
This option specifies which ciphersuites the client permits
for encrypted connections that use TLSv1.3. The value is a
list of zero or more colon-separated ciphersuite names. For
example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa31000598"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal">mysql <span class="token constant">--tls-ciphersuites</span>=<span class="token atrule">"<em class="replaceable">suite1</em>:<em class="replaceable">suite2</em>:<em class="replaceable">suite3</em>"</span></code></pre>
</div>
<p>
The ciphersuites that can be named for this option depend on
the SSL library used to compile MySQL. If this option is not
set, the client permits the default set of ciphersuites. If
the option is set to the empty string, no ciphersuites are
enabled and encrypted connections cannot be established. For
more information, see
<a class="xref" href="encrypted-connection-protocols-ciphers.html" title="8.3.2 Encrypted Connection TLS Protocols and Ciphers">
Section 8.3.2, “Encrypted Connection TLS Protocols and Ciphers”
</a>
.
</p>
<p>
To specify which ciphersuites the server permits, set the
<a class="link" href="server-system-variables.html#sysvar_tls_ciphersuites">
<code class="literal">
tls_ciphersuites
</code>
</a>
system
variable.
</p>
</li>
<li class="listitem">
<p>
<a name="option_general_tls-version">
</a>
<a class="link" href="connection-options.html#option_general_tls-version">
<code class="option">
--tls-version=
<em class="replaceable">
<code>
protocol_list
</code>
</em>
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for tls-version">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--tls-version=protocol_list
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<p class="valid-value">
<code class="literal">
TLSv1,TLSv1.1,TLSv1.2,TLSv1.3
</code>
(OpenSSL 1.1.1 or higher)
</p>
<p class="valid-value">
<code class="literal">
TLSv1,TLSv1.1,TLSv1.2
</code>
(otherwise)
</p>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045322892736">
</a>
<p>
This option specifies the TLS protocols the client permits
for encrypted connections. The value is a list of one or
more comma-separated protocol versions. For example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa37562064"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal">mysql <span class="token constant">--tls-version</span>=<span class="token atrule">"TLSv1.2,TLSv1.3"</span></code></pre>
</div>
<p>
The protocols that can be named for this option depend on
the SSL library used to compile MySQL, and on the MySQL
Server release.
</p>
<div class="important" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Important
</div>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
Clients, including MySQL Shell, that support the
<a class="link" href="connection-options.html#option_general_tls-version">
<code class="option">
--tls-version
</code>
</a>
option
cannot make a TLS/SSL connection with the protocol set
to TLSv1 or TLSv1.1. If a client attempts to connect
using these protocols, for TCP connections, the
connection fails, and an error is returned to the
client. For socket connections, if
<a class="link" href="connection-options.html#option_general_ssl-mode">
<code class="option">
--ssl-mode
</code>
</a>
is set to
<code class="literal">
REQUIRED
</code>
, the connection fails,
otherwise the connection is made but with TLS/SSL
disabled. See
<a class="xref" href="encrypted-connection-protocols-ciphers.html#encrypted-connection-deprecated-protocols" title="Removal of Support for the TLSv1 and TLSv1.1 Protocols">
Removal of Support for the TLSv1 and TLSv1.1 Protocols
</a>
for more information.
</p>
</li>
<li class="listitem">
<p>
Support for the TLSv1.3 protocol is available in MySQL
Server, provided that MySQL Server was compiled using
OpenSSL 1.1.1 or higher. The server checks the version
of OpenSSL at startup, and if it is lower than 1.1.1,
TLSv1.3 is removed from the default value for the
server system variables relating to the TLS version
(such as the
<a class="link" href="server-system-variables.html#sysvar_tls_version">
<code class="literal">
tls_version
</code>
</a>
system
variable).
</p>
</li>
</ul>
</div>
</div>
<p>
Permitted protocols should be chosen such as not to leave
<span class="quote">
“
<span class="quote">
holes
</span>
”
</span>
in the list. For example, these values
do not have holes:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa10893026"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token constant">--tls-version</span>=<span class="token atrule">"TLSv1.2,TLSv1.3"</span>
<span class="token constant">--tls-version</span>=<span class="token atrule">"TLSv1.3"</span></code></pre>
</div>
<p>
For details, see
<a class="xref" href="encrypted-connection-protocols-ciphers.html" title="8.3.2 Encrypted Connection TLS Protocols and Ciphers">
Section 8.3.2, “Encrypted Connection TLS Protocols and Ciphers”
</a>
.
</p>
<p>
To specify which TLS protocols the server permits, set the
<a class="link" href="server-system-variables.html#sysvar_tls_version">
<code class="literal">
tls_version
</code>
</a>
system
variable.
</p>
</li>
</ul>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="connection-compression-options">
</a>
Command Options for Connection Compression
</h4>
</div>
</div>
</div>
<p>
This section describes options that enable client programs to
control use of compression for connections to the server. For
additional information and examples showing how to use them, see
<a class="xref" href="connection-compression-control.html" title="6.2.8 Connection Compression Control">
Section 6.2.8, “Connection Compression Control”
</a>
.
</p>
<div class="table">
<a name="idm46045322873520">
</a>
<p class="title">
<b>
Table 6.6 Connection-Compression Option Summary
</b>
</p>
<div class="table-contents">
<table frame="box" rules="all" summary="Command-line options available for compression in connections to the server.">
<colgroup>
<col style="width: 35%"/>
<col style="width: 64%"/>
</colgroup>
<thead>
<tr>
<th>
Option Name
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a class="link" href="connection-options.html#option_general_compress">
--compress
</a>
</td>
<td>
Compress all information sent between client and server
</td>
</tr>
<tr>
<td>
<a class="link" href="connection-options.html#option_general_compression-algorithms">
--compression-algorithms
</a>
</td>
<td>
Permitted compression algorithms for connections to server
</td>
</tr>
<tr>
<td>
<a class="link" href="connection-options.html#option_general_zstd-compression-level">
--zstd-compression-level
</a>
</td>
<td>
Compression level for connections to server that use zstd compression
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br class="table-break"/>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a name="option_general_compress">
</a>
<a class="link" href="connection-options.html#option_general_compress">
<code class="option">
--compress
</code>
</a>
,
<code class="option">
-C
</code>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for compress">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--compress[={OFF|ON}]
</code>
</td>
</tr>
<tr>
<th>
Deprecated
</th>
<td>
Yes
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
Boolean
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
OFF
</code>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045322844224">
</a>
<p>
Compress all information sent between the client and the
server if possible.
</p>
<p>
This option is deprecated. Expect it to be removed in a
future version of MySQL. See
<a class="xref" href="connection-compression-control.html#connection-compression-legacy-configuration" title="Configuring Legacy Connection Compression">
Configuring Legacy Connection Compression
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_general_compression-algorithms">
</a>
<a class="link" href="connection-options.html#option_general_compression-algorithms">
<code class="option">
--compression-algorithms=
<em class="replaceable">
<code>
value
</code>
</em>
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for compression-algorithms">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--compression-algorithms=value
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
Set
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
uncompressed
</code>
</td>
</tr>
<tr>
<th>
Valid Values
</th>
<td>
<p class="valid-value">
<code class="literal">
zlib
</code>
</p>
<p class="valid-value">
<code class="literal">
zstd
</code>
</p>
<p class="valid-value">
<code class="literal">
uncompressed
</code>
</p>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045322823888">
</a>
<p>
The permitted compression algorithms for connections to the
server. The available algorithms are the same as for the
<a class="link" href="server-system-variables.html#sysvar_protocol_compression_algorithms">
<code class="literal">
protocol_compression_algorithms
</code>
</a>
system variable. The default value is
<code class="literal">
uncompressed
</code>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_general_zstd-compression-level">
</a>
<a class="link" href="connection-options.html#option_general_zstd-compression-level">
<code class="option">
--zstd-compression-level=
<em class="replaceable">
<code>
level
</code>
</em>
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for zstd-compression-level">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--zstd-compression-level=#
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
Integer
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045322809936">
</a>
<p>
The compression level to use for connections to the server
that use the
<code class="literal">
zstd
</code>
compression algorithm.
The permitted levels are from 1 to 22, with larger values
indicating increasing levels of compression. The default
<code class="literal">
zstd
</code>
compression level is 3. The
compression level setting has no effect on connections that
do not use
<code class="literal">
zstd
</code>
compression.
</p>
</li>
</ul>
</div>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/example-storage-engine.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title">
<a name="example-storage-engine">
</a>
18.9 The EXAMPLE Storage Engine
</h2>
</div>
</div>
</div>
<a class="indexterm" name="idm46045146970208">
</a>
<a class="indexterm" name="idm46045146969168">
</a>
<p>
The
<code class="literal">
EXAMPLE
</code>
storage engine is a stub engine that
does nothing. Its purpose is to serve as an example in the MySQL
source code that illustrates how to begin writing new storage
engines. As such, it is primarily of interest to developers.
</p>
<p>
To enable the
<code class="literal">
EXAMPLE
</code>
storage engine if you build
MySQL from source, invoke
<span class="command">
<strong>
CMake
</strong>
</span>
with the
<a class="link" href="source-configuration-options.html#option_cmake_storage_engine_options" title="Storage Engine Options">
<code class="option">
-DWITH_EXAMPLE_STORAGE_ENGINE
</code>
</a>
option.
</p>
<p>
To examine the source for the
<code class="literal">
EXAMPLE
</code>
engine,
look in the
<code class="filename">
storage/example
</code>
directory of a
MySQL source distribution.
</p>
<p>
When you create an
<code class="literal">
EXAMPLE
</code>
table, no files are
created. No data can be stored into the table. Retrievals return an
empty result.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa84458103"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> test <span class="token punctuation">(</span>i <span class="token datatype">INT</span><span class="token punctuation">)</span> <span class="token keyword">ENGINE</span> <span class="token operator">=</span> EXAMPLE<span class="token punctuation">;</span>
<span class="token output">Query OK, 0 rows affected (0.78 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">INSERT</span> <span class="token keyword">INTO</span> test <span class="token keyword">VALUES</span> <span class="token keyword">ROW</span><span class="token punctuation">(</span><span class="token number">1</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token keyword">ROW</span><span class="token punctuation">(</span><span class="token number">2</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token keyword">ROW</span><span class="token punctuation">(</span><span class="token number">3</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output">ERROR 1031 (HY000)<span class="token punctuation">:</span> Table storage engine for 'test' doesn't »
have this option
</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> test<span class="token punctuation">;</span>
<span class="token output">Empty set (0.31 sec)</span></code></pre>
</div>
<p>
The
<code class="literal">
EXAMPLE
</code>
storage engine does not support
indexing.
</p>
<p>
The
<code class="literal">
EXAMPLE
</code>
storage engine does not support
partitioning.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/default-privileges.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="default-privileges">
</a>
2.9.4 Securing the Initial MySQL Account
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045326692464">
</a>
<a class="indexterm" name="idm46045326691008">
</a>
<a class="indexterm" name="idm46045326689520">
</a>
<a class="indexterm" name="idm46045326688448">
</a>
<a class="indexterm" name="idm46045326687376">
</a>
<a class="indexterm" name="idm46045326685888">
</a>
<a class="indexterm" name="idm46045326684816">
</a>
<a class="indexterm" name="idm46045326683328">
</a>
<a class="indexterm" name="idm46045326681840">
</a>
<a class="indexterm" name="idm46045326680352">
</a>
<a class="indexterm" name="idm46045326678864">
</a>
<a class="indexterm" name="idm46045326677376">
</a>
<a class="indexterm" name="idm46045326675888">
</a>
<a class="indexterm" name="idm46045326674400">
</a>
<a class="indexterm" name="idm46045326672912">
</a>
<a class="indexterm" name="idm46045326671424">
</a>
<a class="indexterm" name="idm46045326669936">
</a>
<a class="indexterm" name="idm46045326668448">
</a>
<a class="indexterm" name="idm46045326666960">
</a>
<a class="indexterm" name="idm46045326665472">
</a>
<p>
The MySQL installation process involves initializing the data
directory, including the grant tables in the
<code class="literal">
mysql
</code>
system schema that define MySQL accounts.
For details, see
<a class="xref" href="data-directory-initialization.html" title="2.9.1 Initializing the Data Directory">
Section 2.9.1, “Initializing the Data Directory”
</a>
.
</p>
<p>
This section describes how to assign a password to the initial
<code class="literal">
root
</code>
account created during the MySQL
installation procedure, if you have not already done so.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
Alternative means for performing the process described in this
section:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
On Windows, you can perform the process during installation
with MySQL Configurator (see
<a class="xref" href="mysql-configurator.html" title="2.3.2 Configuration: Using MySQL Configurator">
Section 2.3.2, “Configuration: Using MySQL Configurator”
</a>
).
</p>
</li>
<li class="listitem">
<p>
On all platforms, the MySQL distribution includes
<a class="link" href="mysql-secure-installation.html" title="6.4.2 mysql_secure_installation — Improve MySQL Installation Security">
<span class="command">
<strong>
mysql_secure_installation
</strong>
</span>
</a>
, a command-line
utility that automates much of the process of securing a
MySQL installation.
</p>
</li>
<li class="listitem">
<p>
On all platforms, MySQL Workbench is available and offers the
ability to manage user accounts (see
<a class="xref" href="workbench.html" title="Chapter 33 MySQL Workbench">
Chapter 33,
<i>
MySQL Workbench
</i>
</a>
).
</p>
</li>
</ul>
</div>
</div>
<p>
A password may already be assigned to the initial account under
these circumstances:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
On Windows, installations performed using the MSI installer
and MySQL Configurator give you the option of assigning a password.
</p>
</li>
<li class="listitem">
<p>
Installation using the macOS installer generates an initial
random password, which the installer displays to the user in a
dialog box.
</p>
</li>
<li class="listitem">
<p>
Installation using RPM packages generates an initial random
password, which is written to the server error log.
</p>
</li>
<li class="listitem">
<p>
Installations using Debian packages give you the option of
assigning a password.
</p>
</li>
<li class="listitem">
<p>
For data directory initialization performed manually using
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld --initialize
</strong>
</span>
</a>
,
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
generates an initial random
password, marks it expired, and writes it to the server error
log. See
<a class="xref" href="data-directory-initialization.html" title="2.9.1 Initializing the Data Directory">
Section 2.9.1, “Initializing the Data Directory”
</a>
.
</p>
</li>
</ul>
</div>
<p>
The
<code class="literal">
mysql.user
</code>
grant table defines the initial
MySQL user account and its access privileges. Installation of
MySQL creates only a
<code class="literal">
'root'@'localhost'
</code>
superuser account that has all privileges and can do anything. If
the
<code class="literal">
root
</code>
account has an empty password, your
MySQL installation is unprotected: Anyone can connect to the MySQL
server as
<code class="literal">
root
</code>
<span class="emphasis">
<em>
without a
password
</em>
</span>
and be granted all privileges.
</p>
<p>
The
<code class="literal">
'root'@'localhost'
</code>
account also has a row
in the
<code class="literal">
mysql.proxies_priv
</code>
table that enables
granting the
<a class="link" href="privileges-provided.html#priv_proxy">
<code class="literal">
PROXY
</code>
</a>
privilege for
<code class="literal">
''@''
</code>
, that is, for all users and all hosts.
This enables
<code class="literal">
root
</code>
to set up proxy users, as
well as to delegate to other accounts the authority to set up
proxy users. See
<a class="xref" href="proxy-users.html" title="8.2.19 Proxy Users">
Section 8.2.19, “Proxy Users”
</a>
.
</p>
<p>
To assign a password for the initial MySQL
<code class="literal">
root
</code>
account, use the following procedure. Replace
<em class="replaceable">
<code>
root-password
</code>
</em>
in the examples with the
password that you want to use.
</p>
<p>
Start the server if it is not running. For instructions, see
<a class="xref" href="starting-server.html" title="2.9.2 Starting the Server">
Section 2.9.2, “Starting the Server”
</a>
.
</p>
<p>
The initial
<code class="literal">
root
</code>
account may or may not have a
password. Choose whichever of the following procedures applies:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
If the
<code class="literal">
root
</code>
account exists with an initial
random password that has been expired, connect to the server
as
<code class="literal">
root
</code>
using that password, then choose a
new password. This is the case if the data directory was
initialized using
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld --initialize
</strong>
</span>
</a>
,
either manually or using an installer that does not give you
the option of specifying a password during the install
operation. Because the password exists, you must use it to
connect to the server. But because the password is expired,
you cannot use the account for any purpose other than to
choose a new password, until you do choose one.
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
If you do not know the initial random password, look in
the server error log.
</p>
</li>
<li class="listitem">
<p>
Connect to the server as
<code class="literal">
root
</code>
using the
password:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa74733933"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">mysql</span> <span class="token property">-u</span> root <span class="token property">-p</span>
Enter password<span class="token punctuation">:</span> <span class="token punctuation"></span><em class="replaceable"><span class="token punctuation">(</span>enter the random root password here<span class="token punctuation">)</span></em><span class="token punctuation"></span></code></pre>
</div>
</li>
<li class="listitem">
<p>
Choose a new password to replace the random password:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa76905037"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">ALTER</span> <span class="token keyword">USER</span> <span class="token string">'root'</span>@<span class="token string">'localhost'</span> <span class="token keyword">IDENTIFIED</span> <span class="token keyword">BY</span> <span class="token string">'<em class="replaceable">root-password</em>'</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
</ol>
</div>
</li>
<li class="listitem">
<p>
If the
<code class="literal">
root
</code>
account exists but has no
password, connect to the server as
<code class="literal">
root
</code>
using no password, then assign a password. This is the case if
you initialized the data directory using
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
--initialize-insecure
</strong>
</span>
</a>
.
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
Connect to the server as
<code class="literal">
root
</code>
using no
password:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa18688528"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">mysql</span> <span class="token property">-u</span> root <span class="token property">--skip-password</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
Assign a password:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa62412339"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">ALTER</span> <span class="token keyword">USER</span> <span class="token string">'root'</span>@<span class="token string">'localhost'</span> <span class="token keyword">IDENTIFIED</span> <span class="token keyword">BY</span> <span class="token string">'<em class="replaceable">root-password</em>'</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
</ol>
</div>
</li>
</ul>
</div>
<p>
After assigning the
<code class="literal">
root
</code>
account a password,
you must supply that password whenever you connect to the server
using the account. For example, to connect to the server using the
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
client, use this command:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa43093573"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">mysql</span> <span class="token property">-u</span> root <span class="token property">-p</span>
Enter password<span class="token punctuation">:</span> <span class="token punctuation"></span><em class="replaceable"><span class="token punctuation">(</span>enter root password here<span class="token punctuation">)</span></em><span class="token punctuation"></span></code></pre>
</div>
<p>
To shut down the server with
<a class="link" href="mysqladmin.html" title="6.5.2 mysqladmin — A MySQL Server Administration Program">
<span class="command">
<strong>
mysqladmin
</strong>
</span>
</a>
, use
this command:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa33502945"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql">$<span class="token operator">></span> mysqladmin <span class="token operator">-</span>u root <span class="token operator">-</span>p <span class="token keyword">shutdown</span>
Enter <span class="token keyword">password</span>: <span class="token punctuation"></span><em class="replaceable"><span class="token punctuation">(</span>enter root <span class="token keyword">password</span> here<span class="token punctuation">)</span></em><span class="token punctuation"></span></code></pre>
</div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
For additional information about setting passwords, see
<a class="xref" href="assigning-passwords.html" title="8.2.14 Assigning Account Passwords">
Section 8.2.14, “Assigning Account Passwords”
</a>
. If you forget your
<code class="literal">
root
</code>
password after setting it, see
<a class="xref" href="resetting-permissions.html" title="B.3.3.2 How to Reset the Root Password">
Section B.3.3.2, “How to Reset the Root Password”
</a>
.
</p>
<p>
To set up additional accounts, see
<a class="xref" href="creating-accounts.html" title="8.2.8 Adding Accounts, Assigning Privileges, and Dropping Accounts">
Section 8.2.8, “Adding Accounts, Assigning Privileges, and Dropping Accounts”
</a>
.
</p>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/charset-cyrillic-sets.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="charset-cyrillic-sets">
</a>
12.10.6 Cyrillic Character Sets
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045215825072">
</a>
<a class="indexterm" name="idm46045215823584">
</a>
<p>
The Cyrillic character sets and collations are for use with
Belarusian, Bulgarian, Russian, Ukrainian, and Serbian
(Cyrillic) languages.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
cp1251
</code>
(Windows Cyrillic) collations:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<code class="literal">
cp1251_bin
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
cp1251_bulgarian_ci
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
cp1251_general_ci
</code>
(default)
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
cp1251_general_cs
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
cp1251_ukrainian_ci
</code>
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
<code class="literal">
cp866
</code>
(DOS Russian) collations:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<code class="literal">
cp866_bin
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
cp866_general_ci
</code>
(default)
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
<code class="literal">
koi8r
</code>
(KOI8-R Relcom Russian) collations:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<code class="literal">
koi8r_bin
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
koi8r_general_ci
</code>
(default)
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
<code class="literal">
koi8u
</code>
(KOI8-U Ukrainian) collations:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<code class="literal">
koi8u_bin
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
koi8u_general_ci
</code>
(default)
</p>
</li>
</ul>
</div>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/update-optimization.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="update-optimization">
</a>
10.2.5.2 Optimizing UPDATE Statements
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045227629728">
</a>
<p>
An update statement is optimized like a
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
query with the
additional overhead of a write. The speed of the write depends
on the amount of data being updated and the number of indexes
that are updated. Indexes that are not changed do not get
updated.
</p>
<p>
Another way to get fast updates is to delay updates and then
do many updates in a row later. Performing multiple updates
together is much quicker than doing one at a time if you lock
the table.
</p>
<p>
For a
<code class="literal">
MyISAM
</code>
table that uses dynamic row
format, updating a row to a longer total length may split the
row. If you do this often, it is very important to use
<a class="link" href="optimize-table.html" title="15.7.3.4 OPTIMIZE TABLE Statement">
<code class="literal">
OPTIMIZE TABLE
</code>
</a>
occasionally.
See
<a class="xref" href="optimize-table.html" title="15.7.3.4 OPTIMIZE TABLE Statement">
Section 15.7.3.4, “OPTIMIZE TABLE Statement”
</a>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/mysql-enterprise-data-masking.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title">
<a name="mysql-enterprise-data-masking">
</a>
32.7 MySQL Enterprise Data Masking and De-Identification Overview
</h2>
</div>
</div>
</div>
<a class="indexterm" name="idm46045060193440">
</a>
<a class="indexterm" name="idm46045060192336">
</a>
<p>
MySQL Enterprise Edition 5.7 and higher includes MySQL Enterprise Data Masking and De-Identification, implemented as a plugin
library containing a plugin and several loadable functions. Data
masking hides sensitive information by replacing real values with
substitutes. MySQL Enterprise Data Masking and De-Identification functions enable masking existing data using
several methods such as obfuscation (removing identifying
characteristics), generation of formatted random data, and data
replacement or substitution.
</p>
<p>
For more information, see
<a class="xref" href="data-masking.html" title="8.5 MySQL Enterprise Data Masking and De-Identification">
Section 8.5, “MySQL Enterprise Data Masking and De-Identification”
</a>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/table-cache.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="table-cache">
</a>
10.4.3.1 How MySQL Opens and Closes Tables
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045226728992">
</a>
<a class="indexterm" name="idm46045226727952">
</a>
<a class="indexterm" name="idm46045226726464">
</a>
<a class="indexterm" name="idm46045226724976">
</a>
<a class="indexterm" name="idm46045226723488">
</a>
<a class="indexterm" name="idm46045226722000">
</a>
<a class="indexterm" name="idm46045226720512">
</a>
<a class="indexterm" name="idm46045226719024">
</a>
<a class="indexterm" name="idm46045226717952">
</a>
<a class="indexterm" name="idm46045226716464">
</a>
<p>
When you execute a
<a class="link" href="mysqladmin.html" title="6.5.2 mysqladmin — A MySQL Server Administration Program">
<span class="command">
<strong>
mysqladmin status
</strong>
</span>
</a>
command, you should see something like this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-none"><div class="docs-select-all right" id="sa6265405"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-none">Uptime: 426 Running threads: 1 Questions: 11082
Reloads: 1 Open tables: 12</code></pre>
</div>
<p>
The
<code class="literal">
Open tables
</code>
value of 12 can be somewhat
puzzling if you have fewer than 12 tables.
</p>
<p>
MySQL is multithreaded, so there may be many clients issuing
queries for a given table simultaneously. To minimize the
problem with multiple client sessions having different states
on the same table, the table is opened independently by each
concurrent session. This uses additional memory but normally
increases performance. With
<code class="literal">
MyISAM
</code>
tables,
one extra file descriptor is required for the data file for
each client that has the table open. (By contrast, the index
file descriptor is shared between all sessions.)
</p>
<p>
The
<a class="link" href="server-system-variables.html#sysvar_table_open_cache">
<code class="literal">
table_open_cache
</code>
</a>
and
<a class="link" href="server-system-variables.html#sysvar_max_connections">
<code class="literal">
max_connections
</code>
</a>
system
variables affect the maximum number of files the server keeps
open. If you increase one or both of these values, you may run
up against a limit imposed by your operating system on the
per-process number of open file descriptors. Many operating
systems permit you to increase the open-files limit, although
the method varies widely from system to system. Consult your
operating system documentation to determine whether it is
possible to increase the limit and how to do so.
</p>
<p>
<a class="link" href="server-system-variables.html#sysvar_table_open_cache">
<code class="literal">
table_open_cache
</code>
</a>
is related
to
<a class="link" href="server-system-variables.html#sysvar_max_connections">
<code class="literal">
max_connections
</code>
</a>
. For
example, for 200 concurrent running connections, specify a
table cache size of at least
<code class="literal">
200 *
<em class="replaceable">
<code>
N
</code>
</em>
</code>
, where
<em class="replaceable">
<code>
N
</code>
</em>
is the maximum number of tables
per join in any of the queries which you execute. You must
also reserve some extra file descriptors for temporary tables
and files.
</p>
<p>
Make sure that your operating system can handle the number of
open file descriptors implied by the
<a class="link" href="server-system-variables.html#sysvar_table_open_cache">
<code class="literal">
table_open_cache
</code>
</a>
setting. If
<a class="link" href="server-system-variables.html#sysvar_table_open_cache">
<code class="literal">
table_open_cache
</code>
</a>
is set too
high, MySQL may run out of file descriptors and exhibit
symptoms such as refusing connections or failing to perform
queries.
</p>
<p>
Also take into account that the
<code class="literal">
MyISAM
</code>
storage engine needs two file descriptors for each unique open
table. To increase the number of file descriptors available to
MySQL, set the
<a class="link" href="server-system-variables.html#sysvar_open_files_limit">
<code class="literal">
open_files_limit
</code>
</a>
system
variable. See
<a class="xref" href="not-enough-file-handles.html" title="B.3.2.16 File Not Found and Similar Errors">
Section B.3.2.16, “File Not Found and Similar Errors”
</a>
.
</p>
<p>
The cache of open tables is kept at a level of
<a class="link" href="server-system-variables.html#sysvar_table_open_cache">
<code class="literal">
table_open_cache
</code>
</a>
entries. The
server autosizes the cache size at startup. To set the size
explicitly, set the
<a class="link" href="server-system-variables.html#sysvar_table_open_cache">
<code class="literal">
table_open_cache
</code>
</a>
system
variable at startup. MySQL may temporarily open more tables
than this to execute queries, as described later in this
section.
</p>
<p>
MySQL closes an unused table and removes it from the table
cache under the following circumstances:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
When the cache is full and a thread tries to open a table
that is not in the cache.
</p>
</li>
<li class="listitem">
<p>
When the cache contains more than
<a class="link" href="server-system-variables.html#sysvar_table_open_cache">
<code class="literal">
table_open_cache
</code>
</a>
entries
and a table in the cache is no longer being used by any
threads.
</p>
</li>
<li class="listitem">
<p>
When a table-flushing operation occurs. This happens when
someone issues a
<a class="link" href="flush.html#flush-tables">
<code class="literal">
FLUSH
TABLES
</code>
</a>
statement or executes a
<a class="link" href="mysqladmin.html" title="6.5.2 mysqladmin — A MySQL Server Administration Program">
<span class="command">
<strong>
mysqladmin flush-tables
</strong>
</span>
</a>
or
<a class="link" href="mysqladmin.html" title="6.5.2 mysqladmin — A MySQL Server Administration Program">
<span class="command">
<strong>
mysqladmin refresh
</strong>
</span>
</a>
command.
</p>
</li>
</ul>
</div>
<p>
When the table cache fills up, the server uses the following
procedure to locate a cache entry to use:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Tables not currently in use are released, beginning with
the table least recently used.
</p>
</li>
<li class="listitem">
<p>
If a new table must be opened, but the cache is full and
no tables can be released, the cache is temporarily
extended as necessary. When the cache is in a temporarily
extended state and a table goes from a used to unused
state, the table is closed and released from the cache.
</p>
</li>
</ul>
</div>
<p>
A
<code class="literal">
MyISAM
</code>
table is opened for each
concurrent access. This means the table needs to be opened
twice if two threads access the same table or if a thread
accesses the table twice in the same query (for example, by
joining the table to itself). Each concurrent open requires an
entry in the table cache. The first open of any
<code class="literal">
MyISAM
</code>
table takes two file descriptors:
one for the data file and one for the index file. Each
additional use of the table takes only one file descriptor for
the data file. The index file descriptor is shared among all
threads.
</p>
<p>
If you are opening a table with the
<code class="literal">
HANDLER
<em class="replaceable">
<code>
tbl_name
</code>
</em>
OPEN
</code>
statement,
a dedicated table object is allocated for the thread. This
table object is not shared by other threads and is not closed
until the thread calls
<code class="literal">
HANDLER
<em class="replaceable">
<code>
tbl_name
</code>
</em>
CLOSE
</code>
or the
thread terminates. When this happens, the table is put back in
the table cache (if the cache is not full). See
<a class="xref" href="handler.html" title="15.2.5 HANDLER Statement">
Section 15.2.5, “HANDLER Statement”
</a>
.
</p>
<p>
To determine whether your table cache is too small, check the
<a class="link" href="server-status-variables.html#statvar_Opened_tables">
<code class="literal">
Opened_tables
</code>
</a>
status
variable, which indicates the number of table-opening
operations since the server started:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa73282424"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SHOW</span> <span class="token keyword">GLOBAL</span> <span class="token keyword">STATUS</span> <span class="token operator">LIKE</span> <span class="token string">'Opened_tables'</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> Variable_name <span class="token punctuation">|</span> Value <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> Opened_tables <span class="token punctuation">|</span> 2741 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
<p>
If the value is very large or increases rapidly, even when you
have not issued many
<a class="link" href="flush.html#flush-tables">
<code class="literal">
FLUSH
TABLES
</code>
</a>
statements, increase the
<a class="link" href="server-system-variables.html#sysvar_table_open_cache">
<code class="literal">
table_open_cache
</code>
</a>
value at
server startup.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/sys-quote-identifier.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="sys-quote-identifier">
</a>
30.4.5.18 The quote_identifier() Function
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045060712176">
</a>
<a class="indexterm" name="idm46045060710704">
</a>
<p>
Given a string argument, this function produces a quoted
identifier suitable for inclusion in SQL statements. This is
useful when a value to be used as an identifier is a reserved
word or contains backtick (
<code class="literal">
`
</code>
) characters.
</p>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="sys-quote-identifier-parameters">
</a>
Parameters
</h5>
</div>
</div>
</div>
<p>
<code class="literal">
in_identifier TEXT
</code>
: The identifier to
quote.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="sys-quote-identifier-return-value">
</a>
Return Value
</h5>
</div>
</div>
</div>
<p>
A
<code class="literal">
TEXT
</code>
value.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="sys-quote-identifier-example">
</a>
Example
</h5>
</div>
</div>
</div>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa76032543"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> sys<span class="token punctuation">.</span>quote_identifier<span class="token punctuation">(</span><span class="token string">'plain'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> sys.quote_identifier('plain') <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> `plain` <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> sys<span class="token punctuation">.</span>quote_identifier<span class="token punctuation">(</span><span class="token string">'trick`ier'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> sys.quote_identifier('trick`ier') <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> `trick``ier` <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> sys<span class="token punctuation">.</span>quote_identifier<span class="token punctuation">(</span><span class="token string">'integer'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> sys.quote_identifier('integer') <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> `integer` <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/mysql-cluster-computer-definition.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="mysql-cluster-computer-definition">
</a>
25.4.3.4 Defining Computers in an NDB Cluster
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045120535968">
</a>
<a class="indexterm" name="idm46045120534480">
</a>
<p>
The
<code class="literal">
[computer]
</code>
section has no real
significance other than serving as a way to avoid the need of
defining host names for each node in the system. All parameters
mentioned here are required.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a name="ndbparam-computer-id">
</a>
<code class="literal">
Id
</code>
</p>
<div class="informaltable">
<a name="id-computer-table">
</a>
<table frame="box" rules="all" summary="Id computer configuration parameter type and value information" width="35%">
<colgroup>
<col style="width: 50%"/>
<col style="width: 50%"/>
</colgroup>
<tbody>
<tr>
<th>
Version (or later)
</th>
<td>
NDB 8.4.0
</td>
</tr>
<tr>
<th>
Type or units
</th>
<td>
string
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
[...]
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
...
</td>
</tr>
<tr>
<th>
Restart Type
</th>
<td>
<p>
<span class="bold">
<strong>
Initial System Restart:
</strong>
</span>
Requires a complete shutdown of the
cluster, wiping and restoring the cluster file
system from a
<a class="link" href="mysql-cluster-backup.html" title="25.6.8 Online Backup of NDB Cluster">
backup
</a>
,
and then restarting the cluster. (NDB 8.4.0)
</p>
</td>
</tr>
</tbody>
</table>
</div>
<p>
This is a unique identifier, used to refer to the host
computer elsewhere in the configuration file.
</p>
<div class="important" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Important
</div>
<p>
The computer ID is
<span class="emphasis">
<em>
not
</em>
</span>
the same as
the node ID used for a management, API, or data node.
Unlike the case with node IDs, you cannot use
<code class="literal">
NodeId
</code>
in place of
<code class="literal">
Id
</code>
in the
<code class="literal">
[computer]
</code>
section of the
<code class="filename">
config.ini
</code>
file.
</p>
</div>
</li>
<li class="listitem">
<p>
<a name="ndbparam-computer-hostname">
</a>
<code class="literal">
HostName
</code>
</p>
<div class="informaltable">
<a name="hostname-computer-table">
</a>
<table frame="box" rules="all" summary="HostName computer configuration parameter type and value information" width="35%">
<colgroup>
<col style="width: 50%"/>
<col style="width: 50%"/>
</colgroup>
<tbody>
<tr>
<th>
Version (or later)
</th>
<td>
NDB 8.4.0
</td>
</tr>
<tr>
<th>
Type or units
</th>
<td>
name or IP address
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
[...]
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
...
</td>
</tr>
<tr>
<th>
Restart Type
</th>
<td>
<p>
<span class="bold">
<strong>
Node Restart:
</strong>
</span>
Requires a
<a class="link" href="mysql-cluster-rolling-restart.html" title="25.6.5 Performing a Rolling Restart of an NDB Cluster">
rolling
restart
</a>
of the cluster. (NDB 8.4.0)
</p>
</td>
</tr>
</tbody>
</table>
</div>
<p>
This is the computer's hostname or IP address.
</p>
</li>
</ul>
</div>
<p>
<a name="mysql-cluster-computer-definition-restart-types">
</a>
<b>
Restart types.
</b>
Information about the restart types used by the parameter
descriptions in this section is shown in the following table:
</p>
<div class="table">
<a name="idm46045120487424">
</a>
<p class="title">
<b>
Table 25.7 NDB Cluster restart types
</b>
</p>
<div class="table-contents">
<table>
<colgroup>
<col style="width: 10%"/>
<col style="width: 30%"/>
<col style="width: 60%"/>
</colgroup>
<thead>
<tr>
<th scope="col">
Symbol
</th>
<th scope="col">
Restart Type
</th>
<th scope="col">
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">
N
</th>
<td>
Node
</td>
<td>
The parameter can be updated using a rolling restart (see
<a class="xref" href="mysql-cluster-rolling-restart.html" title="25.6.5 Performing a Rolling Restart of an NDB Cluster">
Section 25.6.5, “Performing a Rolling Restart of an NDB Cluster”
</a>
)
</td>
</tr>
<tr>
<th scope="row">
S
</th>
<td>
System
</td>
<td>
All cluster nodes must be shut down completely, then restarted, to
effect a change in this parameter
</td>
</tr>
<tr>
<th scope="row">
I
</th>
<td>
Initial
</td>
<td>
Data nodes must be restarted using the
<a class="link" href="mysql-cluster-programs-ndbd.html#option_ndbd_initial">
<code class="option">
--initial
</code>
</a>
option
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br class="table-break"/>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/macos-installation-pkg.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="macos-installation-pkg">
</a>
2.4.2 Installing MySQL on macOS Using Native Packages
</h3>
</div>
</div>
</div>
<p>
The package is located inside a disk image
(
<code class="literal">
.dmg
</code>
) file that you first need to mount by
double-clicking its icon in the Finder. It should then mount the
image and display its contents.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
Before proceeding with the installation, be sure to stop all
running MySQL server instances by using either the MySQL Manager
Application (on macOS Server), the preference pane, or
<a class="link" href="mysqladmin.html" title="6.5.2 mysqladmin — A MySQL Server Administration Program">
<span class="command">
<strong>
mysqladmin shutdown
</strong>
</span>
</a>
on the command line.
</p>
</div>
<p>
To install MySQL using the package installer:
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
Download the disk image (
<code class="filename">
.dmg
</code>
) file (the
community version is available
<a class="ulink" href="https://dev.mysql.com/downloads/mysql/" target="_top">
here
</a>
) that
contains the MySQL package installer. Double-click the file to
mount the disk image and see its contents.
</p>
<p>
Double-click the MySQL installer package from the disk. It is
named according to the version of MySQL you have downloaded.
For example, for MySQL server 8.4.3 it might be
named
<code class="filename">
mysql-8.4.3-macos-
<em class="replaceable">
<code>
10.13-x86_64
</code>
</em>
.pkg
</code>
.
</p>
</li>
<li class="listitem">
<p>
The initial wizard introduction screen references the MySQL
server version to install. Click
<span class="guibutton">
Continue
</span>
to begin the installation.
</p>
<p>
The MySQL community edition shows a copy of the relevant GNU
General Public License. Click
<span class="guibutton">
Continue
</span>
and then
<span class="guibutton">
Agree
</span>
to continue.
</p>
</li>
<li class="listitem">
<p>
From the
<span class="guilabel">
Installation Type
</span>
page you can
either click
<span class="guibutton">
Install
</span>
to execute the
installation wizard using all defaults, click
<span class="guibutton">
Customize
</span>
to alter which components to
install (MySQL server, MySQL Test, Preference Pane, Launchd
Support -- all but MySQL Test are enabled by default).
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
Although the
<span class="guibutton">
Change Install Location
</span>
option is visible, the installation location cannot be
changed.
</p>
</div>
<div class="figure">
<a name="mac-installer-installation-customize-main">
</a>
<p class="title">
<b>
Figure 2.5 MySQL Package Installer Wizard: Customize
</b>
</p>
<div class="figure-contents">
<div class="mediaobject">
<img alt="Customize shows three package name options: MySQL Server, MySQL Test, Preference Pane, and Launchd Support. All three options are checked." src="images/mac-installer-installation-type-customize.png" style="width: 100%; max-width: 688px;"/>
</div>
</div>
</div>
<br class="figure-break"/>
</li>
<li class="listitem">
<p>
Click
<span class="guibutton">
Install
</span>
to install MySQL Server.
The installation process ends here if upgrading a current
MySQL Server installation, otherwise follow the wizard's
additional configuration steps for your new MySQL Server
installation.
</p>
</li>
<li class="listitem">
<p>
After a successful new MySQL Server installation, complete the
configuration by defining the root password and enabling (or
disabling) the MySQL server at startup.
</p>
</li>
<li class="listitem">
<p>
Define a password for the root user, and also toggle whether
MySQL Server should start after the configuration step is
complete.
</p>
</li>
<li class="listitem">
<p>
<span class="guilabel">
Summary
</span>
is the final step and references
a successful and complete MySQL Server installation.
<span class="guibutton">
Close
</span>
the wizard.
</p>
</li>
</ol>
</div>
<p>
MySQL server is now installed. If you chose to not start MySQL,
then use either launchctl from the command line or start MySQL by
clicking "Start" using the MySQL preference pane. For additional
information, see
<a class="xref" href="macos-installation-launchd.html" title="2.4.3 Installing and Using the MySQL Launch Daemon">
Section 2.4.3, “Installing and Using the MySQL Launch Daemon”
</a>
, and
<a class="xref" href="macos-installation-prefpane.html" title="2.4.4 Installing and Using the MySQL Preference Pane">
Section 2.4.4, “Installing and Using the MySQL Preference Pane”
</a>
. Use the MySQL
Preference Pane or launchd to configure MySQL to automatically
start at bootup.
</p>
<p>
When installing using the package installer, the files are
installed into a directory within
<code class="filename">
/usr/local
</code>
matching the name of the installation version and platform. For
example, the installer file
<code class="filename">
mysql-8.4.3-
<em class="replaceable">
<code>
macos10.15-x86_64.dmg
</code>
</em>
</code>
installs MySQL into
<code class="filename">
/usr/local/mysql-8.4.3-macos10.15-x86_64/
</code>
with a symlink to
<code class="filename">
/usr/local/mysql
</code>
. The following table shows
the layout of this MySQL installation directory.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
The macOS installation process does not create nor install a
sample
<code class="filename">
my.cnf
</code>
MySQL configuration file.
</p>
</div>
<div class="table">
<a name="mysql-installation-layout-macos">
</a>
<p class="title">
<b>
Table 2.6 MySQL Installation Layout on macOS
</b>
</p>
<div class="table-contents">
<table>
<colgroup>
<col style="width: 45%"/>
<col style="width: 55%"/>
</colgroup>
<thead>
<tr>
<th>
Directory
</th>
<th>
Contents of Directory
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<code class="filename">
bin
</code>
</td>
<td>
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
server, client and utility programs
</td>
</tr>
<tr>
<td>
<code class="filename">
data
</code>
</td>
<td>
Log files, databases, where
<code class="filename">
/usr/local/mysql/data/mysqld.local.err
</code>
is the default error log
</td>
</tr>
<tr>
<td>
<code class="filename">
docs
</code>
</td>
<td>
Helper documents, like the Release Notes and build information
</td>
</tr>
<tr>
<td>
<code class="filename">
include
</code>
</td>
<td>
Include (header) files
</td>
</tr>
<tr>
<td>
<code class="filename">
lib
</code>
</td>
<td>
Libraries
</td>
</tr>
<tr>
<td>
<code class="filename">
man
</code>
</td>
<td>
Unix manual pages
</td>
</tr>
<tr>
<td>
<code class="filename">
mysql-test
</code>
</td>
<td>
MySQL test suite ('MySQL Test' is disabled by default during the
installation process when using the installer package (DMG))
</td>
</tr>
<tr>
<td>
<code class="filename">
share
</code>
</td>
<td>
Miscellaneous support files, including error messages,
<code class="filename">
dictionary.txt
</code>
, and rewriter SQL
</td>
</tr>
<tr>
<td>
<code class="filename">
support-files
</code>
</td>
<td>
Support scripts, such as
<code class="filename">
mysqld_multi.server
</code>
,
<code class="filename">
mysql.server
</code>
, and
<code class="filename">
mysql-log-rotate
</code>
.
</td>
</tr>
<tr>
<td>
<code class="filename">
/tmp/mysql.sock
</code>
</td>
<td>
Location of the MySQL Unix socket
</td>
</tr>
</tbody>
</table>
</div>
<div class="table-contents">
<table cellpadding="0" cellspacing="0" style="position: fixed; top: 0px; display: none; left: 401px; width: 739px;">
<thead>
<tr>
<th style="width: 332.094px;">
Directory
</th>
<th style="width: 405.906px;">
Contents of Directory
</th>
</tr>
</thead>
</table>
</div>
</div>
<br class="table-break"/>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/source-installation-methods.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="source-installation-methods">
</a>
2.8.1 Source Installation Methods
</h3>
</div>
</div>
</div>
<p>
There are two methods for installing MySQL from source:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Use a standard MySQL source distribution. To obtain a standard
distribution, see
<a class="xref" href="getting-mysql.html" title="2.1.3 How to Get MySQL">
Section 2.1.3, “How to Get MySQL”
</a>
. For
instructions on building from a standard distribution, see
<a class="xref" href="installing-source-distribution.html" title="2.8.4 Installing MySQL Using a Standard Source Distribution">
Section 2.8.4, “Installing MySQL Using a Standard Source Distribution”
</a>
.
</p>
<p>
Standard distributions are available as compressed
<span class="command">
<strong>
tar
</strong>
</span>
files, Zip archives, or RPM packages.
Distribution files have names of the form
<code class="filename">
mysql-
<em class="replaceable">
<code>
VERSION
</code>
</em>
.tar.gz
</code>
,
<code class="filename">
mysql-
<em class="replaceable">
<code>
VERSION
</code>
</em>
.zip
</code>
,
or
<code class="filename">
mysql-
<em class="replaceable">
<code>
VERSION
</code>
</em>
.rpm
</code>
,
where
<em class="replaceable">
<code>
VERSION
</code>
</em>
is a number like
<code class="literal">
8.4.3
</code>
. File names for source
distributions can be distinguished from those for precompiled
binary distributions in that source distribution names are
generic and include no platform name, whereas binary
distribution names include a platform name indicating the type
of system for which the distribution is intended (for example,
<code class="literal">
pc-linux-i686
</code>
or
<code class="literal">
winx64
</code>
).
</p>
</li>
<li class="listitem">
<p>
Use a MySQL development tree. For information on building from
one of the development trees, see
<a class="xref" href="installing-development-tree.html" title="2.8.5 Installing MySQL Using a Development Source Tree">
Section 2.8.5, “Installing MySQL Using a Development Source Tree”
</a>
.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/index-extensions.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="index-extensions">
</a>
10.3.10 Use of Index Extensions
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045227152256">
</a>
<p>
<a class="link" href="innodb-storage-engine.html" title="Chapter 17 The InnoDB Storage Engine">
<code class="literal">
InnoDB
</code>
</a>
automatically extends each
secondary index by appending the primary key columns to it.
Consider this table definition:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa57790035"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> t1 <span class="token punctuation">(</span>
i1 <span class="token datatype">INT</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span> <span class="token keyword">DEFAULT</span> <span class="token number">0</span><span class="token punctuation">,</span>
i2 <span class="token datatype">INT</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span> <span class="token keyword">DEFAULT</span> <span class="token number">0</span><span class="token punctuation">,</span>
d <span class="token datatype">DATE</span> <span class="token keyword">DEFAULT</span> <span class="token boolean">NULL</span><span class="token punctuation">,</span>
<span class="token keyword">PRIMARY</span> <span class="token keyword">KEY</span> <span class="token punctuation">(</span>i1<span class="token punctuation">,</span> i2<span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">INDEX</span> k_d <span class="token punctuation">(</span>d<span class="token punctuation">)</span>
<span class="token punctuation">)</span> <span class="token keyword">ENGINE</span> <span class="token operator">=</span> InnoDB<span class="token punctuation">;</span></code></pre>
</div>
<p>
This table defines the primary key on columns
<code class="literal">
(i1,
i2)
</code>
. It also defines a secondary index
<code class="literal">
k_d
</code>
on column
<code class="literal">
(d)
</code>
, but
internally
<code class="literal">
InnoDB
</code>
extends this index and
treats it as columns
<code class="literal">
(d, i1, i2)
</code>
.
</p>
<p>
The optimizer takes into account the primary key columns of the
extended secondary index when determining how and whether to use
that index. This can result in more efficient query execution
plans and better performance.
</p>
<p>
The optimizer can use extended secondary indexes for
<code class="literal">
ref
</code>
,
<code class="literal">
range
</code>
, and
<a class="link" href="switchable-optimizations.html#optflag_index-merge">
<code class="literal">
index_merge
</code>
</a>
index access, for
Loose Index Scan access, for join and sorting optimization, and
for
<a class="link" href="aggregate-functions.html#function_min">
<code class="literal">
MIN()
</code>
</a>
/
<a class="link" href="aggregate-functions.html#function_max">
<code class="literal">
MAX()
</code>
</a>
optimization.
</p>
<p>
The following example shows how execution plans are affected by
whether the optimizer uses extended secondary indexes. Suppose
that
<code class="literal">
t1
</code>
is populated with these rows:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa74740673"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">INSERT</span> <span class="token keyword">INTO</span> t1 <span class="token keyword">VALUES</span>
<span class="token punctuation">(</span><span class="token number">1</span><span class="token punctuation">,</span> <span class="token number">1</span><span class="token punctuation">,</span> <span class="token string">'1998-01-01'</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token number">1</span><span class="token punctuation">,</span> <span class="token number">2</span><span class="token punctuation">,</span> <span class="token string">'1999-01-01'</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token punctuation">(</span><span class="token number">1</span><span class="token punctuation">,</span> <span class="token number">3</span><span class="token punctuation">,</span> <span class="token string">'2000-01-01'</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token number">1</span><span class="token punctuation">,</span> <span class="token number">4</span><span class="token punctuation">,</span> <span class="token string">'2001-01-01'</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token punctuation">(</span><span class="token number">1</span><span class="token punctuation">,</span> <span class="token number">5</span><span class="token punctuation">,</span> <span class="token string">'2002-01-01'</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token number">2</span><span class="token punctuation">,</span> <span class="token number">1</span><span class="token punctuation">,</span> <span class="token string">'1998-01-01'</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token punctuation">(</span><span class="token number">2</span><span class="token punctuation">,</span> <span class="token number">2</span><span class="token punctuation">,</span> <span class="token string">'1999-01-01'</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token number">2</span><span class="token punctuation">,</span> <span class="token number">3</span><span class="token punctuation">,</span> <span class="token string">'2000-01-01'</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token punctuation">(</span><span class="token number">2</span><span class="token punctuation">,</span> <span class="token number">4</span><span class="token punctuation">,</span> <span class="token string">'2001-01-01'</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token number">2</span><span class="token punctuation">,</span> <span class="token number">5</span><span class="token punctuation">,</span> <span class="token string">'2002-01-01'</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token punctuation">(</span><span class="token number">3</span><span class="token punctuation">,</span> <span class="token number">1</span><span class="token punctuation">,</span> <span class="token string">'1998-01-01'</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token number">3</span><span class="token punctuation">,</span> <span class="token number">2</span><span class="token punctuation">,</span> <span class="token string">'1999-01-01'</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token punctuation">(</span><span class="token number">3</span><span class="token punctuation">,</span> <span class="token number">3</span><span class="token punctuation">,</span> <span class="token string">'2000-01-01'</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token number">3</span><span class="token punctuation">,</span> <span class="token number">4</span><span class="token punctuation">,</span> <span class="token string">'2001-01-01'</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token punctuation">(</span><span class="token number">3</span><span class="token punctuation">,</span> <span class="token number">5</span><span class="token punctuation">,</span> <span class="token string">'2002-01-01'</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token number">4</span><span class="token punctuation">,</span> <span class="token number">1</span><span class="token punctuation">,</span> <span class="token string">'1998-01-01'</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token punctuation">(</span><span class="token number">4</span><span class="token punctuation">,</span> <span class="token number">2</span><span class="token punctuation">,</span> <span class="token string">'1999-01-01'</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token number">4</span><span class="token punctuation">,</span> <span class="token number">3</span><span class="token punctuation">,</span> <span class="token string">'2000-01-01'</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token punctuation">(</span><span class="token number">4</span><span class="token punctuation">,</span> <span class="token number">4</span><span class="token punctuation">,</span> <span class="token string">'2001-01-01'</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token number">4</span><span class="token punctuation">,</span> <span class="token number">5</span><span class="token punctuation">,</span> <span class="token string">'2002-01-01'</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token punctuation">(</span><span class="token number">5</span><span class="token punctuation">,</span> <span class="token number">1</span><span class="token punctuation">,</span> <span class="token string">'1998-01-01'</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token number">5</span><span class="token punctuation">,</span> <span class="token number">2</span><span class="token punctuation">,</span> <span class="token string">'1999-01-01'</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token punctuation">(</span><span class="token number">5</span><span class="token punctuation">,</span> <span class="token number">3</span><span class="token punctuation">,</span> <span class="token string">'2000-01-01'</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token number">5</span><span class="token punctuation">,</span> <span class="token number">4</span><span class="token punctuation">,</span> <span class="token string">'2001-01-01'</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token punctuation">(</span><span class="token number">5</span><span class="token punctuation">,</span> <span class="token number">5</span><span class="token punctuation">,</span> <span class="token string">'2002-01-01'</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Now consider this query:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa58743772"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">EXPLAIN</span> <span class="token keyword">SELECT</span> <span class="token function">COUNT</span><span class="token punctuation">(</span><span class="token operator">*</span><span class="token punctuation">)</span> <span class="token keyword">FROM</span> t1 <span class="token keyword">WHERE</span> i1 <span class="token operator">=</span> <span class="token number">3</span> <span class="token operator">AND</span> d <span class="token operator">=</span> <span class="token string">'2000-01-01'</span></code></pre>
</div>
<p>
The execution plan depends on whether the extended index is
used.
</p>
<p>
When the optimizer does not consider index extensions, it treats
the index
<code class="literal">
k_d
</code>
as only
<code class="literal">
(d)
</code>
.
<a class="link" href="explain.html" title="15.8.2 EXPLAIN Statement">
<code class="literal">
EXPLAIN
</code>
</a>
for the query produces
this result:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa58512387"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">EXPLAIN</span> <span class="token keyword">SELECT</span> <span class="token function">COUNT</span><span class="token punctuation">(</span><span class="token operator">*</span><span class="token punctuation">)</span> <span class="token keyword">FROM</span> t1 <span class="token keyword">WHERE</span> i1 <span class="token operator">=</span> <span class="token number">3</span> <span class="token operator">AND</span> d <span class="token operator">=</span> <span class="token string">'2000-01-01'</span>\G
<span class="token output"><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span> 1. row <span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span>
id<span class="token punctuation">:</span> 1
select_type<span class="token punctuation">:</span> SIMPLE
table<span class="token punctuation">:</span> t1
type<span class="token punctuation">:</span> ref
possible_keys<span class="token punctuation">:</span> PRIMARY,k_d
key<span class="token punctuation">:</span> k_d
key_len<span class="token punctuation">:</span> 4
ref<span class="token punctuation">:</span> const
rows<span class="token punctuation">:</span> 5
Extra<span class="token punctuation">:</span> Using where; Using index</span></code></pre>
</div>
<p>
When the optimizer takes index extensions into account, it
treats
<code class="literal">
k_d
</code>
as
<code class="literal">
(d, i1, i2)
</code>
.
In this case, it can use the leftmost index prefix
<code class="literal">
(d,
i1)
</code>
to produce a better execution plan:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa14073553"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">EXPLAIN</span> <span class="token keyword">SELECT</span> <span class="token function">COUNT</span><span class="token punctuation">(</span><span class="token operator">*</span><span class="token punctuation">)</span> <span class="token keyword">FROM</span> t1 <span class="token keyword">WHERE</span> i1 <span class="token operator">=</span> <span class="token number">3</span> <span class="token operator">AND</span> d <span class="token operator">=</span> <span class="token string">'2000-01-01'</span>\G
<span class="token output"><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span> 1. row <span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span>
id<span class="token punctuation">:</span> 1
select_type<span class="token punctuation">:</span> SIMPLE
table<span class="token punctuation">:</span> t1
type<span class="token punctuation">:</span> ref
possible_keys<span class="token punctuation">:</span> PRIMARY,k_d
key<span class="token punctuation">:</span> k_d
key_len<span class="token punctuation">:</span> 8
ref<span class="token punctuation">:</span> const,const
rows<span class="token punctuation">:</span> 1
Extra<span class="token punctuation">:</span> Using index</span></code></pre>
</div>
<p>
In both cases,
<code class="literal">
key
</code>
indicates that the
optimizer uses secondary index
<code class="literal">
k_d
</code>
but the
<a class="link" href="explain.html" title="15.8.2 EXPLAIN Statement">
<code class="literal">
EXPLAIN
</code>
</a>
output shows these
improvements from using the extended index:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
key_len
</code>
goes from 4 bytes to 8 bytes,
indicating that key lookups use columns
<code class="literal">
d
</code>
and
<code class="literal">
i1
</code>
, not just
<code class="literal">
d
</code>
.
</p>
</li>
<li class="listitem">
<p>
The
<code class="literal">
ref
</code>
value changes from
<code class="literal">
const
</code>
to
<code class="literal">
const,const
</code>
because the key lookup uses two key parts, not one.
</p>
</li>
<li class="listitem">
<p>
The
<code class="literal">
rows
</code>
count decreases from 5 to 1,
indicating that
<code class="literal">
InnoDB
</code>
should need to
examine fewer rows to produce the result.
</p>
</li>
<li class="listitem">
<p>
The
<code class="literal">
Extra
</code>
value changes from
<code class="literal">
Using where; Using index
</code>
to
<code class="literal">
Using index
</code>
. This means that rows can be
read using only the index, without consulting columns in the
data row.
</p>
</li>
</ul>
</div>
<p>
Differences in optimizer behavior for use of extended indexes
can also be seen with
<a class="link" href="show-status.html" title="15.7.7.37 SHOW STATUS Statement">
<code class="literal">
SHOW
STATUS
</code>
</a>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa9403213"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">FLUSH</span> <span class="token keyword">TABLE</span> t1<span class="token punctuation">;</span>
<span class="token keyword">FLUSH</span> <span class="token keyword">STATUS</span><span class="token punctuation">;</span>
<span class="token keyword">SELECT</span> <span class="token function">COUNT</span><span class="token punctuation">(</span><span class="token operator">*</span><span class="token punctuation">)</span> <span class="token keyword">FROM</span> t1 <span class="token keyword">WHERE</span> i1 <span class="token operator">=</span> <span class="token number">3</span> <span class="token operator">AND</span> d <span class="token operator">=</span> <span class="token string">'2000-01-01'</span><span class="token punctuation">;</span>
<span class="token keyword">SHOW</span> <span class="token keyword">STATUS</span> <span class="token operator">LIKE</span> <span class="token string">'handler_read%'</span></code></pre>
</div>
<p>
The preceding statements include
<a class="link" href="flush.html#flush-tables">
<code class="literal">
FLUSH
TABLES
</code>
</a>
and
<a class="link" href="flush.html#flush-status">
<code class="literal">
FLUSH STATUS
</code>
</a>
to flush the table cache and clear the status counters.
</p>
<p>
Without index extensions,
<a class="link" href="show-status.html" title="15.7.7.37 SHOW STATUS Statement">
<code class="literal">
SHOW
STATUS
</code>
</a>
produces this result:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-none"><div class="docs-select-all right" id="sa95402358"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-none">+-----------------------+-------+
| Variable_name | Value |
+-----------------------+-------+
| Handler_read_first | 0 |
| Handler_read_key | 1 |
| Handler_read_last | 0 |
| Handler_read_next | 5 |
| Handler_read_prev | 0 |
| Handler_read_rnd | 0 |
| Handler_read_rnd_next | 0 |
+-----------------------+-------+</code></pre>
</div>
<p>
With index extensions,
<a class="link" href="show-status.html" title="15.7.7.37 SHOW STATUS Statement">
<code class="literal">
SHOW
STATUS
</code>
</a>
produces this result. The
<a class="link" href="server-status-variables.html#statvar_Handler_read_next">
<code class="literal">
Handler_read_next
</code>
</a>
value
decreases from 5 to 1, indicating more efficient use of the
index:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-none"><div class="docs-select-all right" id="sa96212043"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-none">+-----------------------+-------+
| Variable_name | Value |
+-----------------------+-------+
| Handler_read_first | 0 |
| Handler_read_key | 1 |
| Handler_read_last | 0 |
| Handler_read_next | 1 |
| Handler_read_prev | 0 |
| Handler_read_rnd | 0 |
| Handler_read_rnd_next | 0 |
+-----------------------+-------+</code></pre>
</div>
<p>
The
<a class="link" href="switchable-optimizations.html#optflag_use-index-extensions">
<code class="literal">
use_index_extensions
</code>
</a>
flag
of the
<a class="link" href="server-system-variables.html#sysvar_optimizer_switch">
<code class="literal">
optimizer_switch
</code>
</a>
system
variable permits control over whether the optimizer takes the
primary key columns into account when determining how to use an
<code class="literal">
InnoDB
</code>
table's secondary indexes. By
default,
<a class="link" href="switchable-optimizations.html#optflag_use-index-extensions">
<code class="literal">
use_index_extensions
</code>
</a>
is enabled. To check whether disabling use of index extensions
can improve performance, use this statement:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa28835181"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SET</span> optimizer_switch <span class="token operator">=</span> <span class="token string">'use_index_extensions=off'</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Use of index extensions by the optimizer is subject to the usual
limits on the number of key parts in an index (16) and the
maximum key length (3072 bytes).
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/full-text-adding-collation.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="full-text-adding-collation">
</a>
14.9.7 Adding a User-Defined Collation for Full-Text Indexing
</h3>
</div>
</div>
</div>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Warning
</div>
<p>
User-defined collations are deprecated; you should expect
support for them to be removed in a future version of MySQL.
The server issues a warning for any use of
<code class="literal">
COLLATE
<em class="replaceable">
<code>
user_defined_collation
</code>
</em>
</code>
in
an SQL statement; a warning is also issued when the server is
started with
<a class="link" href="server-system-variables.html#sysvar_collation_server">
<code class="option">
--collation-server
</code>
</a>
set equal to the name of a user-defined collation.
</p>
</div>
<p>
This section describes how to add a user-defined collation for
full-text searches using the built-in full-text parser. The
sample collation is like
<code class="literal">
latin1_swedish_ci
</code>
but treats the
<code class="literal">
'-'
</code>
character as a letter
rather than as a punctuation character so that it can be indexed
as a word character. General information about adding collations
is given in
<a class="xref" href="adding-collation.html" title="12.14 Adding a Collation to a Character Set">
Section 12.14, “Adding a Collation to a Character Set”
</a>
; it is assumed
that you have read it and are familiar with the files involved.
</p>
<p>
To add a collation for full-text indexing, use the following
procedure. The instructions here add a collation for a simple
character set, which as discussed in
<a class="xref" href="adding-collation.html" title="12.14 Adding a Collation to a Character Set">
Section 12.14, “Adding a Collation to a Character Set”
</a>
, can be created using a
configuration file that describes the character set properties.
For a complex character set such as Unicode, create collations
using C source files that describe the character set properties.
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
Add a collation to the
<code class="filename">
Index.xml
</code>
file.
The permitted range of IDs for user-defined collations is
given in
<a class="xref" href="adding-collation-choosing-id.html" title="12.14.2 Choosing a Collation ID">
Section 12.14.2, “Choosing a Collation ID”
</a>
. The
ID must be unused, so choose a value different from 1025 if
that ID is already taken on your system.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-xml"><div class="docs-select-all right" id="sa18389068"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-xml"><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>charset</span> <span class="token attr-name">name</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>latin1<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>
...
<span class="token tag"><span class="token tag"><span class="token punctuation"><</span>collation</span> <span class="token attr-name">name</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>latin1_fulltext_ci<span class="token punctuation">"</span></span> <span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>1025<span class="token punctuation">"</span></span><span class="token punctuation">/></span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>charset</span><span class="token punctuation">></span></span></code></pre>
</div>
</li>
<li class="listitem">
<p>
Declare the sort order for the collation in the
<code class="filename">
latin1.xml
</code>
file. In this case, the
order can be copied from
<code class="literal">
latin1_swedish_ci
</code>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-xml"><div class="docs-select-all right" id="sa33380513"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-xml"><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>collation</span> <span class="token attr-name">name</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>latin1_fulltext_ci<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation"><</span>map</span><span class="token punctuation">></span></span>
00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F
80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF
41 41 41 41 5C 5B 5C 43 45 45 45 45 49 49 49 49
44 4E 4F 4F 4F 4F 5D D7 D8 55 55 55 59 59 DE DF
41 41 41 41 5C 5B 5C 43 45 45 45 45 49 49 49 49
44 4E 4F 4F 4F 4F 5D F7 D8 55 55 55 59 59 DE FF
<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>map</span><span class="token punctuation">></span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>collation</span><span class="token punctuation">></span></span></code></pre>
</div>
</li>
<li class="listitem">
<p>
Modify the
<code class="literal">
ctype
</code>
array in
<code class="filename">
latin1.xml
</code>
. Change the value
corresponding to 0x2D (which is the code for the
<code class="literal">
'-'
</code>
character) from 10 (punctuation) to
01 (uppercase letter). In the following array, this is the
element in the fourth row down, third value from the end.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-xml"><div class="docs-select-all right" id="sa41533233"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-xml"><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>ctype</span><span class="token punctuation">></span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation"><</span>map</span><span class="token punctuation">></span></span>
00
20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20
20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
48 10 10 10 10 10 10 10 10 10 10 10 10 <em class="replaceable">01</em> 10 10
84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10
10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01
01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10
10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02
02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20
10 00 10 02 10 10 10 10 10 10 01 10 01 00 01 00
00 10 10 10 10 10 10 10 10 10 02 10 02 00 02 01
48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
01 01 01 01 01 01 01 10 01 01 01 01 01 01 01 02
02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
02 02 02 02 02 02 02 10 02 02 02 02 02 02 02 02
<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>map</span><span class="token punctuation">></span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>ctype</span><span class="token punctuation">></span></span></code></pre>
</div>
</li>
<li class="listitem">
<p>
Restart the server.
</p>
</li>
<li class="listitem">
<p>
To employ the new collation, include it in the definition of
columns that are to use it:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa34413581"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">DROP</span> <span class="token keyword">TABLE</span> <span class="token keyword">IF</span> <span class="token keyword">EXISTS</span> t1<span class="token punctuation">;</span>
<span class="token output">Query OK, 0 rows affected (0.13 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> t1 <span class="token punctuation">(</span>
a <span class="token datatype">TEXT</span> <span class="token keyword">CHARACTER</span> <span class="token keyword">SET</span> latin1 <span class="token keyword">COLLATE</span> latin1_fulltext_ci<span class="token punctuation">,</span>
<span class="token keyword">FULLTEXT</span> <span class="token keyword">INDEX</span><span class="token punctuation">(</span>a<span class="token punctuation">)</span>
<span class="token punctuation">)</span> <span class="token keyword">ENGINE</span><span class="token operator">=</span>InnoDB<span class="token punctuation">;</span>
<span class="token output">Query OK, 0 rows affected (0.47 sec)</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
Test the collation to verify that hyphen is considered as a
word character:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa8467724"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">INSERT</span> <span class="token keyword">INTO</span> t1 <span class="token keyword">VALUEs</span> <span class="token punctuation">(</span><span class="token string">'----'</span><span class="token punctuation">)</span><span class="token punctuation">,</span><span class="token punctuation">(</span><span class="token string">'....'</span><span class="token punctuation">)</span><span class="token punctuation">,</span><span class="token punctuation">(</span><span class="token string">'abcd'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 3 rows affected (0.22 sec)</span>
<span class="token output">Records: 3 Duplicates: 0 Warnings: 0</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> t1 <span class="token keyword">WHERE</span> <span class="token operator">MATCH</span> a <span class="token keyword">AGAINST</span> <span class="token punctuation">(</span><span class="token string">'----'</span> <span class="token keyword">IN</span> <span class="token datatype">BOOLEAN</span> <span class="token keyword">MODE</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> a <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> <span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span> <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output">1 row in set (0.00 sec)</span></code></pre>
</div>
</li>
</ol>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/mysql-cluster-config-send-buffers.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="mysql-cluster-config-send-buffers">
</a>
25.4.3.14 Configuring NDB Cluster Send Buffer Parameters
</h4>
</div>
</div>
</div>
<p>
The
<code class="literal">
NDB
</code>
kernel employs a unified send buffer
whose memory is allocated dynamically from a pool shared by all
transporters. This means that the size of the send buffer can be
adjusted as necessary. Configuration of the unified send buffer
can accomplished by setting the following parameters:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<b>
TotalSendBufferMemory.
</b>
This parameter can be set for all types of NDB Cluster
nodes—that is, it can be set in the
<code class="literal">
[ndbd]
</code>
,
<code class="literal">
[mgm]
</code>
, and
<code class="literal">
[api]
</code>
(or
<code class="literal">
[mysql]
</code>
)
sections of the
<code class="filename">
config.ini
</code>
file. It
represents the total amount of memory (in bytes) to be
allocated by each node for which it is set for use among
all configured transporters. If set, its minimum is 256KB;
the maximum is 4294967039.
</p>
<p>
To be backward-compatible with existing configurations, this
parameter takes as its default value the sum of the maximum
send buffer sizes of all configured transporters, plus an
additional 32KB (one page) per transporter. The maximum
depends on the type of transporter, as shown in the
following table:
</p>
<div class="table">
<a name="idm46045108533600">
</a>
<p class="title">
<b>
Table 25.22 Transporter types with maximum send buffer sizes
</b>
</p>
<div class="table-contents">
<table>
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<thead>
<tr>
<th>
Transporter
</th>
<th>
Maximum Send Buffer Size (bytes)
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
TCP
</td>
<td>
<a class="link" href="mysql-cluster-tcp-definition.html#ndbparam-tcp-sendbuffermemory">
<code class="literal">
SendBufferMemory
</code>
</a>
(default = 2M)
</td>
</tr>
<tr>
<td>
SHM
</td>
<td>
20K
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br class="table-break"/>
<p>
This enables existing configurations to function in close to
the same way as they did with NDB Cluster 6.3 and earlier,
with the same amount of memory and send buffer space
available to each transporter. However, memory that is
unused by one transporter is not available to other
transporters.
</p>
</li>
<li class="listitem">
<p>
<b>
OverloadLimit.
</b>
This parameter is used in the
<code class="literal">
config.ini
</code>
file
<code class="literal">
[tcp]
</code>
section, and denotes the amount
of unsent data (in bytes) that must be present in the send
buffer before the connection is considered overloaded.
When such an overload condition occurs, transactions that
affect the overloaded connection fail with NDB API Error
1218 (
<span class="errortext">
Send Buffers overloaded in NDB
kernel
</span>
) until the overload status passes. The
default value is 0, in which case the effective overload
limit is calculated as
<code class="literal">
SendBufferMemory *
0.8
</code>
for a given connection. The maximum value
for this parameter is 4G.
</p>
</li>
<li class="listitem">
<p>
<b>
SendBufferMemory.
</b>
This value denotes a hard limit for the amount of memory
that may be used by a single transporter out of the entire
pool specified by
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-totalsendbuffermemory">
<code class="literal">
TotalSendBufferMemory
</code>
</a>
.
However, the sum of
<code class="literal">
SendBufferMemory
</code>
for all configured transporters may be greater than the
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-totalsendbuffermemory">
<code class="literal">
TotalSendBufferMemory
</code>
</a>
that is set for a given node. This is a way to save memory
when many nodes are in use, as long as the maximum amount
of memory is never required by all transporters at the
same time.
</p>
</li>
</ul>
</div>
<p>
You can use the
<a class="link" href="mysql-cluster-ndbinfo-transporters.html" title="25.6.17.66 The ndbinfo transporters Table">
<code class="literal">
ndbinfo.transporters
</code>
</a>
table to
monitor send buffer memory usage, and to detect slowdown and
overload conditions that can adversely affect performance.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/account-categories.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="account-categories">
</a>
8.2.11 Account Categories
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045249170624">
</a>
<a class="indexterm" name="idm46045249169136">
</a>
<a class="indexterm" name="idm46045249167648">
</a>
<a class="indexterm" name="idm46045249166576">
</a>
<a class="indexterm" name="idm46045249165088">
</a>
<p>
MySQL incorporates the concept of user account categories, based
on the
<a class="link" href="privileges-provided.html#priv_system-user">
<code class="literal">
SYSTEM_USER
</code>
</a>
privilege.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="xref" href="account-categories.html#system-user-accounts" title="System and Regular Accounts">
System and Regular Accounts
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="account-categories.html#system-user-operations" title="Operations Affected by the SYSTEM_USER Privilege">
Operations Affected by the SYSTEM_USER Privilege
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="account-categories.html#system-user-sessions" title="System and Regular Sessions">
System and Regular Sessions
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="account-categories.html#protecting-system-accounts" title="Protecting System Accounts Against Manipulation by Regular Accounts">
Protecting System Accounts Against Manipulation by Regular Accounts
</a>
</p>
</li>
</ul>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="system-user-accounts">
</a>
System and Regular Accounts
</h4>
</div>
</div>
</div>
<p>
MySQL incorporates the concept of user account categories, with
system and regular users distinguished according to whether they
have the
<a class="link" href="privileges-provided.html#priv_system-user">
<code class="literal">
SYSTEM_USER
</code>
</a>
privilege:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
A user with the
<a class="link" href="privileges-provided.html#priv_system-user">
<code class="literal">
SYSTEM_USER
</code>
</a>
privilege is a system user.
</p>
</li>
<li class="listitem">
<p>
A user without the
<a class="link" href="privileges-provided.html#priv_system-user">
<code class="literal">
SYSTEM_USER
</code>
</a>
privilege is a
regular user.
</p>
</li>
</ul>
</div>
<p>
The
<a class="link" href="privileges-provided.html#priv_system-user">
<code class="literal">
SYSTEM_USER
</code>
</a>
privilege has an
effect on the accounts to which a given user can apply its other
privileges, as well as whether the user is protected from other
accounts:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
A system user can modify both system and regular accounts.
That is, a user who has the appropriate privileges to
perform a given operation on regular accounts is enabled by
possession of
<a class="link" href="privileges-provided.html#priv_system-user">
<code class="literal">
SYSTEM_USER
</code>
</a>
to
also perform the operation on system accounts. A system
account can be modified only by system users with
appropriate privileges, not by regular users.
</p>
</li>
<li class="listitem">
<p>
A regular user with appropriate privileges can modify
regular accounts, but not system accounts. A regular account
can be modified by both system and regular users with
appropriate privileges.
</p>
</li>
</ul>
</div>
<p>
If a user has the appropriate privileges to perform a given
operation on regular accounts,
<a class="link" href="privileges-provided.html#priv_system-user">
<code class="literal">
SYSTEM_USER
</code>
</a>
enables the user to
also perform the operation on system accounts.
<a class="link" href="privileges-provided.html#priv_system-user">
<code class="literal">
SYSTEM_USER
</code>
</a>
does not imply any
other privilege, so the ability to perform a given account
operation remains predicated on possession of any other required
privileges. For example, if a user can grant the
<a class="link" href="privileges-provided.html#priv_select">
<code class="literal">
SELECT
</code>
</a>
and
<a class="link" href="privileges-provided.html#priv_update">
<code class="literal">
UPDATE
</code>
</a>
privileges to regular
accounts, then with
<a class="link" href="privileges-provided.html#priv_system-user">
<code class="literal">
SYSTEM_USER
</code>
</a>
the user can also grant
<a class="link" href="privileges-provided.html#priv_select">
<code class="literal">
SELECT
</code>
</a>
and
<a class="link" href="privileges-provided.html#priv_update">
<code class="literal">
UPDATE
</code>
</a>
to system accounts.
</p>
<p>
The distinction between system and regular accounts enables
better control over certain account administration issues by
protecting accounts that have the
<a class="link" href="privileges-provided.html#priv_system-user">
<code class="literal">
SYSTEM_USER
</code>
</a>
privilege from
accounts that do not have the privilege. For example, the
<a class="link" href="privileges-provided.html#priv_create-user">
<code class="literal">
CREATE USER
</code>
</a>
privilege enables not
only creation of new accounts, but modification and removal of
existing accounts. Without the system user concept, a user who
has the
<a class="link" href="privileges-provided.html#priv_create-user">
<code class="literal">
CREATE USER
</code>
</a>
privilege can
modify or drop any existing account, including the
<code class="literal">
root
</code>
account. The concept of system user
enables restricting modifications to the
<code class="literal">
root
</code>
account (itself a system account) so they can be made only by
system users. Regular users with the
<a class="link" href="privileges-provided.html#priv_create-user">
<code class="literal">
CREATE
USER
</code>
</a>
privilege can still modify or drop existing
accounts, but only regular accounts.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="system-user-operations">
</a>
Operations Affected by the SYSTEM_USER Privilege
</h4>
</div>
</div>
</div>
<p>
The
<a class="link" href="privileges-provided.html#priv_system-user">
<code class="literal">
SYSTEM_USER
</code>
</a>
privilege affects
these operations:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Account manipulation.
</p>
<p>
Account manipulation includes creating and dropping
accounts, granting and revoking privileges, changing account
authentication characteristics such as credentials or
authentication plugin, and changing other account
characteristics such as password expiration policy.
</p>
<p>
The
<a class="link" href="privileges-provided.html#priv_system-user">
<code class="literal">
SYSTEM_USER
</code>
</a>
privilege is
required to manipulate system accounts using
account-management statements such as
<a class="link" href="create-user.html" title="15.7.1.3 CREATE USER Statement">
<code class="literal">
CREATE USER
</code>
</a>
and
<a class="link" href="grant.html" title="15.7.1.6 GRANT Statement">
<code class="literal">
GRANT
</code>
</a>
. To prevent an account
from modifying system accounts this way, make it a regular
account by not granting it the
<a class="link" href="privileges-provided.html#priv_system-user">
<code class="literal">
SYSTEM_USER
</code>
</a>
privilege.
(However, to fully protect system accounts against regular
accounts, you must also withhold modification privileges for
the
<code class="literal">
mysql
</code>
system schema from regular
accounts. See
<a class="xref" href="account-categories.html#protecting-system-accounts" title="Protecting System Accounts Against Manipulation by Regular Accounts">
Protecting System Accounts Against Manipulation by Regular Accounts
</a>
.)
</p>
</li>
<li class="listitem">
<p>
Killing current sessions and statements executing within
them.
</p>
<p>
To kill a session or statement that is executing with the
<a class="link" href="privileges-provided.html#priv_system-user">
<code class="literal">
SYSTEM_USER
</code>
</a>
privilege, your
own session must have the
<a class="link" href="privileges-provided.html#priv_system-user">
<code class="literal">
SYSTEM_USER
</code>
</a>
privilege, in
addition to any other required privilege
(
<a class="link" href="privileges-provided.html#priv_connection-admin">
<code class="literal">
CONNECTION_ADMIN
</code>
</a>
or the
deprecated
<a class="link" href="privileges-provided.html#priv_super">
<code class="literal">
SUPER
</code>
</a>
privilege).
</p>
<p>
If the user that puts a server in offline mode does not have
the
<a class="link" href="privileges-provided.html#priv_system-user">
<code class="literal">
SYSTEM_USER
</code>
</a>
privilege,
connected client users who have the
<a class="link" href="privileges-provided.html#priv_system-user">
<code class="literal">
SYSTEM_USER
</code>
</a>
privilege are
also not disconnected. However, these users cannot initiate
new connections to the server while it is in offline mode,
unless they have the
<a class="link" href="privileges-provided.html#priv_connection-admin">
<code class="literal">
CONNECTION_ADMIN
</code>
</a>
or
<a class="link" href="privileges-provided.html#priv_super">
<code class="literal">
SUPER
</code>
</a>
privilege as well. It
is only their existing connection that is not terminated,
because the
<a class="link" href="privileges-provided.html#priv_system-user">
<code class="literal">
SYSTEM_USER
</code>
</a>
privilege is required to do that.
</p>
</li>
<li class="listitem">
<p>
Setting the
<code class="literal">
DEFINER
</code>
attribute for stored
objects.
</p>
<p>
To set the
<code class="literal">
DEFINER
</code>
attribute for a stored
object to an account that has the
<a class="link" href="privileges-provided.html#priv_system-user">
<code class="literal">
SYSTEM_USER
</code>
</a>
privilege, you
must have the
<a class="link" href="privileges-provided.html#priv_system-user">
<code class="literal">
SYSTEM_USER
</code>
</a>
privilege, in addition to any other required privilege.
</p>
</li>
<li class="listitem">
<p>
Specifying mandatory roles.
</p>
<p>
A role that has the
<a class="link" href="privileges-provided.html#priv_system-user">
<code class="literal">
SYSTEM_USER
</code>
</a>
privilege cannot
be listed in the value of the
<a class="link" href="server-system-variables.html#sysvar_mandatory_roles">
<code class="literal">
mandatory_roles
</code>
</a>
system
variable.
</p>
</li>
<li class="listitem">
<p>
Overriding
<span class="quote">
“
<span class="quote">
abort
</span>
”
</span>
items in MySQL Enterprise
Audit’s audit log filter.
</p>
<p>
Accounts with the
<a class="link" href="privileges-provided.html#priv_system-user">
<code class="literal">
SYSTEM_USER
</code>
</a>
privilege are automatically assigned the
<a class="link" href="privileges-provided.html#priv_audit-abort-exempt">
<code class="literal">
AUDIT_ABORT_EXEMPT
</code>
</a>
privilege,
so that queries from the account are always executed even if
an
<span class="quote">
“
<span class="quote">
abort
</span>
”
</span>
item in the audit log filter would
block them. Accounts with the
<a class="link" href="privileges-provided.html#priv_system-user">
<code class="literal">
SYSTEM_USER
</code>
</a>
privilege can
therefore be used to regain access to a system following an
audit misconfiguration. See
<a class="xref" href="audit-log.html" title="8.4.5 MySQL Enterprise Audit">
Section 8.4.5, “MySQL Enterprise Audit”
</a>
.
</p>
</li>
</ul>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="system-user-sessions">
</a>
System and Regular Sessions
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045249084816">
</a>
<a class="indexterm" name="idm46045249083360">
</a>
<a class="indexterm" name="idm46045249081872">
</a>
<p>
Sessions executing within the server are distinguished as system
or regular sessions, similar to the distinction between system
and regular users:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
A session that possesses the
<a class="link" href="privileges-provided.html#priv_system-user">
<code class="literal">
SYSTEM_USER
</code>
</a>
privilege is a
system session.
</p>
</li>
<li class="listitem">
<p>
A session that does not possess the
<a class="link" href="privileges-provided.html#priv_system-user">
<code class="literal">
SYSTEM_USER
</code>
</a>
privilege is a
regular session.
</p>
</li>
</ul>
</div>
<p>
A regular session is able to perform only operations permitted
to regular users. A system session is additionally able to
perform operations permitted only to system users.
</p>
<p>
The privileges possessed by a session are those granted directly
to its underlying account, plus those granted to all roles
currently active within the session. Thus, a session may be a
system session because its account has been granted the
<a class="link" href="privileges-provided.html#priv_system-user">
<code class="literal">
SYSTEM_USER
</code>
</a>
privilege directly,
or because the session has activated a role that has the
<a class="link" href="privileges-provided.html#priv_system-user">
<code class="literal">
SYSTEM_USER
</code>
</a>
privilege. Roles
granted to an account that are not active within the session do
not affect session privileges.
</p>
<p>
Because activating and deactivating roles can change the
privileges possessed by sessions, a session may change from a
regular session to a system session or vice versa. If a session
activates or deactivates a role that has the
<a class="link" href="privileges-provided.html#priv_system-user">
<code class="literal">
SYSTEM_USER
</code>
</a>
privilege, the
appropriate change between regular and system session takes
place immediately, for that session only:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
If a regular session activates a role with the
<a class="link" href="privileges-provided.html#priv_system-user">
<code class="literal">
SYSTEM_USER
</code>
</a>
privilege, the
session becomes a system session.
</p>
</li>
<li class="listitem">
<p>
If a system session deactivates a role with the
<a class="link" href="privileges-provided.html#priv_system-user">
<code class="literal">
SYSTEM_USER
</code>
</a>
privilege, the
session becomes a regular session, unless some other role
with the
<a class="link" href="privileges-provided.html#priv_system-user">
<code class="literal">
SYSTEM_USER
</code>
</a>
privilege remains active.
</p>
</li>
</ul>
</div>
<p>
These operations have no effect on existing sessions:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
If the
<a class="link" href="privileges-provided.html#priv_system-user">
<code class="literal">
SYSTEM_USER
</code>
</a>
privilege
is granted to or revoked from an account, existing sessions
for the account do not change between regular and system
sessions. The grant or revoke operation affects only
sessions for subsequent connections by the account.
</p>
</li>
<li class="listitem">
<p>
Statements executed by a stored object invoked within a
session execute with the system or regular status of the
parent session, even if the object
<code class="literal">
DEFINER
</code>
attribute names a system account.
</p>
</li>
</ul>
</div>
<p>
Because role activation affects only sessions and not accounts,
granting a role that has the
<a class="link" href="privileges-provided.html#priv_system-user">
<code class="literal">
SYSTEM_USER
</code>
</a>
privilege to a
regular account does not protect that account against regular
users. The role protects only sessions for the account in which
the role has been activated, and protects the session only
against being killed by regular sessions.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="protecting-system-accounts">
</a>
Protecting System Accounts Against Manipulation by Regular Accounts
</h4>
</div>
</div>
</div>
<p>
Account manipulation includes creating and dropping accounts,
granting and revoking privileges, changing account
authentication characteristics such as credentials or
authentication plugin, and changing other account
characteristics such as password expiration policy.
</p>
<p>
Account manipulation can be done two ways:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
By using account-management statements such as
<a class="link" href="create-user.html" title="15.7.1.3 CREATE USER Statement">
<code class="literal">
CREATE USER
</code>
</a>
and
<a class="link" href="grant.html" title="15.7.1.6 GRANT Statement">
<code class="literal">
GRANT
</code>
</a>
. This is the preferred
method.
</p>
</li>
<li class="listitem">
<p>
By direct grant-table modification using statements such as
<a class="link" href="insert.html" title="15.2.7 INSERT Statement">
<code class="literal">
INSERT
</code>
</a>
and
<a class="link" href="update.html" title="15.2.17 UPDATE Statement">
<code class="literal">
UPDATE
</code>
</a>
. This method is
discouraged but possible for users with the appropriate
privileges on the
<code class="literal">
mysql
</code>
system schema
that contains the grant tables.
</p>
</li>
</ul>
</div>
<p>
To fully protect system accounts against modification by a given
account, make it a regular account and do not grant it
modification privileges for the
<code class="literal">
mysql
</code>
schema:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
The
<a class="link" href="privileges-provided.html#priv_system-user">
<code class="literal">
SYSTEM_USER
</code>
</a>
privilege is
required to manipulate system accounts using
account-management statements. To prevent an account from
modifying system accounts this way, make it a regular
account by not granting
<a class="link" href="privileges-provided.html#priv_system-user">
<code class="literal">
SYSTEM_USER
</code>
</a>
to it. This
includes not granting
<a class="link" href="privileges-provided.html#priv_system-user">
<code class="literal">
SYSTEM_USER
</code>
</a>
to any roles
granted to the account.
</p>
</li>
<li class="listitem">
<p>
Privileges for the
<code class="literal">
mysql
</code>
schema enable
manipulation of system accounts through direct modification
of the grant tables, even if the modifying account is a
regular account. To restrict unauthorized direct
modification of system accounts by a regular account, do not
grant modification privileges for the
<code class="literal">
mysql
</code>
schema to the account (or any roles
granted to the account). If a regular account must have
global privileges that apply to all schemas,
<code class="literal">
mysql
</code>
schema modifications can be
prevented using privilege restrictions imposed using partial
revokes. See
<a class="xref" href="partial-revokes.html" title="8.2.12 Privilege Restriction Using Partial Revokes">
Section 8.2.12, “Privilege Restriction Using Partial Revokes”
</a>
.
</p>
</li>
</ul>
</div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
Unlike withholding the
<a class="link" href="privileges-provided.html#priv_system-user">
<code class="literal">
SYSTEM_USER
</code>
</a>
privilege, which
prevents an account from modifying system accounts but not
regular accounts, withholding
<code class="literal">
mysql
</code>
schema
privileges prevents an account from modifying system accounts
as well as regular accounts. This should not be an issue
because, as mentioned, direct grant-table modification is
discouraged.
</p>
</div>
<p>
Suppose that you want to create a user
<code class="literal">
u1
</code>
who
has all privileges on all schemas, except that
<code class="literal">
u1
</code>
should be a regular user without the
ability to modify system accounts. Assuming that the
<a class="link" href="server-system-variables.html#sysvar_partial_revokes">
<code class="literal">
partial_revokes
</code>
</a>
system variable
is enabled, configure
<code class="literal">
u1
</code>
as follows:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa80402029"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CREATE</span> <span class="token keyword">USER</span> u1 <span class="token keyword">IDENTIFIED</span> <span class="token keyword">BY</span> <span class="token string">'<em class="replaceable">password</em>'</span><span class="token punctuation">;</span>
<span class="token keyword">GRANT</span> <span class="token keyword">ALL</span> <span class="token keyword">ON</span> <span class="token operator">*</span><span class="token punctuation">.</span><span class="token operator">*</span> <span class="token keyword">TO</span> u1 <span class="token keyword">WITH</span> <span class="token keyword">GRANT</span> <span class="token keyword">OPTION</span><span class="token punctuation">;</span>
<span class="token comment" spellcheck="true">-- GRANT ALL includes SYSTEM_USER, so at this point</span>
<span class="token comment" spellcheck="true">-- u1 can manipulate system or regular accounts</span>
<span class="token keyword">REVOKE</span> SYSTEM_USER <span class="token keyword">ON</span> <span class="token operator">*</span><span class="token punctuation">.</span><span class="token operator">*</span> <span class="token keyword">FROM</span> u1<span class="token punctuation">;</span>
<span class="token comment" spellcheck="true">-- Revoking SYSTEM_USER makes u1 a regular user;</span>
<span class="token comment" spellcheck="true">-- now u1 can use account-management statements</span>
<span class="token comment" spellcheck="true">-- to manipulate only regular accounts</span>
<span class="token keyword">REVOKE</span> <span class="token keyword">ALL</span> <span class="token keyword">ON</span> mysql<span class="token punctuation">.</span><span class="token operator">*</span> <span class="token keyword">FROM</span> u1<span class="token punctuation">;</span>
<span class="token comment" spellcheck="true">-- This partial revoke prevents u1 from directly</span>
<span class="token comment" spellcheck="true">-- modifying grant tables to manipulate accounts</span></code></pre>
</div>
<p>
To prevent all
<code class="literal">
mysql
</code>
system schema access by
an account, revoke all its privileges on the
<code class="literal">
mysql
</code>
schema, as just shown. It is also
possible to permit partial
<code class="literal">
mysql
</code>
schema
access, such as read-only access. The following example creates
an account that has
<code class="literal">
SELECT
</code>
,
<code class="literal">
INSERT
</code>
,
<code class="literal">
UPDATE
</code>
, and
<code class="literal">
DELETE
</code>
privileges globally for all schemas,
but only
<code class="literal">
SELECT
</code>
for the
<code class="literal">
mysql
</code>
schema:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa84885593"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CREATE</span> <span class="token keyword">USER</span> u2 <span class="token keyword">IDENTIFIED</span> <span class="token keyword">BY</span> <span class="token string">'<em class="replaceable">password</em>'</span><span class="token punctuation">;</span>
<span class="token keyword">GRANT</span> <span class="token keyword">SELECT</span><span class="token punctuation">,</span> <span class="token keyword">INSERT</span><span class="token punctuation">,</span> <span class="token keyword">UPDATE</span><span class="token punctuation">,</span> <span class="token keyword">DELETE</span> <span class="token keyword">ON</span> <span class="token operator">*</span><span class="token punctuation">.</span><span class="token operator">*</span> <span class="token keyword">TO</span> u2<span class="token punctuation">;</span>
<span class="token keyword">REVOKE</span> <span class="token keyword">INSERT</span><span class="token punctuation">,</span> <span class="token keyword">UPDATE</span><span class="token punctuation">,</span> <span class="token keyword">DELETE</span> <span class="token keyword">ON</span> mysql<span class="token punctuation">.</span><span class="token operator">*</span> <span class="token keyword">FROM</span> u2<span class="token punctuation">;</span></code></pre>
</div>
<p>
Another possibility is to revoke all
<code class="literal">
mysql
</code>
schema privileges but grant access to specific
<code class="literal">
mysql
</code>
tables or columns. This can be done
even with a partial revoke on
<code class="literal">
mysql
</code>
. The
following statements enable read-only access to
<code class="literal">
u1
</code>
within the
<code class="literal">
mysql
</code>
schema, but only for the
<code class="literal">
db
</code>
table and the
<code class="literal">
Host
</code>
and
<code class="literal">
User
</code>
columns of
the
<code class="literal">
user
</code>
table:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa39829176"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CREATE</span> <span class="token keyword">USER</span> u3 <span class="token keyword">IDENTIFIED</span> <span class="token keyword">BY</span> <span class="token string">'<em class="replaceable">password</em>'</span><span class="token punctuation">;</span>
<span class="token keyword">GRANT</span> <span class="token keyword">ALL</span> <span class="token keyword">ON</span> <span class="token operator">*</span><span class="token punctuation">.</span><span class="token operator">*</span> <span class="token keyword">TO</span> u3<span class="token punctuation">;</span>
<span class="token keyword">REVOKE</span> <span class="token keyword">ALL</span> <span class="token keyword">ON</span> mysql<span class="token punctuation">.</span><span class="token operator">*</span> <span class="token keyword">FROM</span> u3<span class="token punctuation">;</span>
<span class="token keyword">GRANT</span> <span class="token keyword">SELECT</span> <span class="token keyword">ON</span> mysql<span class="token punctuation">.</span>db <span class="token keyword">TO</span> u3<span class="token punctuation">;</span>
<span class="token keyword">GRANT</span> <span class="token keyword">SELECT</span><span class="token punctuation">(</span><span class="token keyword">Host</span><span class="token punctuation">,</span><span class="token keyword">User</span><span class="token punctuation">)</span> <span class="token keyword">ON</span> mysql<span class="token punctuation">.</span><span class="token keyword">user</span> <span class="token keyword">TO</span> u3<span class="token punctuation">;</span></code></pre>
</div>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/innodb-adaptive-hash.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="innodb-adaptive-hash">
</a>
17.5.3 Adaptive Hash Index
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045166905424">
</a>
<a class="indexterm" name="idm46045166903936">
</a>
<p>
The adaptive hash index enables
<code class="literal">
InnoDB
</code>
to
perform more like an in-memory database on systems with
appropriate combinations of workload and sufficient memory for the
buffer pool without sacrificing transactional features or
reliability. The adaptive hash index is disabled by the
<a class="link" href="innodb-parameters.html#sysvar_innodb_adaptive_hash_index">
<code class="literal">
innodb_adaptive_hash_index
</code>
</a>
variable, or turned on at server startup by
<code class="literal">
--innodb-adaptive-hash-index
</code>
.
</p>
<p>
Based on the observed pattern of searches, a hash index is built
using a prefix of the index key. The prefix can be any length, and
it may be that only some values in the B-tree appear in the hash
index. Hash indexes are built on demand for the pages of the index
that are accessed often.
</p>
<p>
If a table fits almost entirely in main memory, a hash index
speeds up queries by enabling direct lookup of any element,
turning the index value into a sort of pointer.
<code class="literal">
InnoDB
</code>
has a mechanism that monitors index
searches. If
<code class="literal">
InnoDB
</code>
notices that queries could
benefit from building a hash index, it does so automatically.
</p>
<p>
With some workloads, the speedup from hash index lookups greatly
outweighs the extra work to monitor index lookups and maintain the
hash index structure. Access to the adaptive hash index can
sometimes become a source of contention under heavy workloads,
such as multiple concurrent joins. Queries with
<code class="literal">
LIKE
</code>
operators and
<code class="literal">
%
</code>
wildcards also tend not to benefit. For workloads that do not
benefit from the adaptive hash index, turning it off reduces
unnecessary performance overhead. Because it is difficult to
predict in advance whether the adaptive hash index is appropriate
for a particular system and workload, consider running benchmarks
with it enabled and disabled.
</p>
<p>
The adaptive hash index feature is partitioned. Each index is
bound to a specific partition, and each partition is protected by
a separate latch. Partitioning is controlled by the
<a class="link" href="innodb-parameters.html#sysvar_innodb_adaptive_hash_index_parts">
<code class="literal">
innodb_adaptive_hash_index_parts
</code>
</a>
variable. The
<a class="link" href="innodb-parameters.html#sysvar_innodb_adaptive_hash_index_parts">
<code class="literal">
innodb_adaptive_hash_index_parts
</code>
</a>
variable is set to 8 by default. The maximum setting is 512.
</p>
<p>
You can monitor adaptive hash index use and contention in the
<code class="literal">
SEMAPHORES
</code>
section of
<a class="link" href="show-engine.html" title="15.7.7.16 SHOW ENGINE Statement">
<code class="literal">
SHOW ENGINE INNODB
STATUS
</code>
</a>
output. If there are numerous threads waiting on
rw-latches created in
<code class="filename">
btr0sea.c
</code>
, consider
increasing the number of adaptive hash index partitions or
disabling the adaptive hash index.
</p>
<p>
For information about the performance characteristics of hash
indexes, see
<a class="xref" href="index-btree-hash.html" title="10.3.9 Comparison of B-Tree and Hash Indexes">
Section 10.3.9, “Comparison of B-Tree and Hash Indexes”
</a>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/replication-gtids-concepts.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="replication-gtids-concepts">
</a>
19.1.3.1 GTID Format and Storage
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045146422960">
</a>
<p>
A global transaction identifier (GTID) is a unique identifier
created and associated with each transaction committed on the
server of origin (the source). This identifier is unique not only
to the server on which it originated, but is unique across all
servers in a given replication topology.
</p>
<p>
GTID assignment distinguishes between client transactions, which
are committed on the source, and replicated transactions, which
are reproduced on a replica. When a client transaction is
committed on the source, it is assigned a new GTID, provided that
the transaction was written to the binary log. Client transactions
are guaranteed to have monotonically increasing GTIDs without gaps
between the generated numbers. If a client transaction is not
written to the binary log (for example, because the transaction
was filtered out, or the transaction was read-only), it is not
assigned a GTID on the server of origin.
</p>
<p>
Replicated transactions retain the same GTID that was assigned to
the transaction on the server of origin. The GTID is present
before the replicated transaction begins to execute, and is
persisted even if the replicated transaction is not written to the
binary log on the replica, or is filtered out on the replica. The
<code class="literal">
mysql.gtid_executed
</code>
system table is used to
preserve the assigned GTIDs of all the transactions applied on a
MySQL server, except those that are stored in a currently active
binary log file.
</p>
<p>
The auto-skip function for GTIDs means that a transaction
committed on the source can be applied no more than once on the
replica, which helps to guarantee consistency. Once a transaction
with a given GTID has been committed on a given server, any
attempt to execute a subsequent transaction with the same GTID is
ignored by that server. No error is raised, and no statement in
the transaction is executed.
</p>
<p>
If a transaction with a given GTID has started to execute on a
server, but has not yet committed or rolled back, any attempt to
start a concurrent transaction on the server with the same GTID
blocks. The server neither begins to execute the concurrent
transaction nor returns control to the client. Once the first
attempt at the transaction commits or rolls back, concurrent
sessions that were blocking on the same GTID may proceed. If the
first attempt rolled back, one concurrent session proceeds to
attempt the transaction, and any other concurrent sessions that
were blocking on the same GTID remain blocked. If the first
attempt committed, all the concurrent sessions stop being blocked,
and auto-skip all the statements of the transaction.
</p>
<p>
A GTID is represented as a pair of coordinates, separated by a
colon character (
<code class="literal">
:
</code>
), as shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-ini"><div class="docs-select-all right" id="sa62256146"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-ini"><span class="token constant">GTID</span> <span class="token attr-value"><span class="token punctuation">=</span> <em class="replaceable">source_id</em>:<em class="replaceable">transaction_id</em></span></code></pre>
</div>
<p>
The
<em class="replaceable">
<code>
source_id
</code>
</em>
identifies the
originating server. Normally, the source's
<a class="link" href="replication-options.html#sysvar_server_uuid">
<code class="literal">
server_uuid
</code>
</a>
is used for this
purpose. The
<em class="replaceable">
<code>
transaction_id
</code>
</em>
is a
sequence number determined by the order in which the transaction
was committed on the source. For example, the first transaction to
be committed has
<code class="literal">
1
</code>
as its
<em class="replaceable">
<code>
transaction_id
</code>
</em>
, and the tenth
transaction to be committed on the same originating server is
assigned a
<em class="replaceable">
<code>
transaction_id
</code>
</em>
of
<code class="literal">
10
</code>
. It is not possible for a transaction to
have
<code class="literal">
0
</code>
as a sequence number in a GTID. For
example, the twenty-third transaction to be committed originally
on the server with the UUID
<code class="literal">
3E11FA47-71CA-11E1-9E33-C80AA9429562
</code>
has this
GTID:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-none"><div class="docs-select-all right" id="sa87453132"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-none">3E11FA47-71CA-11E1-9E33-C80AA9429562:23</code></pre>
</div>
<p>
The upper limit for sequence numbers for GTIDs on a server
instance is the number of non-negative values for a signed 64-bit
integer (
<code class="literal">
2
<sup>
63
</sup>
- 1
</code>
, or
<code class="literal">
9223372036854775807
</code>
). If the server runs out of
GTIDs, it takes the action specified by
<a class="link" href="replication-options-binary-log.html#sysvar_binlog_error_action">
<code class="literal">
binlog_error_action
</code>
</a>
. A warning
message is issued when the server instance is approaching the
limit.
</p>
<p>
MySQL 8.4 also supports tagged GTIDs. A tagged GTID
consists of three parts, separated by colon characters, as shown
here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-ini"><div class="docs-select-all right" id="sa47333172"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-ini"><span class="token constant">GTID</span> <span class="token attr-value"><span class="token punctuation">=</span> <em class="replaceable">source_id</em>:<em class="replaceable">tag</em>:<em class="replaceable">transaction_id</em></span></code></pre>
</div>
<p>
In this case, the
<em class="replaceable">
<code>
source_id
</code>
</em>
and
<em class="replaceable">
<code>
transaction_id
</code>
</em>
are as defined
previously. The
<em class="replaceable">
<code>
tag
</code>
</em>
is a user-defined
string used to identify a specific group of transactions; see the
description of the
<a class="link" href="replication-options-gtids.html#sysvar_gtid_next">
<code class="literal">
gtid_next
</code>
</a>
system variable for permitted syntax.
<span class="emphasis">
<em>
Example
</em>
</span>
: the one-hundred-seventeenth
transaction to be committed originally on the server with the UUID
<code class="literal">
ed102faf-eb00-11eb-8f20-0c5415bfaa1d
</code>
and the
tag
<code class="literal">
Domain_1
</code>
has this GTID:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-none"><div class="docs-select-all right" id="sa99473791"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-none">ed102faf-eb00-11eb-8f20-0c5415bfaa1d:Domain_1:117</code></pre>
</div>
<p>
The GTID for a transaction is shown in the output from
<a class="link" href="mysqlbinlog.html" title="6.6.9 mysqlbinlog — Utility for Processing Binary Log Files">
<span class="command">
<strong>
mysqlbinlog
</strong>
</span>
</a>
, and it is used to identify an
individual transaction in the Performance Schema replication
status tables, for example,
<a class="link" href="performance-schema-replication-applier-status-by-worker-table.html" title="29.12.11.7 The replication_applier_status_by_worker Table">
<code class="literal">
replication_applier_status_by_worker
</code>
</a>
.
The value stored by the
<a class="link" href="replication-options-gtids.html#sysvar_gtid_next">
<code class="literal">
gtid_next
</code>
</a>
system variable (
<code class="literal">
@@GLOBAL.gtid_next
</code>
) is a
single GTID.
</p>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="replication-gtids-concepts-gtid-sets">
</a>
GTID Sets
</h5>
</div>
</div>
</div>
<a class="indexterm" name="idm46045146385536">
</a>
<p>
A GTID set is a set comprising one or more single GTIDs or
ranges of GTIDs. GTID sets are used in a MySQL server in several
ways. For example, the values stored by the
<a class="link" href="replication-options-gtids.html#sysvar_gtid_executed">
<code class="literal">
gtid_executed
</code>
</a>
and
<a class="link" href="replication-options-gtids.html#sysvar_gtid_purged">
<code class="literal">
gtid_purged
</code>
</a>
system variables
are GTID sets. The
<a class="link" href="start-replica.html" title="15.4.2.4 START REPLICA Statement">
<code class="literal">
START REPLICA
</code>
</a>
options
<code class="literal">
UNTIL SQL_BEFORE_GTIDS
</code>
and
<code class="literal">
UNTIL SQL_AFTER_GTIDS
</code>
can be used to make a
replica process transactions only up to the first GTID in a GTID
set, or stop after the last GTID in a GTID set. The built-in
functions
<a class="link" href="gtid-functions.html#function_gtid-subset">
<code class="literal">
GTID_SUBSET()
</code>
</a>
and
<a class="link" href="gtid-functions.html#function_gtid-subtract">
<code class="literal">
GTID_SUBTRACT()
</code>
</a>
require GTID sets
as input.
</p>
<p>
A range of GTIDs originating from the same server can be
collapsed into a single expression, as shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-none"><div class="docs-select-all right" id="sa25351248"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-none">3E11FA47-71CA-11E1-9E33-C80AA9429562:1-5</code></pre>
</div>
<p>
The above example represents the first through fifth
transactions originating on the MySQL server whose
<a class="link" href="replication-options.html#sysvar_server_uuid">
<code class="literal">
server_uuid
</code>
</a>
is
<code class="literal">
3E11FA47-71CA-11E1-9E33-C80AA9429562
</code>
.
Multiple single GTIDs or ranges of GTIDs originating from the
same server can also be included in a single expression, with
the GTIDs or ranges separated by colons, as in the following
example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-none"><div class="docs-select-all right" id="sa66354980"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-none">3E11FA47-71CA-11E1-9E33-C80AA9429562:1-3:11:47-49</code></pre>
</div>
<p>
A GTID set can include any combination of single GTIDs and
ranges of GTIDs, and it can include GTIDs originating from
different servers. This example shows the GTID set stored in the
<a class="link" href="replication-options-gtids.html#sysvar_gtid_executed">
<code class="literal">
gtid_executed
</code>
</a>
system variable
(
<code class="literal">
@@GLOBAL.gtid_executed
</code>
) of a replica that
has applied transactions from more than one source:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-none"><div class="docs-select-all right" id="sa73106889"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-none">2174B383-5441-11E8-B90A-C80AA9429562:1-3, 24DA167-0C0C-11E8-8442-00059A3C7B00:1-19</code></pre>
</div>
<p>
When GTID sets are returned from server variables, UUIDs are in
alphabetical order, and numeric intervals are merged and in
ascending order.
</p>
<p>
When constructing a GTID set, a user-defined tag is treated as
part of the UUID. This means that multiple GTIDs originating
from the same server and having the same tag can be included in
a single expression, as shown in this example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-none"><div class="docs-select-all right" id="sa34193782"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-none">3E11FA47-71CA-11E1-9E33-C80AA9429562:Domain_1:1-3:11:47-49</code></pre>
</div>
<p>
GTIDs originating from the same server but having different tags
are treated in a manner similar to those originating from
different servers, like this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-none"><div class="docs-select-all right" id="sa89231599"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-none">3E11FA47-71CA-11E1-9E33-C80AA9429562:Domain_1:1-3:15-21, 3E11FA47-71CA-11E1-9E33-C80AA9429562:Domain_2:8-52</code></pre>
</div>
<p>
The complete syntax for a GTID set is as follows:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa59810557"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><em class="replaceable">gtid_set</em>:
<em class="replaceable">uuid_set</em> <span class="token punctuation">[</span><span class="token punctuation">,</span> <em class="replaceable">uuid_set</em><span class="token punctuation">]</span> <span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span>
<span class="token operator">|</span> <span class="token string">''</span>
<em class="replaceable">uuid_set</em>:
<em class="replaceable">uuid</em>:<span class="token punctuation">[</span><em class="replaceable">tag</em>:<span class="token punctuation">]</span><span class="token keyword"><em class="replaceable">interval</em></span><span class="token punctuation">[</span>:<span class="token keyword"><em class="replaceable">interval</em></span><span class="token punctuation">]</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span>
<em class="replaceable">uuid</em>:
<em class="replaceable">hhhhhhhh</em><span class="token operator">-</span><em class="replaceable">hhhh</em><span class="token operator">-</span><em class="replaceable">hhhh</em><span class="token operator">-</span><em class="replaceable">hhhh</em><span class="token operator">-</span><em class="replaceable">hhhhhhhhhhhh</em>
<em class="replaceable">h</em>:
<span class="token punctuation">[</span><span class="token number">0</span><span class="token operator">-</span><span class="token number">9</span><span class="token operator">|</span>A<span class="token operator">-</span>F<span class="token punctuation">]</span>
<em class="replaceable">tag</em>:
<span class="token punctuation">[</span>a<span class="token operator">-</span>z_<span class="token punctuation">]</span><span class="token punctuation">[</span>a<span class="token operator">-</span>z0<span class="token operator">-</span>9_<span class="token punctuation">]</span>{<span class="token number">0</span><span class="token punctuation">,</span><span class="token number">31</span>}
<span class="token keyword"><em class="replaceable">interval</em></span>:
<em class="replaceable">m</em><span class="token punctuation">[</span><span class="token operator">-</span><em class="replaceable">n</em><span class="token punctuation">]</span>
<span class="token punctuation">(</span><em class="replaceable">m</em> <span class="token operator">>=</span> <span class="token number">1</span><span class="token punctuation">;</span> <em class="replaceable">n</em> <span class="token operator">></span> <em class="replaceable">m</em><span class="token punctuation">)</span></code></pre>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="replication-gtids-gtid-executed-table">
</a>
mysql.gtid_executed Table
</h5>
</div>
</div>
</div>
<a class="indexterm" name="idm46045146351088">
</a>
<a class="indexterm" name="idm46045146350000">
</a>
<a class="indexterm" name="idm46045146348512">
</a>
<a class="indexterm" name="idm46045146347024">
</a>
<a class="indexterm" name="idm46045146345536">
</a>
<p>
GTIDs are stored in a table named
<code class="literal">
gtid_executed
</code>
, in the
<code class="literal">
mysql
</code>
database. A row in this table contains,
for each GTID or set of GTIDs that it represents, the UUID of
the originating server, the user-defined tag (if there is one),
and the starting and ending transaction IDs of the set; for a
row referencing only a single GTID, these last two values are
the same.
</p>
<p>
The
<code class="literal">
mysql.gtid_executed
</code>
table is created (if
it does not already exist) when MySQL Server is installed or
upgraded, using a
<a class="link" href="create-table.html" title="15.1.20 CREATE TABLE Statement">
<code class="literal">
CREATE TABLE
</code>
</a>
statement similar to that shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa96346373"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> gtid_executed <span class="token punctuation">(</span>
source_uuid <span class="token datatype">CHAR</span><span class="token punctuation">(</span><span class="token number">36</span><span class="token punctuation">)</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span><span class="token punctuation">,</span>
interval_start <span class="token datatype">BIGINT</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span><span class="token punctuation">,</span>
interval_end <span class="token datatype">BIGINT</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span><span class="token punctuation">,</span>
gtid_tag <span class="token datatype">CHAR</span><span class="token punctuation">(</span><span class="token number">32</span><span class="token punctuation">)</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span><span class="token punctuation">,</span>
<span class="token keyword">PRIMARY</span> <span class="token keyword">KEY</span> <span class="token punctuation">(</span>source_uuid<span class="token punctuation">,</span> gtid_tag<span class="token punctuation">,</span> interval_start<span class="token punctuation">)</span>
<span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Warning
</div>
<p>
As with other MySQL system tables, do not attempt to create or
modify this table yourself.
</p>
</div>
<a class="indexterm" name="idm46045146336480">
</a>
<p>
The
<code class="literal">
mysql.gtid_executed
</code>
table is provided for
internal use by the MySQL server. It enables a replica to use
GTIDs when binary logging is disabled on the replica, and it
enables retention of the GTID state when the binary logs have
been lost. Note that the
<code class="literal">
mysql.gtid_executed
</code>
table is cleared if you issue
<a class="link" href="reset-binary-logs-and-gtids.html" title="15.4.1.2 RESET BINARY LOGS AND GTIDS Statement">
<code class="literal">
RESET BINARY
LOGS AND GTIDS
</code>
</a>
.
</p>
<p>
GTIDs are stored in the
<code class="literal">
mysql.gtid_executed
</code>
table only when
<a class="link" href="replication-options-gtids.html#sysvar_gtid_mode">
<code class="literal">
gtid_mode
</code>
</a>
is
<code class="literal">
ON
</code>
or
<code class="literal">
ON_PERMISSIVE
</code>
. If
binary logging is disabled (
<code class="literal">
log_bin
</code>
is
<code class="literal">
OFF
</code>
), or if
<a class="link" href="replication-options-binary-log.html#sysvar_log_replica_updates">
<code class="literal">
log_replica_updates
</code>
</a>
is
disabled, the server stores the GTID belonging to each
transaction together with the transaction in the buffer when the
transaction is committed, and the background thread adds the
contents of the buffer periodically as one or more entries to
the
<code class="literal">
mysql.gtid_executed
</code>
table. In addition,
the table is compressed periodically at a user-configurable
rate, as described in
<a class="xref" href="replication-gtids-concepts.html#replication-gtids-gtid-executed-table-compression" title="mysql.gtid_executed Table Compression">
mysql.gtid_executed Table Compression
</a>
.
</p>
<p>
If binary logging is enabled (
<code class="literal">
log_bin
</code>
is
<code class="literal">
ON
</code>
), for the
<code class="literal">
InnoDB
</code>
storage engine only, the server updates the
<code class="literal">
mysql.gtid_executed
</code>
table in the same way as
when binary logging or replica update logging is disabled,
storing the GTID for each transaction at transaction commit
time. For other storage engines, the server updates the
<code class="literal">
mysql.gtid_executed
</code>
table only when the
binary log is rotated or the server is shut down. At these
times, the server writes GTIDs for all transactions that were
written into the previous binary log into the
<code class="literal">
mysql.gtid_executed
</code>
table.
</p>
<p>
If the
<code class="literal">
mysql.gtid_executed
</code>
table cannot be
accessed for writes, and the binary log file is rotated for any
reason other than reaching the maximum file size
(
<a class="link" href="replication-options-binary-log.html#sysvar_max_binlog_size">
<code class="literal">
max_binlog_size
</code>
</a>
), the current
binary log file continues to be used. An error message is
returned to the client that requested the rotation, and a
warning is logged on the server. If the
<code class="literal">
mysql.gtid_executed
</code>
table cannot be accessed
for writes and
<a class="link" href="replication-options-binary-log.html#sysvar_max_binlog_size">
<code class="literal">
max_binlog_size
</code>
</a>
is reached, the server responds according to its
<a class="link" href="replication-options-binary-log.html#sysvar_binlog_error_action">
<code class="literal">
binlog_error_action
</code>
</a>
setting. If
<code class="literal">
IGNORE_ERROR
</code>
is set, an error is logged on
the server and binary logging is halted, or if
<code class="literal">
ABORT_SERVER
</code>
is set, the server shuts down.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="replication-gtids-gtid-executed-table-compression">
</a>
mysql.gtid_executed Table Compression
</h5>
</div>
</div>
</div>
<a class="indexterm" name="idm46045146309408">
</a>
<a class="indexterm" name="idm46045146307904">
</a>
<a class="indexterm" name="idm46045146306816">
</a>
<a class="indexterm" name="idm46045146305296">
</a>
<p>
Over the course of time, the
<code class="literal">
mysql.gtid_executed
</code>
table can become filled
with many rows referring to individual GTIDs that originate on
the same server, have the same GTID tag (if any), and whose
transaction IDs make up a range, similar to what is shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa85048720"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> source_uuid <span class="token punctuation">|</span> interval_start <span class="token punctuation">|</span> interval_end <span class="token punctuation">|</span> gtid_tag <span class="token punctuation">|</span></span>
<span class="token operator">|</span><span class="token comment" spellcheck="true">--------------------------------------+----------------+--------------|----------+</span>
<span class="token output"><span class="token punctuation">|</span> 3E11FA47<span class="token punctuation">-</span>71CA<span class="token punctuation">-</span>11E1<span class="token punctuation">-</span>9E33<span class="token punctuation">-</span>C80AA9429562 <span class="token punctuation">|</span> 31 <span class="token punctuation">|</span> 31 <span class="token punctuation">|</span> Domain_1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 3E11FA47<span class="token punctuation">-</span>71CA<span class="token punctuation">-</span>11E1<span class="token punctuation">-</span>9E33<span class="token punctuation">-</span>C80AA9429562 <span class="token punctuation">|</span> 32 <span class="token punctuation">|</span> 32 <span class="token punctuation">|</span> Domain_1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 3E11FA47<span class="token punctuation">-</span>71CA<span class="token punctuation">-</span>11E1<span class="token punctuation">-</span>9E33<span class="token punctuation">-</span>C80AA9429562 <span class="token punctuation">|</span> 33 <span class="token punctuation">|</span> 33 <span class="token punctuation">|</span> Domain_1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 3E11FA47<span class="token punctuation">-</span>71CA<span class="token punctuation">-</span>11E1<span class="token punctuation">-</span>9E33<span class="token punctuation">-</span>C80AA9429562 <span class="token punctuation">|</span> 34 <span class="token punctuation">|</span> 34 <span class="token punctuation">|</span> Domain_1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 3E11FA47<span class="token punctuation">-</span>71CA<span class="token punctuation">-</span>11E1<span class="token punctuation">-</span>9E33<span class="token punctuation">-</span>C80AA9429562 <span class="token punctuation">|</span> 35 <span class="token punctuation">|</span> 35 <span class="token punctuation">|</span> Domain_1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 3E11FA47<span class="token punctuation">-</span>71CA<span class="token punctuation">-</span>11E1<span class="token punctuation">-</span>9E33<span class="token punctuation">-</span>C80AA9429562 <span class="token punctuation">|</span> 36 <span class="token punctuation">|</span> 36 <span class="token punctuation">|</span> Domain_2 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 3E11FA47<span class="token punctuation">-</span>71CA<span class="token punctuation">-</span>11E1<span class="token punctuation">-</span>9E33<span class="token punctuation">-</span>C80AA9429562 <span class="token punctuation">|</span> 37 <span class="token punctuation">|</span> 37 <span class="token punctuation">|</span> Domain_2 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 3E11FA47<span class="token punctuation">-</span>71CA<span class="token punctuation">-</span>11E1<span class="token punctuation">-</span>9E33<span class="token punctuation">-</span>C80AA9429562 <span class="token punctuation">|</span> 38 <span class="token punctuation">|</span> 38 <span class="token punctuation">|</span> Domain_2 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 3E11FA47<span class="token punctuation">-</span>71CA<span class="token punctuation">-</span>11E1<span class="token punctuation">-</span>9E33<span class="token punctuation">-</span>C80AA9429562 <span class="token punctuation">|</span> 39 <span class="token punctuation">|</span> 39 <span class="token punctuation">|</span> Domain_2 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 3E11FA47<span class="token punctuation">-</span>71CA<span class="token punctuation">-</span>11E1<span class="token punctuation">-</span>9E33<span class="token punctuation">-</span>C80AA9429562 <span class="token punctuation">|</span> 40 <span class="token punctuation">|</span> 40 <span class="token punctuation">|</span> Domain_1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 3E11FA47<span class="token punctuation">-</span>71CA<span class="token punctuation">-</span>11E1<span class="token punctuation">-</span>9E33<span class="token punctuation">-</span>C80AA9429562 <span class="token punctuation">|</span> 41 <span class="token punctuation">|</span> 41 <span class="token punctuation">|</span> Domain_1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 3E11FA47<span class="token punctuation">-</span>71CA<span class="token punctuation">-</span>11E1<span class="token punctuation">-</span>9E33<span class="token punctuation">-</span>C80AA9429562 <span class="token punctuation">|</span> 42 <span class="token punctuation">|</span> 42 <span class="token punctuation">|</span> Domain_1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 3E11FA47<span class="token punctuation">-</span>71CA<span class="token punctuation">-</span>11E1<span class="token punctuation">-</span>9E33<span class="token punctuation">-</span>C80AA9429562 <span class="token punctuation">|</span> 43 <span class="token punctuation">|</span> 43 <span class="token punctuation">|</span> Domain_1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 3E11FA47<span class="token punctuation">-</span>71CA<span class="token punctuation">-</span>11E1<span class="token punctuation">-</span>9E33<span class="token punctuation">-</span>C80AA9429562 <span class="token punctuation">|</span> 44 <span class="token punctuation">|</span> 44 <span class="token punctuation">|</span> Domain_2 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 3E11FA47<span class="token punctuation">-</span>71CA<span class="token punctuation">-</span>11E1<span class="token punctuation">-</span>9E33<span class="token punctuation">-</span>C80AA9429562 <span class="token punctuation">|</span> 45 <span class="token punctuation">|</span> 45 <span class="token punctuation">|</span> Domain_2 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 3E11FA47<span class="token punctuation">-</span>71CA<span class="token punctuation">-</span>11E1<span class="token punctuation">-</span>9E33<span class="token punctuation">-</span>C80AA9429562 <span class="token punctuation">|</span> 46 <span class="token punctuation">|</span> 46 <span class="token punctuation">|</span> Domain_2 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 3E11FA47<span class="token punctuation">-</span>71CA<span class="token punctuation">-</span>11E1<span class="token punctuation">-</span>9E33<span class="token punctuation">-</span>C80AA9429562 <span class="token punctuation">|</span> 47 <span class="token punctuation">|</span> 47 <span class="token punctuation">|</span> Domain_1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 3E11FA47<span class="token punctuation">-</span>71CA<span class="token punctuation">-</span>11E1<span class="token punctuation">-</span>9E33<span class="token punctuation">-</span>C80AA9429562 <span class="token punctuation">|</span> 48 <span class="token punctuation">|</span> 48 <span class="token punctuation">|</span> Domain_1 <span class="token punctuation">|</span></span>
<span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span></code></pre>
</div>
<p>
To save space, the MySQL server can compress the
<code class="literal">
mysql.gtid_executed
</code>
table periodically by
replacing each such set of rows with a single row that spans the
entire interval of transaction identifiers, like this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-none"><div class="docs-select-all right" id="sa75096154"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-none">+--------------------------------------+----------------+--------------+----------+
| source_uuid | interval_start | interval_end | gtid_tag |
|--------------------------------------+----------------+--------------|----------+
| 3E11FA47-71CA-11E1-9E33-C80AA9429562 | 31 | 35 | Domain_1 |
| 3E11FA47-71CA-11E1-9E33-C80AA9429562 | 36 | 39 | Domain_2 |
| 3E11FA47-71CA-11E1-9E33-C80AA9429562 | 40 | 43 | Domain_1 |
| 3E11FA47-71CA-11E1-9E33-C80AA9429562 | 44 | 46 | Domain_2 |
| 3E11FA47-71CA-11E1-9E33-C80AA9429562 | 47 | 48 | Domain_1 |
...</code></pre>
</div>
<p>
The server can carry out compression using a dedicated
foreground thread named
<code class="literal">
thread/sql/compress_gtid_table
</code>
. This thread
is not listed in the output of
<a class="link" href="show-processlist.html" title="15.7.7.31 SHOW PROCESSLIST Statement">
<code class="literal">
SHOW
PROCESSLIST
</code>
</a>
, but it can be viewed as a row in the
<a class="link" href="performance-schema-threads-table.html" title="29.12.22.8 The threads Table">
<code class="literal">
threads
</code>
</a>
table, as shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa79690801"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> performance_schema<span class="token punctuation">.</span>threads <span class="token keyword">WHERE</span> <span class="token keyword">NAME</span> <span class="token operator">LIKE</span> <span class="token string">'%gtid%'</span>\G
<span class="token output"><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span> 1. row <span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span>
THREAD_ID<span class="token punctuation">:</span> 26
NAME<span class="token punctuation">:</span> thread/sql/compress_gtid_table
TYPE<span class="token punctuation">:</span> FOREGROUND
PROCESSLIST_ID<span class="token punctuation">:</span> 1
PROCESSLIST_USER<span class="token punctuation">:</span> NULL
PROCESSLIST_HOST<span class="token punctuation">:</span> NULL
PROCESSLIST_DB<span class="token punctuation">:</span> NULL
PROCESSLIST_COMMAND<span class="token punctuation">:</span> Daemon
PROCESSLIST_TIME<span class="token punctuation">:</span> 1509
PROCESSLIST_STATE<span class="token punctuation">:</span> Suspending
PROCESSLIST_INFO<span class="token punctuation">:</span> NULL
PARENT_THREAD_ID<span class="token punctuation">:</span> 1
ROLE<span class="token punctuation">:</span> NULL
INSTRUMENTED<span class="token punctuation">:</span> YES
HISTORY<span class="token punctuation">:</span> YES
CONNECTION_TYPE<span class="token punctuation">:</span> NULL
THREAD_OS_ID<span class="token punctuation">:</span> 18677</span></code></pre>
</div>
<p>
When binary logging is enabled on the server, this compression
method is not used, and instead the
<code class="literal">
mysql.gtid_executed
</code>
table is compressed on
each binary log rotation. However, when binary logging is
disabled on the server, the
<code class="literal">
thread/sql/compress_gtid_table
</code>
thread sleeps
until a specified number of transactions have been executed,
then wakes up to perform compression of the
<code class="literal">
mysql.gtid_executed
</code>
table. It then sleeps
until the same number of transactions have taken place, then
wakes up to perform the compression again, repeating this loop
indefinitely. The number of transactions that elapse before the
table is compressed, and thus the compression rate, is
controlled by the value of the
<a class="link" href="replication-options-gtids.html#sysvar_gtid_executed_compression_period">
<code class="literal">
gtid_executed_compression_period
</code>
</a>
system variable. Setting that value to 0 means that the thread
never wakes up, meaning that this explicit compression method is
not used. Instead, compression occurs implicitly as required.
</p>
<p>
<a class="link" href="innodb-storage-engine.html" title="Chapter 17 The InnoDB Storage Engine">
<code class="literal">
InnoDB
</code>
</a>
transactions are written to
the
<code class="literal">
mysql.gtid_executed
</code>
table by a process
separate from that used for transactions involving storage
engines other than
<code class="literal">
InnoDB
</code>
. This process is
controlled by a different thread,
<code class="literal">
innodb/clone_gtid_thread
</code>
. This GTID persister
thread collects GTIDs in groups, flushes them to the
<code class="literal">
mysql.gtid_executed
</code>
table, then compresses
the table. If the server has a mix of
<a class="link" href="innodb-storage-engine.html" title="Chapter 17 The InnoDB Storage Engine">
<code class="literal">
InnoDB
</code>
</a>
transactions and
non-
<a class="link" href="innodb-storage-engine.html" title="Chapter 17 The InnoDB Storage Engine">
<code class="literal">
InnoDB
</code>
</a>
transactions, which are
written to the
<code class="literal">
mysql.gtid_executed
</code>
table
individually, the compression carried out by the
<code class="literal">
compress_gtid_table
</code>
thread interferes with
the work of the GTID persister thread and can slow it
significantly. For this reason, it is recommended that you set
<a class="link" href="replication-options-gtids.html#sysvar_gtid_executed_compression_period">
<code class="literal">
gtid_executed_compression_period
</code>
</a>
to 0, so that the
<code class="literal">
compress_gtid_table
</code>
thread
is never activated.
</p>
<p>
The default value for
<a class="link" href="replication-options-gtids.html#sysvar_gtid_executed_compression_period">
<code class="literal">
gtid_executed_compression_period
</code>
</a>
is 0, and all transactions regardless of storage engine are
written to the
<code class="literal">
mysql.gtid_executed
</code>
table by
the GTID persister thread.
</p>
<p>
When a server instance is started, if
<a class="link" href="replication-options-gtids.html#sysvar_gtid_executed_compression_period">
<code class="literal">
gtid_executed_compression_period
</code>
</a>
is set to a nonzero value and the
<code class="literal">
thread/sql/compress_gtid_table
</code>
thread is
launched, in most server configurations, explicit compression is
performed for the
<code class="literal">
mysql.gtid_executed
</code>
table.
Compression is triggered by the thread launch.
</p>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/innodb-performance-buffer-pool.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="innodb-performance-buffer-pool">
</a>
17.8.3 InnoDB Buffer Pool Configuration
</h3>
</div>
</div>
</div>
<div class="toc">
<dl class="toc">
<dt>
<span class="section">
<a href="innodb-buffer-pool-resize.html">
17.8.3.1 Configuring InnoDB Buffer Pool Size
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-multiple-buffer-pools.html">
17.8.3.2 Configuring Multiple Buffer Pool Instances
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-performance-midpoint_insertion.html">
17.8.3.3 Making the Buffer Pool Scan Resistant
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-performance-read_ahead.html">
17.8.3.4 Configuring InnoDB Buffer Pool Prefetching (Read-Ahead)
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-buffer-pool-flushing.html">
17.8.3.5 Configuring Buffer Pool Flushing
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-preload-buffer-pool.html">
17.8.3.6 Saving and Restoring the Buffer Pool State
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-buffer-pool-in-core-file.html">
17.8.3.7 Excluding or Including Buffer Pool Pages from Core Files
</a>
</span>
</dt>
</dl>
</div>
<p>
This section provides configuration and tuning information for the
<code class="literal">
InnoDB
</code>
buffer pool.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/mysql-cluster-install-windows-service.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="mysql-cluster-install-windows-service">
</a>
25.3.2.4 Installing NDB Cluster Processes as Windows Services
</h4>
</div>
</div>
</div>
<p>
Once you are satisfied that NDB Cluster is running as desired,
you can install the management nodes and data nodes as Windows
services, so that these processes are started and stopped
automatically whenever Windows is started or stopped. This also
makes it possible to control these processes from the command
line with the appropriate
<span class="command">
<strong>
SC START
</strong>
</span>
and
<span class="command">
<strong>
SC STOP
</strong>
</span>
commands, or using the Windows
graphical
<span class="command">
<strong>
Services
</strong>
</span>
utility.
<span class="command">
<strong>
NET
START
</strong>
</span>
and
<span class="command">
<strong>
NET STOP
</strong>
</span>
commands can
also be used.
</p>
<p>
Installing programs as Windows services usually must be done
using an account that has Administrator rights on the system.
</p>
<p>
To install the management node as a service on Windows, invoke
<a class="link" href="mysql-cluster-programs-ndb-mgmd.html" title="25.5.4 ndb_mgmd — The NDB Cluster Management Server Daemon">
<span class="command">
<strong>
ndb_mgmd.exe
</strong>
</span>
</a>
from the command line on the
machine hosting the management node, using the
<a class="link" href="mysql-cluster-programs-ndb-mgmd.html#option_ndb_mgmd_install">
<code class="option">
--install
</code>
</a>
option, as shown
here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa23509099"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">C:\></span><span class="token command"> C:\mysql\bin\ndb_mgmd.exe</span> <span class="token property">--install</span>
Installing service <span class="token atrule">'NDB Cluster Management Server'</span>
as <span class="token atrule">'"C:\mysql\bin\ndbd.exe" "--service=ndb_mgmd"'</span>
Service successfully installed<span class="token punctuation">.</span></code></pre>
</div>
<div class="important" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Important
</div>
<p>
When installing an NDB Cluster program as a Windows service,
you should always specify the complete path; otherwise the
service installation may fail with the error
<span class="errortext">
The
system cannot find the file specified
</span>
.
</p>
</div>
<p>
The
<a class="link" href="mysql-cluster-programs-ndb-mgmd.html#option_ndb_mgmd_install">
<code class="option">
--install
</code>
</a>
option must be
used first, ahead of any other options that might be specified
for
<a class="link" href="mysql-cluster-programs-ndb-mgmd.html" title="25.5.4 ndb_mgmd — The NDB Cluster Management Server Daemon">
<span class="command">
<strong>
ndb_mgmd.exe
</strong>
</span>
</a>
. However, it is preferable
to specify such options in an options file instead. If your
options file is not in one of the default locations as shown in
the output of
<a class="link" href="mysql-cluster-programs-ndb-mgmd.html" title="25.5.4 ndb_mgmd — The NDB Cluster Management Server Daemon">
<span class="command">
<strong>
ndb_mgmd.exe
</strong>
</span>
</a>
<a class="link" href="mysql-cluster-programs-ndb-mgmd.html#option_ndb_mgmd_help">
<code class="option">
--help
</code>
</a>
, you can specify the
location using the
<a class="link" href="mysql-cluster-programs-ndb-mgmd.html#option_ndb_mgmd_config-file">
<code class="option">
--config-file
</code>
</a>
option.
</p>
<p>
Now you should be able to start and stop the management server
like this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa38166478"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">C:\></span><span class="token command"> SC</span> START ndb_mgmd
<span class="token prompt">C:\></span><span class="token command"> SC</span> STOP ndb_mgmd</code></pre>
</div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
If using
<span class="command">
<strong>
NET
</strong>
</span>
commands, you can also start
or stop the management server as a Windows service using the
descriptive name, as shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa76558538"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">C:\></span><span class="token command"> NET</span> START <span class="token atrule">'NDB Cluster Management Server'</span>
The NDB Cluster Management Server service is starting<span class="token punctuation">.</span>
The NDB Cluster Management Server service was started successfully<span class="token punctuation">.</span>
<span class="token prompt">C:\></span><span class="token command"> NET</span> STOP <span class="token atrule">'NDB Cluster Management Server'</span>
The NDB Cluster Management Server service is stopping<span class="token punctuation">.</span><span class="token punctuation">.</span>
The NDB Cluster Management Server service was stopped successfully<span class="token punctuation">.</span></code></pre>
</div>
</div>
<p>
It is usually simpler to specify a short service name or to
permit the default service name to be used when installing the
service, and then reference that name when starting or stopping
the service. To specify a service name other than
<code class="literal">
ndb_mgmd
</code>
, append it to the
<a class="link" href="mysql-cluster-programs-ndb-mgmd.html#option_ndb_mgmd_install">
<code class="option">
--install
</code>
</a>
option, as shown in
this example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa89864735"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">C:\></span><span class="token command"> C:\mysql\bin\ndb_mgmd.exe</span> <span class="token constant">--install</span><span class="token attr-value"><span class="token punctuation">=</span>mgmd1</span>
Installing service <span class="token atrule">'NDB Cluster Management Server'</span>
as <span class="token atrule">'"C:\mysql\bin\ndb_mgmd.exe" "--service=mgmd1"'</span>
Service successfully installed<span class="token punctuation">.</span></code></pre>
</div>
<p>
Now you should be able to start or stop the service using the
name you have specified, like this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa58973715"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">C:\></span><span class="token command"> SC</span> START mgmd1
<span class="token prompt">C:\></span><span class="token command"> SC</span> STOP mgmd1</code></pre>
</div>
<p>
To remove the management node service, use
<span class="command">
<strong>
SC DELETE
<em class="replaceable">
<code>
service_name
</code>
</em>
</strong>
</span>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa77968595"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">C:\></span><span class="token command"> SC</span> DELETE mgmd1</code></pre>
</div>
<p>
Alternatively, invoke
<a class="link" href="mysql-cluster-programs-ndb-mgmd.html" title="25.5.4 ndb_mgmd — The NDB Cluster Management Server Daemon">
<span class="command">
<strong>
ndb_mgmd.exe
</strong>
</span>
</a>
with the
<a class="link" href="mysql-cluster-programs-ndb-mgmd.html#option_ndb_mgmd_remove">
<code class="option">
--remove
</code>
</a>
option, as shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa64660525"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">C:\></span><span class="token command"> C:\mysql\bin\ndb_mgmd.exe</span> <span class="token property">--remove</span>
Removing service <span class="token atrule">'NDB Cluster Management Server'</span>
Service successfully removed<span class="token punctuation">.</span></code></pre>
</div>
<p>
If you installed the service using a service name other than the
default, pass the service name as the value of the
<a class="link" href="mysql-cluster-programs-ndb-mgmd.html" title="25.5.4 ndb_mgmd — The NDB Cluster Management Server Daemon">
<span class="command">
<strong>
ndb_mgmd.exe
</strong>
</span>
</a>
<a class="link" href="mysql-cluster-programs-ndb-mgmd.html#option_ndb_mgmd_remove">
<code class="option">
--remove
</code>
</a>
option, like this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa96627875"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">C:\></span><span class="token command"> C:\mysql\bin\ndb_mgmd.exe</span> <span class="token constant">--remove</span><span class="token attr-value"><span class="token punctuation">=</span>mgmd1</span>
Removing service <span class="token atrule">'mgmd1'</span>
Service successfully removed<span class="token punctuation">.</span></code></pre>
</div>
<p>
Installation of an NDB Cluster data node process as a Windows
service can be done in a similar fashion, using the
<a class="link" href="mysql-cluster-programs-ndbd.html#option_ndbd_install">
<code class="option">
--install
</code>
</a>
option for
<a class="link" href="mysql-cluster-programs-ndbd.html" title="25.5.1 ndbd — The NDB Cluster Data Node Daemon">
<span class="command">
<strong>
ndbd.exe
</strong>
</span>
</a>
(or
<a class="link" href="mysql-cluster-programs-ndbmtd.html" title="25.5.3 ndbmtd — The NDB Cluster Data Node Daemon (Multi-Threaded)">
<span class="command">
<strong>
ndbmtd.exe
</strong>
</span>
</a>
),
as shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa57551560"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">C:\></span><span class="token command"> C:\mysql\bin\ndbd.exe</span> <span class="token property">--install</span>
Installing service <span class="token atrule">'NDB Cluster Data Node Daemon'</span> as <span class="token atrule">'"C:\mysql\bin\ndbd.exe" "--service=ndbd"'</span>
Service successfully installed<span class="token punctuation">.</span></code></pre>
</div>
<p>
Now you can start or stop the data node as shown in the
following example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa69049285"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">C:\></span><span class="token command"> SC</span> START ndbd
<span class="token prompt">C:\></span><span class="token command"> SC</span> STOP ndbd</code></pre>
</div>
<p>
To remove the data node service, use
<span class="command">
<strong>
SC DELETE
<em class="replaceable">
<code>
service_name
</code>
</em>
</strong>
</span>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa73492308"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">C:\></span><span class="token command"> SC</span> DELETE ndbd</code></pre>
</div>
<p>
Alternatively, invoke
<a class="link" href="mysql-cluster-programs-ndbd.html" title="25.5.1 ndbd — The NDB Cluster Data Node Daemon">
<span class="command">
<strong>
ndbd.exe
</strong>
</span>
</a>
with the
<a class="link" href="mysql-cluster-programs-ndbd.html#option_ndbd_remove">
<code class="option">
--remove
</code>
</a>
option, as shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa43987674"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">C:\></span><span class="token command"> C:\mysql\bin\ndbd.exe</span> <span class="token property">--remove</span>
Removing service <span class="token atrule">'NDB Cluster Data Node Daemon'</span>
Service successfully removed<span class="token punctuation">.</span></code></pre>
</div>
<p>
As with
<a class="link" href="mysql-cluster-programs-ndb-mgmd.html" title="25.5.4 ndb_mgmd — The NDB Cluster Management Server Daemon">
<span class="command">
<strong>
ndb_mgmd.exe
</strong>
</span>
</a>
(and
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld.exe
</strong>
</span>
</a>
), when installing
<a class="link" href="mysql-cluster-programs-ndbd.html" title="25.5.1 ndbd — The NDB Cluster Data Node Daemon">
<span class="command">
<strong>
ndbd.exe
</strong>
</span>
</a>
as a Windows service, you can also
specify a name for the service as the value of
<a class="link" href="mysql-cluster-programs-ndbd.html#option_ndbd_install">
<code class="option">
--install
</code>
</a>
, and then use it when
starting or stopping the service, like this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa69814676"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">C:\></span><span class="token command"> C:\mysql\bin\ndbd.exe</span> <span class="token constant">--install</span><span class="token attr-value"><span class="token punctuation">=</span>dnode1</span>
Installing service <span class="token atrule">'dnode1'</span> as <span class="token atrule">'"C:\mysql\bin\ndbd.exe" "--service=dnode1"'</span>
Service successfully installed<span class="token punctuation">.</span>
<span class="token prompt">C:\></span><span class="token command"> SC</span> START dnode1
<span class="token prompt">C:\></span><span class="token command"> SC</span> STOP dnode1</code></pre>
</div>
<p>
If you specified a service name when installing the data node
service, you can use this name when removing it as well, as
shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa24448932"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">C:\></span><span class="token command"> SC</span> DELETE dnode1</code></pre>
</div>
<p>
Alternatively, you can pass the service name as the value of the
<code class="filename">
ndbd.exe
</code>
<a class="link" href="mysql-cluster-programs-ndbd.html#option_ndbd_remove">
<code class="option">
--remove
</code>
</a>
option, as shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa91862922"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">C:\></span><span class="token command"> C:\mysql\bin\ndbd.exe</span> <span class="token constant">--remove</span><span class="token attr-value"><span class="token punctuation">=</span>dnode1</span>
Removing service <span class="token atrule">'dnode1'</span>
Service successfully removed<span class="token punctuation">.</span></code></pre>
</div>
<p>
Installation of the SQL node as a Windows service, starting the
service, stopping the service, and removing the service are done
in a similar fashion, using
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
<code class="option">
--install
</code>
,
<span class="command">
<strong>
SC START
</strong>
</span>
,
<span class="command">
<strong>
SC STOP
</strong>
</span>
, and
<span class="command">
<strong>
SC DELETE
</strong>
</span>
(or
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
<a class="link" href="server-options.html#option_mysqld_remove">
<code class="option">
--remove
</code>
</a>
).
<span class="command">
<strong>
NET
</strong>
</span>
commands can also be used to start or stop a service. For
additional information, see
<a class="xref" href="windows-start-service.html" title="2.3.3.8 Starting MySQL as a Windows Service">
Section 2.3.3.8, “Starting MySQL as a Windows Service”
</a>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/gis-property-functions.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="gis-property-functions">
</a>
14.16.7 Geometry Property Functions
</h3>
</div>
</div>
</div>
<div class="toc">
<dl class="toc">
<dt>
<span class="section">
<a href="gis-general-property-functions.html">
14.16.7.1 General Geometry Property Functions
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="gis-point-property-functions.html">
14.16.7.2 Point Property Functions
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="gis-linestring-property-functions.html">
14.16.7.3 LineString and MultiLineString Property Functions
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="gis-polygon-property-functions.html">
14.16.7.4 Polygon and MultiPolygon Property Functions
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="gis-geometrycollection-property-functions.html">
14.16.7.5 GeometryCollection Property Functions
</a>
</span>
</dt>
</dl>
</div>
<p>
Each function that belongs to this group takes a geometry value as
its argument and returns some quantitative or qualitative property
of the geometry. Some functions restrict their argument type. Such
functions return
<code class="literal">
NULL
</code>
if the argument is of an
incorrect geometry type. For example, the
<a class="link" href="gis-polygon-property-functions.html#function_st-area">
<code class="literal">
ST_Area()
</code>
</a>
polygon function returns
<code class="literal">
NULL
</code>
if the object type is neither
<code class="literal">
Polygon
</code>
nor
<code class="literal">
MultiPolygon
</code>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/mysql-cluster-programs-ndb-print-schema-file.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="mysql-cluster-programs-ndb-print-schema-file">
</a>
25.5.20 ndb_print_schema_file — Print NDB Schema File Contents
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045100041008">
</a>
<p>
<a class="link" href="mysql-cluster-programs-ndb-print-schema-file.html" title="25.5.20 ndb_print_schema_file — Print NDB Schema File Contents">
<span class="command">
<strong>
ndb_print_schema_file
</strong>
</span>
</a>
obtains diagnostic
information from a cluster schema file.
</p>
<h4>
<a name="idm46045100038192">
</a>
Usage
</h4>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa97220225"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal">ndb_print_schema_file <em class="replaceable">file_name</em></code></pre>
</div>
<p>
<em class="replaceable">
<code>
file_name
</code>
</em>
is the name of a cluster
schema file. For more information about cluster schema files,
see
<a class="ulink" href="/doc/ndb-internals/en/ndb-internals-ndbd-filesystemdir-files.html" target="_top">
NDB Cluster Data Node File System Directory
</a>
.
</p>
<p>
Like
<a class="link" href="mysql-cluster-programs-ndb-print-backup-file.html" title="25.5.17 ndb_print_backup_file — Print NDB Backup File Contents">
<span class="command">
<strong>
ndb_print_backup_file
</strong>
</span>
</a>
and
<a class="link" href="mysql-cluster-programs-ndb-print-sys-file.html" title="25.5.21 ndb_print_sys_file — Print NDB System File Contents">
<span class="command">
<strong>
ndb_print_sys_file
</strong>
</span>
</a>
(and unlike most of the
other
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
utilities that are
intended to be run on a management server host or to connect to
a management server)
<a class="link" href="mysql-cluster-programs-ndb-print-schema-file.html" title="25.5.20 ndb_print_schema_file — Print NDB Schema File Contents">
<span class="command">
<strong>
ndb_print_schema_file
</strong>
</span>
</a>
must be run on a cluster data node, since it accesses the data
node file system directly. Because it does not make use of the
management server, this utility can be used when the management
server is not running, and even when the cluster has been
completely shut down.
</p>
<h4>
<a name="idm46045100028448">
</a>
Additional Options
</h4>
<p>
None.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/innodb-configuration.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title">
<a name="innodb-configuration">
</a>
17.8 InnoDB Configuration
</h2>
</div>
</div>
</div>
<div class="toc">
<dl class="toc">
<dt>
<span class="section">
<a href="innodb-init-startup-configuration.html">
17.8.1 InnoDB Startup Configuration
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-read-only-instance.html">
17.8.2 Configuring InnoDB for Read-Only Operation
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-performance-buffer-pool.html">
17.8.3 InnoDB Buffer Pool Configuration
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-performance-thread_concurrency.html">
17.8.4 Configuring Thread Concurrency for InnoDB
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-performance-multiple_io_threads.html">
17.8.5 Configuring the Number of Background InnoDB I/O Threads
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-linux-native-aio.html">
17.8.6 Using Asynchronous I/O on Linux
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-configuring-io-capacity.html">
17.8.7 Configuring InnoDB I/O Capacity
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-performance-spin_lock_polling.html">
17.8.8 Configuring Spin Lock Polling
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-purge-configuration.html">
17.8.9 Purge Configuration
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-performance-optimizer-statistics.html">
17.8.10 Configuring Optimizer Statistics for InnoDB
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="index-page-merge-threshold.html">
17.8.11 Configuring the Merge Threshold for Index Pages
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-dedicated-server.html">
17.8.12 Enabling Automatic InnoDB Configuration for a Dedicated MySQL Server
</a>
</span>
</dt>
</dl>
</div>
<p>
This section provides configuration information and procedures for
<code class="literal">
InnoDB
</code>
initialization, startup, and various
components and features of the
<code class="literal">
InnoDB
</code>
storage
engine. For information about optimizing database operations for
<code class="literal">
InnoDB
</code>
tables, see
<a class="xref" href="optimizing-innodb.html" title="10.5 Optimizing for InnoDB Tables">
Section 10.5, “Optimizing for InnoDB Tables”
</a>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/gtid-functions.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="gtid-functions">
</a>
14.18.2 Functions Used with Global Transaction Identifiers (GTIDs)
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045193686672">
</a>
<a class="indexterm" name="idm46045193685632">
</a>
<p>
The functions described in this section are used with GTID-based
replication. It is important to keep in mind that all of these
functions take string representations of GTID sets as arguments.
As such, the GTID sets must always be quoted when used with
them. See
<a class="xref" href="replication-gtids-concepts.html#replication-gtids-concepts-gtid-sets" title="GTID Sets">
GTID Sets
</a>
for more information.
</p>
<p>
The union of two GTID sets is simply their representations as
strings, joined together with an interposed comma. In other
words, you can define a very simple function for obtaining the
union of two GTID sets, similar to that created here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa16185424"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CREATE</span> <span class="token keyword">FUNCTION</span> GTID_UNION<span class="token punctuation">(</span>g1 <span class="token datatype">TEXT</span><span class="token punctuation">,</span> g2 <span class="token datatype">TEXT</span><span class="token punctuation">)</span>
<span class="token keyword">RETURNS</span> <span class="token datatype">TEXT</span> <span class="token keyword">DETERMINISTIC</span>
<span class="token keyword">RETURN</span> <span class="token function">CONCAT</span><span class="token punctuation">(</span>g1<span class="token punctuation">,</span><span class="token string">','</span><span class="token punctuation">,</span>g2<span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
For more information about GTIDs and how these GTID functions
are used in practice, see
<a class="xref" href="replication-gtids.html" title="19.1.3 Replication with Global Transaction Identifiers">
Section 19.1.3, “Replication with Global Transaction Identifiers”
</a>
.
</p>
<div class="table">
<a name="idm46045193679664">
</a>
<p class="title">
<b>
Table 14.26 GTID Functions
</b>
</p>
<div class="table-contents">
<table frame="box" rules="all" summary="A reference that lists functions used with global transaction identifiers (GTIDs).">
<colgroup>
<col style="width: 28%"/>
<col style="width: 71%"/>
</colgroup>
<thead>
<tr>
<th>
Name
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a class="link" href="gtid-functions.html#function_wait-for-executed-gtid-set">
<code class="literal">
WAIT_FOR_EXECUTED_GTID_SET()
</code>
</a>
</td>
<td>
Wait until the given GTIDs have executed on the replica.
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br class="table-break"/>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<a name="function_gtid-subset">
</a>
<p>
<a class="link" href="gtid-functions.html#function_gtid-subset">
<code class="literal">
GTID_SUBSET(
<em class="replaceable">
<code>
set1
</code>
</em>
,
<em class="replaceable">
<code>
set2
</code>
</em>
)
</code>
</a>
</p>
<a class="indexterm" name="idm46045193664448">
</a>
<p>
Given two sets of global transaction identifiers
<em class="replaceable">
<code>
set1
</code>
</em>
and
<em class="replaceable">
<code>
set2
</code>
</em>
, returns true if all GTIDs
in
<em class="replaceable">
<code>
set1
</code>
</em>
are also in
<em class="replaceable">
<code>
set2
</code>
</em>
. Returns
<code class="literal">
NULL
</code>
if
<em class="replaceable">
<code>
set1
</code>
</em>
or
<em class="replaceable">
<code>
set2
</code>
</em>
is
<code class="literal">
NULL
</code>
. Returns false otherwise.
</p>
<p>
The GTID sets used with this function are represented as
strings, as shown in the following examples:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa85415616"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">GTID_SUBSET</span><span class="token punctuation">(</span><span class="token string">'3E11FA47-71CA-11E1-9E33-C80AA9429562:23'</span><span class="token punctuation">,</span>
<span class="token prompt"> -></span> <span class="token string">'3E11FA47-71CA-11E1-9E33-C80AA9429562:21-57'</span><span class="token punctuation">)</span>\G
<span class="token output"><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span> 1. row <span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span>
GTID_SUBSET('3E11FA47-71CA-11E1-9E33-C80AA9429562<span class="token punctuation">:</span>23',
'3E11FA47-71CA-11E1-9E33-C80AA9429562<span class="token punctuation">:</span>21-57')<span class="token punctuation">:</span> 1
</span><span class="token output">1 row in set (0.00 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">GTID_SUBSET</span><span class="token punctuation">(</span><span class="token string">'3E11FA47-71CA-11E1-9E33-C80AA9429562:23-25'</span><span class="token punctuation">,</span>
<span class="token prompt"> -></span> <span class="token string">'3E11FA47-71CA-11E1-9E33-C80AA9429562:21-57'</span><span class="token punctuation">)</span>\G
<span class="token output"><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span> 1. row <span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span>
GTID_SUBSET('3E11FA47-71CA-11E1-9E33-C80AA9429562<span class="token punctuation">:</span>23-25',
'3E11FA47-71CA-11E1-9E33-C80AA9429562<span class="token punctuation">:</span>21-57')<span class="token punctuation">:</span> 1
</span><span class="token output">1 row in set (0.00 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">GTID_SUBSET</span><span class="token punctuation">(</span><span class="token string">'3E11FA47-71CA-11E1-9E33-C80AA9429562:20-25'</span><span class="token punctuation">,</span>
<span class="token prompt"> -></span> <span class="token string">'3E11FA47-71CA-11E1-9E33-C80AA9429562:21-57'</span><span class="token punctuation">)</span>\G
<span class="token output"><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span> 1. row <span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span>
GTID_SUBSET('3E11FA47-71CA-11E1-9E33-C80AA9429562<span class="token punctuation">:</span>20-25',
'3E11FA47-71CA-11E1-9E33-C80AA9429562<span class="token punctuation">:</span>21-57')<span class="token punctuation">:</span> 0
</span><span class="token output">1 row in set (0.00 sec)</span></code></pre>
</div>
</li>
<li class="listitem">
<a name="function_gtid-subtract">
</a>
<p>
<a class="link" href="gtid-functions.html#function_gtid-subtract">
<code class="literal">
GTID_SUBTRACT(
<em class="replaceable">
<code>
set1
</code>
</em>
,
<em class="replaceable">
<code>
set2
</code>
</em>
)
</code>
</a>
</p>
<a class="indexterm" name="idm46045193644336">
</a>
<p>
Given two sets of global transaction identifiers
<em class="replaceable">
<code>
set1
</code>
</em>
and
<em class="replaceable">
<code>
set2
</code>
</em>
, returns only those GTIDs
from
<em class="replaceable">
<code>
set1
</code>
</em>
that are not in
<em class="replaceable">
<code>
set2
</code>
</em>
. Returns
<code class="literal">
NULL
</code>
if
<em class="replaceable">
<code>
set1
</code>
</em>
or
<em class="replaceable">
<code>
set2
</code>
</em>
is
<code class="literal">
NULL
</code>
.
</p>
<p>
All GTID sets used with this function are represented as
strings and must be quoted, as shown in these examples:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa59628683"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">GTID_SUBTRACT</span><span class="token punctuation">(</span><span class="token string">'3E11FA47-71CA-11E1-9E33-C80AA9429562:21-57'</span><span class="token punctuation">,</span>
<span class="token prompt"> -></span> <span class="token string">'3E11FA47-71CA-11E1-9E33-C80AA9429562:21'</span><span class="token punctuation">)</span>\G
<span class="token output"><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span> 1. row <span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span>
GTID_SUBTRACT('3E11FA47-71CA-11E1-9E33-C80AA9429562<span class="token punctuation">:</span>21-57',
'3E11FA47-71CA-11E1-9E33-C80AA9429562<span class="token punctuation">:</span>21')<span class="token punctuation">:</span> 3e11fa47-71ca-11e1-9e33-c80aa9429562<span class="token punctuation">:</span>22-57
</span><span class="token output">1 row in set (0.00 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">GTID_SUBTRACT</span><span class="token punctuation">(</span><span class="token string">'3E11FA47-71CA-11E1-9E33-C80AA9429562:21-57'</span><span class="token punctuation">,</span>
<span class="token prompt"> -></span> <span class="token string">'3E11FA47-71CA-11E1-9E33-C80AA9429562:20-25'</span><span class="token punctuation">)</span>\G
<span class="token output"><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span> 1. row <span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span>
GTID_SUBTRACT('3E11FA47-71CA-11E1-9E33-C80AA9429562<span class="token punctuation">:</span>21-57',
'3E11FA47-71CA-11E1-9E33-C80AA9429562<span class="token punctuation">:</span>20-25')<span class="token punctuation">:</span> 3e11fa47-71ca-11e1-9e33-c80aa9429562<span class="token punctuation">:</span>26-57
</span><span class="token output">1 row in set (0.00 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">GTID_SUBTRACT</span><span class="token punctuation">(</span><span class="token string">'3E11FA47-71CA-11E1-9E33-C80AA9429562:21-57'</span><span class="token punctuation">,</span>
<span class="token prompt"> -></span> <span class="token string">'3E11FA47-71CA-11E1-9E33-C80AA9429562:23-24'</span><span class="token punctuation">)</span>\G
<span class="token output"><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span> 1. row <span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span>
GTID_SUBTRACT('3E11FA47-71CA-11E1-9E33-C80AA9429562<span class="token punctuation">:</span>21-57',
'3E11FA47-71CA-11E1-9E33-C80AA9429562<span class="token punctuation">:</span>23-24')<span class="token punctuation">:</span> 3e11fa47-71ca-11e1-9e33-c80aa9429562<span class="token punctuation">:</span>21-22<span class="token punctuation">:</span>25-57
</span><span class="token output">1 row in set (0.01 sec)</span></code></pre>
</div>
<p>
Subtracting a GTID set from itself produces an empty set, as
shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa59862624"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">GTID_SUBTRACT</span><span class="token punctuation">(</span><span class="token string">'3E11FA47-71CA-11E1-9E33-C80AA9429562:21-57'</span><span class="token punctuation">,</span>
<span class="token prompt"> -></span> <span class="token string">'3E11FA47-71CA-11E1-9E33-C80AA9429562:21-57'</span><span class="token punctuation">)</span>\G
<span class="token output"><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span> 1. row <span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span>
GTID_SUBTRACT('3E11FA47-71CA-11E1-9E33-C80AA9429562<span class="token punctuation">:</span>21-57',
'3E11FA47-71CA-11E1-9E33-C80AA9429562<span class="token punctuation">:</span>21-57')<span class="token punctuation">:</span>
</span><span class="token output">1 row in set (0.00 sec)</span></code></pre>
</div>
</li>
<li class="listitem">
<a name="function_wait-for-executed-gtid-set">
</a>
<p>
<a class="link" href="gtid-functions.html#function_wait-for-executed-gtid-set">
<code class="literal">
WAIT_FOR_EXECUTED_GTID_SET(
<em class="replaceable">
<code>
gtid_set
</code>
</em>
[,
<em class="replaceable">
<code>
timeout
</code>
</em>
])
</code>
</a>
</p>
<a class="indexterm" name="idm46045193620704">
</a>
<p>
Wait until the server has applied all of the transactions
whose global transaction identifiers are contained in
<em class="replaceable">
<code>
gtid_set
</code>
</em>
; that is, until the
condition
GTID_SUBSET(
<em class="replaceable">
<code>
gtid_subset
</code>
</em>
,
<code class="literal">
@@GLOBAL.gtid_executed
</code>
) holds. See
<a class="xref" href="replication-gtids-concepts.html" title="19.1.3.1 GTID Format and Storage">
Section 19.1.3.1, “GTID Format and Storage”
</a>
for a
definition of GTID sets.
</p>
<p>
If a timeout is specified, and
<em class="replaceable">
<code>
timeout
</code>
</em>
seconds elapse before all
of the transactions in the GTID set have been applied, the
function stops waiting.
<em class="replaceable">
<code>
timeout
</code>
</em>
is optional, and the default timeout is 0 seconds, in which
case the function always waits until all of the transactions
in the GTID set have been applied.
<em class="replaceable">
<code>
timeout
</code>
</em>
must be greater than or
equal to 0; when running in strict SQL mode, a negative
<em class="replaceable">
<code>
timeout
</code>
</em>
value is immediately
rejected with an error
(
<a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_wrong_arguments" target="_top">
<code class="literal">
ER_WRONG_ARGUMENTS
</code>
</a>
);
otherwise the function returns
<code class="literal">
NULL
</code>
, and
raises a warning.
</p>
<p>
<code class="literal">
WAIT_FOR_EXECUTED_GTID_SET()
</code>
monitors all
the GTIDs that are applied on the server, including
transactions that arrive from all replication channels and
user clients. It does not take into account whether
replication channels have been started or stopped.
</p>
<p>
For more information, see
<a class="xref" href="replication-gtids.html" title="19.1.3 Replication with Global Transaction Identifiers">
Section 19.1.3, “Replication with Global Transaction Identifiers”
</a>
.
</p>
<p>
GTID sets used with this function are represented as strings
and so must be quoted as shown in the following example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa53992553"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">WAIT_FOR_EXECUTED_GTID_SET</span><span class="token punctuation">(</span><span class="token string">'3E11FA47-71CA-11E1-9E33-C80AA9429562:1-5'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token number">0</span></code></pre>
</div>
<p>
For a syntax description for GTID sets, see
<a class="xref" href="replication-gtids-concepts.html" title="19.1.3.1 GTID Format and Storage">
Section 19.1.3.1, “GTID Format and Storage”
</a>
.
</p>
<p>
For
<code class="literal">
WAIT_FOR_EXECUTED_GTID_SET()
</code>
, the
return value is the state of the query, where 0 represents
success, and 1 represents timeout. Any other failures
generate an error.
</p>
<p>
<a class="link" href="replication-options-gtids.html#sysvar_gtid_mode">
<code class="literal">
gtid_mode
</code>
</a>
cannot be changed
to OFF while any client is using this function to wait for
GTIDs to be applied.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/precision-math-rounding.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="precision-math-rounding">
</a>
14.24.4 Rounding Behavior
</h3>
</div>
</div>
</div>
<p>
This section discusses precision math rounding for the
<a class="link" href="mathematical-functions.html#function_round">
<code class="literal">
ROUND()
</code>
</a>
function and for inserts
into columns with exact-value types
(
<a class="link" href="fixed-point-types.html" title="13.1.3 Fixed-Point Types (Exact Value) - DECIMAL, NUMERIC">
<code class="literal">
DECIMAL
</code>
</a>
and integer).
</p>
<p>
The
<a class="link" href="mathematical-functions.html#function_round">
<code class="literal">
ROUND()
</code>
</a>
function rounds
differently depending on whether its argument is exact or
approximate:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
For exact-value numbers,
<a class="link" href="mathematical-functions.html#function_round">
<code class="literal">
ROUND()
</code>
</a>
uses the
<span class="quote">
“
<span class="quote">
round
half up
</span>
”
</span>
rule: A value with a fractional part of .5 or
greater is rounded up to the next integer if positive or down
to the next integer if negative. (In other words, it is
rounded away from zero.) A value with a fractional part less
than .5 is rounded down to the next integer if positive or up
to the next integer if negative. (In other words, it is
rounded toward zero.)
</p>
</li>
<li class="listitem">
<p>
For approximate-value numbers, the result depends on the C
library. On many systems, this means that
<a class="link" href="mathematical-functions.html#function_round">
<code class="literal">
ROUND()
</code>
</a>
uses the
<span class="quote">
“
<span class="quote">
round
to nearest even
</span>
”
</span>
rule: A value with a fractional part
exactly half way between two integers is rounded to the
nearest even integer.
</p>
</li>
</ul>
</div>
<p>
The following example shows how rounding differs for exact and
approximate values:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa3106988"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">ROUND</span><span class="token punctuation">(</span><span class="token number">2.5</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token function">ROUND</span><span class="token punctuation">(</span><span class="token number">25E</span><span class="token operator">-</span><span class="token number">1</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> ROUND(2.5) <span class="token punctuation">|</span> ROUND(25E<span class="token punctuation">-</span>1) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 3 <span class="token punctuation">|</span> 2 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
<p>
For inserts into a
<a class="link" href="fixed-point-types.html" title="13.1.3 Fixed-Point Types (Exact Value) - DECIMAL, NUMERIC">
<code class="literal">
DECIMAL
</code>
</a>
or
integer column, the target is an exact data type, so rounding uses
<span class="quote">
“
<span class="quote">
round half away from zero,
</span>
”
</span>
regardless of whether
the value to be inserted is exact or approximate:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa28198581"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> t <span class="token punctuation">(</span>d <span class="token datatype">DECIMAL</span><span class="token punctuation">(</span><span class="token number">10</span><span class="token punctuation">,</span><span class="token number">0</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 0 rows affected (0.00 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">INSERT</span> <span class="token keyword">INTO</span> t <span class="token keyword">VALUES</span><span class="token punctuation">(</span><span class="token number">2.5</span><span class="token punctuation">)</span><span class="token punctuation">,</span><span class="token punctuation">(</span><span class="token number">2.5E0</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 2 rows affected, 2 warnings (0.00 sec)</span>
<span class="token output">Records: 2 Duplicates: 0 Warnings: 2</span>
<span class="token prompt">mysql></span> <span class="token keyword">SHOW</span> <span class="token keyword">WARNINGS</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> Level <span class="token punctuation">|</span> Code <span class="token punctuation">|</span> Message <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> Note <span class="token punctuation">|</span> 1265 <span class="token punctuation">|</span> Data truncated for column 'd' at row 1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Note <span class="token punctuation">|</span> 1265 <span class="token punctuation">|</span> Data truncated for column 'd' at row 2 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output">2 rows in set (0.00 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> d <span class="token keyword">FROM</span> t<span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> d <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 3 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 3 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output">2 rows in set (0.00 sec)</span></code></pre>
</div>
<p>
The
<a class="link" href="show-warnings.html" title="15.7.7.42 SHOW WARNINGS Statement">
<code class="literal">
SHOW WARNINGS
</code>
</a>
statement
displays the notes that are generated by truncation due to
rounding of the fractional part. Such truncation is not an error,
even in strict SQL mode (see
<a class="xref" href="precision-math-expressions.html" title="14.24.3 Expression Handling">
Section 14.24.3, “Expression Handling”
</a>
).
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/optimizing-database-structure.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title">
<a name="optimizing-database-structure">
</a>
10.4 Optimizing Database Structure
</h2>
</div>
</div>
</div>
<div class="toc">
<dl class="toc">
<dt>
<span class="section">
<a href="data-size.html">
10.4.1 Optimizing Data Size
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="optimize-data-types.html">
10.4.2 Optimizing MySQL Data Types
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="optimize-multi-tables.html">
10.4.3 Optimizing for Many Tables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="internal-temporary-tables.html">
10.4.4 Internal Temporary Table Use in MySQL
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="database-count-limit.html">
10.4.5 Limits on Number of Databases and Tables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="table-size-limit.html">
10.4.6 Limits on Table Size
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="column-count-limit.html">
10.4.7 Limits on Table Column Count and Row Size
</a>
</span>
</dt>
</dl>
</div>
<p>
In your role as a database designer, look for the most efficient
way to organize your schemas, tables, and columns. As when tuning
application code, you minimize I/O, keep related items together,
and plan ahead so that performance stays high as the data volume
increases. Starting with an efficient database design makes it
easier for team members to write high-performing application code,
and makes the database likely to endure as applications evolve and
are rewritten.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/comparison-operators.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="comparison-operators">
</a>
14.4.2 Comparison Functions and Operators
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045207529744">
</a>
<div class="table">
<a name="idm46045207528704">
</a>
<p class="title">
<b>
Table 14.4 Comparison Operators
</b>
</p>
<div class="table-contents">
<table frame="box" rules="all" summary="A reference that lists comparison operators.">
<colgroup>
<col style="width: 28%"/>
<col style="width: 71%"/>
</colgroup>
<thead>
<tr>
<th>
Name
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a class="link" href="comparison-operators.html#operator_greater-than">
<code class="literal">
>
</code>
</a>
</td>
<td>
Greater than operator
</td>
</tr>
<tr>
<td>
<a class="link" href="comparison-operators.html#operator_greater-than-or-equal">
<code class="literal">
>=
</code>
</a>
</td>
<td>
Greater than or equal operator
</td>
</tr>
<tr>
<td>
<a class="link" href="comparison-operators.html#operator_less-than">
<code class="literal">
<
</code>
</a>
</td>
<td>
Less than operator
</td>
</tr>
<tr>
<td>
<a class="link" href="comparison-operators.html#operator_not-equal">
<code class="literal">
<>
</code>
,
<code class="literal">
!=
</code>
</a>
</td>
<td>
Not equal operator
</td>
</tr>
<tr>
<td>
<a class="link" href="comparison-operators.html#operator_less-than-or-equal">
<code class="literal">
<=
</code>
</a>
</td>
<td>
Less than or equal operator
</td>
</tr>
<tr>
<td>
<a class="link" href="comparison-operators.html#operator_equal-to">
<code class="literal">
<=>
</code>
</a>
</td>
<td>
NULL-safe equal to operator
</td>
</tr>
<tr>
<td>
<a class="link" href="comparison-operators.html#operator_equal">
<code class="literal">
=
</code>
</a>
</td>
<td>
Equal operator
</td>
</tr>
<tr>
<td>
<a class="link" href="comparison-operators.html#operator_between">
<code class="literal">
BETWEEN ... AND ...
</code>
</a>
</td>
<td>
Whether a value is within a range of values
</td>
</tr>
<tr>
<td>
<a class="link" href="comparison-operators.html#function_coalesce">
<code class="literal">
COALESCE()
</code>
</a>
</td>
<td>
Return the first non-NULL argument
</td>
</tr>
<tr>
<td>
<a class="link" href="comparison-operators.html#operator_exists">
<code class="literal">
EXISTS()
</code>
</a>
</td>
<td>
Whether the result of a query contains any rows
</td>
</tr>
<tr>
<td>
<a class="link" href="comparison-operators.html#function_greatest">
<code class="literal">
GREATEST()
</code>
</a>
</td>
<td>
Return the largest argument
</td>
</tr>
<tr>
<td>
<a class="link" href="comparison-operators.html#operator_in">
<code class="literal">
IN()
</code>
</a>
</td>
<td>
Whether a value is within a set of values
</td>
</tr>
<tr>
<td>
<a class="link" href="comparison-operators.html#function_interval">
<code class="literal">
INTERVAL()
</code>
</a>
</td>
<td>
Return the index of the argument that is less than the first
argument
</td>
</tr>
<tr>
<td>
<a class="link" href="comparison-operators.html#operator_is">
<code class="literal">
IS
</code>
</a>
</td>
<td>
Test a value against a boolean
</td>
</tr>
<tr>
<td>
<a class="link" href="comparison-operators.html#operator_is-not">
<code class="literal">
IS NOT
</code>
</a>
</td>
<td>
Test a value against a boolean
</td>
</tr>
<tr>
<td>
<a class="link" href="comparison-operators.html#operator_is-not-null">
<code class="literal">
IS NOT NULL
</code>
</a>
</td>
<td>
NOT NULL value test
</td>
</tr>
<tr>
<td>
<a class="link" href="comparison-operators.html#operator_is-null">
<code class="literal">
IS NULL
</code>
</a>
</td>
<td>
NULL value test
</td>
</tr>
<tr>
<td>
<a class="link" href="comparison-operators.html#function_isnull">
<code class="literal">
ISNULL()
</code>
</a>
</td>
<td>
Test whether the argument is NULL
</td>
</tr>
<tr>
<td>
<a class="link" href="comparison-operators.html#function_least">
<code class="literal">
LEAST()
</code>
</a>
</td>
<td>
Return the smallest argument
</td>
</tr>
<tr>
<td>
<a class="link" href="string-comparison-functions.html#operator_like">
<code class="literal">
LIKE
</code>
</a>
</td>
<td>
Simple pattern matching
</td>
</tr>
<tr>
<td>
<a class="link" href="comparison-operators.html#operator_not-between">
<code class="literal">
NOT BETWEEN ... AND ...
</code>
</a>
</td>
<td>
Whether a value is not within a range of values
</td>
</tr>
<tr>
<td>
<a class="link" href="comparison-operators.html#operator_not-exists">
<code class="literal">
NOT EXISTS()
</code>
</a>
</td>
<td>
Whether the result of a query contains no rows
</td>
</tr>
<tr>
<td>
<a class="link" href="comparison-operators.html#operator_not-in">
<code class="literal">
NOT IN()
</code>
</a>
</td>
<td>
Whether a value is not within a set of values
</td>
</tr>
<tr>
<td>
<a class="link" href="string-comparison-functions.html#operator_not-like">
<code class="literal">
NOT LIKE
</code>
</a>
</td>
<td>
Negation of simple pattern matching
</td>
</tr>
<tr>
<td>
<a class="link" href="string-comparison-functions.html#function_strcmp">
<code class="literal">
STRCMP()
</code>
</a>
</td>
<td>
Compare two strings
</td>
</tr>
</tbody>
</table>
</div>
<div class="table-contents">
<table cellpadding="0" cellspacing="0" style="position: fixed; top: 0px; display: none; left: 401px; width: 693px;">
<thead>
<tr>
<th style="width: 195.828px;">
Name
</th>
<th style="width: 496.625px;">
Description
</th>
</tr>
</thead>
</table>
</div>
</div>
<br class="table-break"/>
<a class="indexterm" name="idm46045207446576">
</a>
<a class="indexterm" name="idm46045207445504">
</a>
<p>
Comparison operations result in a value of
<code class="literal">
1
</code>
(
<code class="literal">
TRUE
</code>
),
<code class="literal">
0
</code>
(
<code class="literal">
FALSE
</code>
), or
<code class="literal">
NULL
</code>
. These
operations work for both numbers and strings. Strings are
automatically converted to numbers and numbers to strings as
necessary.
</p>
<p>
The following relational comparison operators can be used to
compare not only scalar operands, but row operands:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa70936420"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token operator">=</span> <span class="token operator">></span> <span class="token operator"><</span> <span class="token operator">>=</span> <span class="token operator"><=</span> <span class="token operator"><></span> <span class="token operator">!=</span></code></pre>
</div>
<p>
The descriptions for those operators later in this section
detail how they work with row operands. For additional examples
of row comparisons in the context of row subqueries, see
<a class="xref" href="row-subqueries.html" title="15.2.15.5 Row Subqueries">
Section 15.2.15.5, “Row Subqueries”
</a>
.
</p>
<p>
Some of the functions in this section return values other than
<code class="literal">
1
</code>
(
<code class="literal">
TRUE
</code>
),
<code class="literal">
0
</code>
(
<code class="literal">
FALSE
</code>
), or
<code class="literal">
NULL
</code>
.
<a class="link" href="comparison-operators.html#function_least">
<code class="literal">
LEAST()
</code>
</a>
and
<a class="link" href="comparison-operators.html#function_greatest">
<code class="literal">
GREATEST()
</code>
</a>
are examples of
such functions;
<a class="xref" href="type-conversion.html" title="14.3 Type Conversion in Expression Evaluation">
Section 14.3, “Type Conversion in Expression Evaluation”
</a>
, describes the
rules for comparison operations performed by these and similar
functions for determining their return values.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
In previous versions of MySQL, when evaluating an expression
containing
<code class="literal">
LEAST()
</code>
or
<code class="literal">
GREATEST()
</code>
, the server attempted to guess
the context in which the function was used, and to coerce the
function's arguments to the data type of the expression
as a whole. For example, the arguments to
<code class="literal">
LEAST("11",
"45", "2")
</code>
are evaluated and sorted as strings, so
that this expression returns
<code class="literal">
"11"
</code>
.
</p>
<p>
The function is executed using the arguments as provided,
performing data type conversions to one or more of the
arguments if and only if they are not all of the same type.
Any type coercion mandated by an expression that makes use of
the return value is now performed following function
execution. This means that
<code class="literal">
LEAST("11", "45", "2") +
0
</code>
evaluates to
<code class="literal">
"11" + 0
</code>
and thus
to integer 11.
</p>
</div>
<p>
To convert a value to a specific type for comparison purposes,
you can use the
<a class="link" href="cast-functions.html#function_cast">
<code class="literal">
CAST()
</code>
</a>
function.
String values can be converted to a different character set
using
<a class="link" href="cast-functions.html#function_convert">
<code class="literal">
CONVERT()
</code>
</a>
. See
<a class="xref" href="cast-functions.html" title="14.10 Cast Functions and Operators">
Section 14.10, “Cast Functions and Operators”
</a>
.
</p>
<p>
By default, string comparisons are not case-sensitive and use
the current character set. The default is
<code class="literal">
utf8mb4
</code>
.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<a name="operator_equal">
</a>
<p>
<a class="link" href="comparison-operators.html#operator_equal">
<code class="literal">
=
</code>
</a>
</p>
<a class="indexterm" name="idm46045207414432">
</a>
<a class="indexterm" name="idm46045207413360">
</a>
<p>
Equal:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa16263438"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token number">1</span> <span class="token operator">=</span> <span class="token number">0</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token number">0</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token string">'0'</span> <span class="token operator">=</span> <span class="token number">0</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token number">1</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token string">'0.0'</span> <span class="token operator">=</span> <span class="token number">0</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token number">1</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token string">'0.01'</span> <span class="token operator">=</span> <span class="token number">0</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token number">0</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token string">'.01'</span> <span class="token operator">=</span> <span class="token number">0.01</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token number">1</span></code></pre>
</div>
<p>
For row comparisons,
<code class="literal">
(a, b) = (x, y)
</code>
is
equivalent to:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa23036238"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token punctuation">(</span>a <span class="token operator">=</span> x<span class="token punctuation">)</span> <span class="token operator">AND</span> <span class="token punctuation">(</span>b <span class="token operator">=</span> y<span class="token punctuation">)</span></code></pre>
</div>
</li>
<li class="listitem">
<a name="operator_equal-to">
</a>
<p>
<a class="link" href="comparison-operators.html#operator_equal-to">
<code class="literal">
<=>
</code>
</a>
</p>
<a class="indexterm" name="idm46045207399728">
</a>
<a class="indexterm" name="idm46045207398240">
</a>
<p>
<code class="literal">
NULL
</code>
-safe equal. This operator performs
an equality comparison like the
<a class="link" href="comparison-operators.html#operator_equal">
<code class="literal">
=
</code>
</a>
operator,
but returns
<code class="literal">
1
</code>
rather than
<code class="literal">
NULL
</code>
if both operands are
<code class="literal">
NULL
</code>
, and
<code class="literal">
0
</code>
rather
than
<code class="literal">
NULL
</code>
if one operand is
<code class="literal">
NULL
</code>
.
</p>
<a class="indexterm" name="idm46045207389376">
</a>
<p>
The
<a class="link" href="comparison-operators.html#operator_equal-to">
<code class="literal">
<=>
</code>
</a>
operator is equivalent to the standard SQL
<code class="literal">
IS NOT
DISTINCT FROM
</code>
operator.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa64192829"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token number">1</span> <span class="token operator"><=></span> <span class="token number">1</span><span class="token punctuation">,</span> <span class="token boolean">NULL</span> <span class="token operator"><=></span> <span class="token boolean">NULL</span><span class="token punctuation">,</span> <span class="token number">1</span> <span class="token operator"><=></span> <span class="token boolean">NULL</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token number">1</span><span class="token punctuation">,</span> <span class="token number">1</span><span class="token punctuation">,</span> <span class="token number">0</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token number">1</span> <span class="token operator">=</span> <span class="token number">1</span><span class="token punctuation">,</span> <span class="token boolean">NULL</span> <span class="token operator">=</span> <span class="token boolean">NULL</span><span class="token punctuation">,</span> <span class="token number">1</span> <span class="token operator">=</span> <span class="token boolean">NULL</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token number">1</span><span class="token punctuation">,</span> <span class="token boolean">NULL</span><span class="token punctuation">,</span> <span class="token boolean">NULL</span></code></pre>
</div>
<p>
For row comparisons,
<code class="literal">
(a, b) <=> (x,
y)
</code>
is equivalent to:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa46756088"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token punctuation">(</span>a <span class="token operator"><=></span> x<span class="token punctuation">)</span> <span class="token operator">AND</span> <span class="token punctuation">(</span>b <span class="token operator"><=></span> y<span class="token punctuation">)</span></code></pre>
</div>
</li>
<li class="listitem">
<a name="operator_not-equal">
</a>
<p>
<a class="link" href="comparison-operators.html#operator_not-equal">
<code class="literal">
<>
</code>
</a>
,
<a class="link" href="comparison-operators.html#operator_not-equal">
<code class="literal">
!=
</code>
</a>
</p>
<a class="indexterm" name="idm46045207374448">
</a>
<a class="indexterm" name="idm46045207373360">
</a>
<a class="indexterm" name="idm46045207372272">
</a>
<a class="indexterm" name="idm46045207371200">
</a>
<p>
Not equal:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa68292195"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token string">'.01'</span> <span class="token operator"><></span> <span class="token string">'0.01'</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token number">1</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token punctuation">.</span><span class="token number">01</span> <span class="token operator"><></span> <span class="token string">'0.01'</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token number">0</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token string">'zapp'</span> <span class="token operator"><></span> <span class="token string">'zappp'</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token number">1</span></code></pre>
</div>
<p>
For row comparisons,
<code class="literal">
(a, b) <> (x,
y)
</code>
and
<code class="literal">
(a, b) != (x, y)
</code>
are
equivalent to:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa47026916"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token punctuation">(</span>a <span class="token operator"><></span> x<span class="token punctuation">)</span> <span class="token operator">OR</span> <span class="token punctuation">(</span>b <span class="token operator"><></span> y<span class="token punctuation">)</span></code></pre>
</div>
</li>
<li class="listitem">
<a name="operator_less-than-or-equal">
</a>
<p>
<a class="link" href="comparison-operators.html#operator_less-than-or-equal">
<code class="literal">
<=
</code>
</a>
</p>
<a class="indexterm" name="idm46045207356992">
</a>
<a class="indexterm" name="idm46045207355888">
</a>
<p>
Less than or equal:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa24322044"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token number">0.1</span> <span class="token operator"><=</span> <span class="token number">2</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token number">1</span></code></pre>
</div>
<p>
For row comparisons,
<code class="literal">
(a, b) <= (x, y)
</code>
is equivalent to:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa99196908"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token punctuation">(</span>a <span class="token operator"><</span> x<span class="token punctuation">)</span> <span class="token operator">OR</span> <span class="token punctuation">(</span><span class="token punctuation">(</span>a <span class="token operator">=</span> x<span class="token punctuation">)</span> <span class="token operator">AND</span> <span class="token punctuation">(</span>b <span class="token operator"><=</span> y<span class="token punctuation">)</span><span class="token punctuation">)</span></code></pre>
</div>
</li>
<li class="listitem">
<a name="operator_less-than">
</a>
<p>
<a class="link" href="comparison-operators.html#operator_less-than">
<code class="literal">
<
</code>
</a>
</p>
<a class="indexterm" name="idm46045207344016">
</a>
<a class="indexterm" name="idm46045207342928">
</a>
<p>
Less than:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa49249301"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token number">2</span> <span class="token operator"><</span> <span class="token number">2</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token number">0</span></code></pre>
</div>
<p>
For row comparisons,
<code class="literal">
(a, b) < (x, y)
</code>
is equivalent to:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa46569991"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token punctuation">(</span>a <span class="token operator"><</span> x<span class="token punctuation">)</span> <span class="token operator">OR</span> <span class="token punctuation">(</span><span class="token punctuation">(</span>a <span class="token operator">=</span> x<span class="token punctuation">)</span> <span class="token operator">AND</span> <span class="token punctuation">(</span>b <span class="token operator"><</span> y<span class="token punctuation">)</span><span class="token punctuation">)</span></code></pre>
</div>
</li>
<li class="listitem">
<a name="operator_greater-than-or-equal">
</a>
<p>
<a class="link" href="comparison-operators.html#operator_greater-than-or-equal">
<code class="literal">
>=
</code>
</a>
</p>
<a class="indexterm" name="idm46045207330944">
</a>
<a class="indexterm" name="idm46045207329840">
</a>
<p>
Greater than or equal:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa51601536"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token number">2</span> <span class="token operator">>=</span> <span class="token number">2</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token number">1</span></code></pre>
</div>
<p>
For row comparisons,
<code class="literal">
(a, b) >= (x, y)
</code>
is equivalent to:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa76384607"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token punctuation">(</span>a <span class="token operator">></span> x<span class="token punctuation">)</span> <span class="token operator">OR</span> <span class="token punctuation">(</span><span class="token punctuation">(</span>a <span class="token operator">=</span> x<span class="token punctuation">)</span> <span class="token operator">AND</span> <span class="token punctuation">(</span>b <span class="token operator">>=</span> y<span class="token punctuation">)</span><span class="token punctuation">)</span></code></pre>
</div>
</li>
<li class="listitem">
<a name="operator_greater-than">
</a>
<p>
<a class="link" href="comparison-operators.html#operator_greater-than">
<code class="literal">
>
</code>
</a>
</p>
<a class="indexterm" name="idm46045207317984">
</a>
<a class="indexterm" name="idm46045207316896">
</a>
<p>
Greater than:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa90079518"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token number">2</span> <span class="token operator">></span> <span class="token number">2</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token number">0</span></code></pre>
</div>
<p>
For row comparisons,
<code class="literal">
(a, b) > (x, y)
</code>
is equivalent to:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa91429220"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token punctuation">(</span>a <span class="token operator">></span> x<span class="token punctuation">)</span> <span class="token operator">OR</span> <span class="token punctuation">(</span><span class="token punctuation">(</span>a <span class="token operator">=</span> x<span class="token punctuation">)</span> <span class="token operator">AND</span> <span class="token punctuation">(</span>b <span class="token operator">></span> y<span class="token punctuation">)</span><span class="token punctuation">)</span></code></pre>
</div>
</li>
<li class="listitem">
<a name="operator_between">
</a>
<p>
<a class="link" href="comparison-operators.html#operator_between">
<code class="literal">
<em class="replaceable">
<code>
expr
</code>
</em>
BETWEEN
<em class="replaceable">
<code>
min
</code>
</em>
AND
<em class="replaceable">
<code>
max
</code>
</em>
</code>
</a>
</p>
<a class="indexterm" name="idm46045207303968">
</a>
<p>
If
<em class="replaceable">
<code>
expr
</code>
</em>
is greater than or equal
to
<em class="replaceable">
<code>
min
</code>
</em>
and
<em class="replaceable">
<code>
expr
</code>
</em>
is less than or equal to
<em class="replaceable">
<code>
max
</code>
</em>
,
<a class="link" href="comparison-operators.html#operator_between">
<code class="literal">
BETWEEN
</code>
</a>
returns
<code class="literal">
1
</code>
, otherwise it returns
<code class="literal">
0
</code>
. This is equivalent to the expression
<code class="literal">
(
<em class="replaceable">
<code>
min
</code>
</em>
<=
<em class="replaceable">
<code>
expr
</code>
</em>
AND
<em class="replaceable">
<code>
expr
</code>
</em>
<=
<em class="replaceable">
<code>
max
</code>
</em>
)
</code>
if all the
arguments are of the same type. Otherwise type conversion
takes place according to the rules described in
<a class="xref" href="type-conversion.html" title="14.3 Type Conversion in Expression Evaluation">
Section 14.3, “Type Conversion in Expression Evaluation”
</a>
, but applied to all the
three arguments.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa90764498"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token number">2</span> <span class="token operator">BETWEEN</span> <span class="token number">1</span> <span class="token operator">AND</span> <span class="token number">3</span><span class="token punctuation">,</span> <span class="token number">2</span> <span class="token operator">BETWEEN</span> <span class="token number">3</span> <span class="token operator">and</span> <span class="token number">1</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token number">1</span><span class="token punctuation">,</span> <span class="token number">0</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token number">1</span> <span class="token operator">BETWEEN</span> <span class="token number">2</span> <span class="token operator">AND</span> <span class="token number">3</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token number">0</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token string">'b'</span> <span class="token operator">BETWEEN</span> <span class="token string">'a'</span> <span class="token operator">AND</span> <span class="token string">'c'</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token number">1</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token number">2</span> <span class="token operator">BETWEEN</span> <span class="token number">2</span> <span class="token operator">AND</span> <span class="token string">'3'</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token number">1</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token number">2</span> <span class="token operator">BETWEEN</span> <span class="token number">2</span> <span class="token operator">AND</span> <span class="token string">'x-3'</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token number">0</span></code></pre>
</div>
<p>
For best results when using
<a class="link" href="comparison-operators.html#operator_between">
<code class="literal">
BETWEEN
</code>
</a>
with date or time
values, use
<a class="link" href="cast-functions.html#function_cast">
<code class="literal">
CAST()
</code>
</a>
to
explicitly convert the values to the desired data type.
Examples: If you compare a
<a class="link" href="datetime.html" title="13.2.2 The DATE, DATETIME, and TIMESTAMP Types">
<code class="literal">
DATETIME
</code>
</a>
to two
<a class="link" href="datetime.html" title="13.2.2 The DATE, DATETIME, and TIMESTAMP Types">
<code class="literal">
DATE
</code>
</a>
values, convert the
<a class="link" href="datetime.html" title="13.2.2 The DATE, DATETIME, and TIMESTAMP Types">
<code class="literal">
DATE
</code>
</a>
values to
<a class="link" href="datetime.html" title="13.2.2 The DATE, DATETIME, and TIMESTAMP Types">
<code class="literal">
DATETIME
</code>
</a>
values. If you use a
string constant such as
<code class="literal">
'2001-1-1'
</code>
in a
comparison to a
<a class="link" href="datetime.html" title="13.2.2 The DATE, DATETIME, and TIMESTAMP Types">
<code class="literal">
DATE
</code>
</a>
, cast
the string to a
<a class="link" href="datetime.html" title="13.2.2 The DATE, DATETIME, and TIMESTAMP Types">
<code class="literal">
DATE
</code>
</a>
.
</p>
</li>
<li class="listitem">
<a name="operator_not-between">
</a>
<p>
<a class="link" href="comparison-operators.html#operator_not-between">
<code class="literal">
<em class="replaceable">
<code>
expr
</code>
</em>
NOT BETWEEN
<em class="replaceable">
<code>
min
</code>
</em>
AND
<em class="replaceable">
<code>
max
</code>
</em>
</code>
</a>
</p>
<a class="indexterm" name="idm46045207271392">
</a>
<p>
This is the same as
<code class="literal">
NOT
(
<em class="replaceable">
<code>
expr
</code>
</em>
BETWEEN
<em class="replaceable">
<code>
min
</code>
</em>
AND
<em class="replaceable">
<code>
max
</code>
</em>
)
</code>
.
</p>
</li>
<li class="listitem">
<a name="function_coalesce">
</a>
<p>
<a class="link" href="comparison-operators.html#function_coalesce">
<code class="literal">
COALESCE(
<em class="replaceable">
<code>
value
</code>
</em>
,...)
</code>
</a>
</p>
<a class="indexterm" name="idm46045207261456">
</a>
<a class="indexterm" name="idm46045207260384">
</a>
<p>
Returns the first non-
<code class="literal">
NULL
</code>
value in the
list, or
<code class="literal">
NULL
</code>
if there are no
non-
<code class="literal">
NULL
</code>
values.
</p>
<p>
The return type of
<a class="link" href="comparison-operators.html#function_coalesce">
<code class="literal">
COALESCE()
</code>
</a>
is the aggregated type of the argument types.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa34886639"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">COALESCE</span><span class="token punctuation">(</span><span class="token boolean">NULL</span><span class="token punctuation">,</span><span class="token number">1</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token number">1</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">COALESCE</span><span class="token punctuation">(</span><span class="token boolean">NULL</span><span class="token punctuation">,</span><span class="token boolean">NULL</span><span class="token punctuation">,</span><span class="token boolean">NULL</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token boolean">NULL</span></code></pre>
</div>
</li>
<li class="listitem">
<a name="operator_exists">
</a>
<p>
<a class="link" href="comparison-operators.html#operator_exists">
<code class="literal">
EXISTS(
<em class="replaceable">
<code>
query
</code>
</em>
)
</code>
</a>
</p>
<a class="indexterm" name="idm46045207245200">
</a>
<p>
Whether the result of a query contains any rows.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa59913101"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> t <span class="token punctuation">(</span>col <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">3</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">INSERT</span> <span class="token keyword">INTO</span> t <span class="token keyword">VALUES</span> <span class="token punctuation">(</span><span class="token string">'aaa'</span><span class="token punctuation">,</span> <span class="token string">'bbb'</span><span class="token punctuation">,</span> <span class="token string">'ccc'</span><span class="token punctuation">,</span> <span class="token string">'eee'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">SELECT</span> <span class="token keyword">EXISTS</span> <span class="token punctuation">(</span><span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> t <span class="token keyword">WHERE</span> col <span class="token operator">LIKE</span> <span class="token string">'c%'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token number">1</span>
<span class="token keyword">SELECT</span> <span class="token keyword">EXISTS</span> <span class="token punctuation">(</span><span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> t <span class="token keyword">WHERE</span> col <span class="token operator">LIKE</span> <span class="token string">'d%'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token number">0</span></code></pre>
</div>
</li>
<li class="listitem">
<a name="operator_not-exists">
</a>
<p>
<a class="link" href="comparison-operators.html#operator_not-exists">
<code class="literal">
NOT
EXISTS(
<em class="replaceable">
<code>
query
</code>
</em>
)
</code>
</a>
</p>
<a class="indexterm" name="idm46045207235536">
</a>
<p>
Whether the result of a query contains no rows:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa3018353"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SELECT</span> <span class="token operator">NOT</span> <span class="token keyword">EXISTS</span> <span class="token punctuation">(</span><span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> t <span class="token keyword">WHERE</span> col <span class="token operator">LIKE</span> <span class="token string">'c%'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token number">0</span>
<span class="token keyword">SELECT</span> <span class="token operator">NOT</span> <span class="token keyword">EXISTS</span> <span class="token punctuation">(</span><span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> t <span class="token keyword">WHERE</span> col <span class="token operator">LIKE</span> <span class="token string">'d%'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token number">1</span></code></pre>
</div>
</li>
<li class="listitem">
<a name="function_greatest">
</a>
<p>
<a class="link" href="comparison-operators.html#function_greatest">
<code class="literal">
GREATEST(
<em class="replaceable">
<code>
value1
</code>
</em>
,
<em class="replaceable">
<code>
value2
</code>
</em>
,...)
</code>
</a>
</p>
<a class="indexterm" name="idm46045207225264">
</a>
<p>
With two or more arguments, returns the largest
(maximum-valued) argument. The arguments are compared using
the same rules as for
<a class="link" href="comparison-operators.html#function_least">
<code class="literal">
LEAST()
</code>
</a>
.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa37708795"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">GREATEST</span><span class="token punctuation">(</span><span class="token number">2</span><span class="token punctuation">,</span><span class="token number">0</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token number">2</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">GREATEST</span><span class="token punctuation">(</span><span class="token number">34.0</span><span class="token punctuation">,</span><span class="token number">3.0</span><span class="token punctuation">,</span><span class="token number">5.0</span><span class="token punctuation">,</span><span class="token number">767.0</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token number">767.0</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">GREATEST</span><span class="token punctuation">(</span><span class="token string">'B'</span><span class="token punctuation">,</span><span class="token string">'A'</span><span class="token punctuation">,</span><span class="token string">'C'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token string">'C'</span></code></pre>
</div>
<p>
<a class="link" href="comparison-operators.html#function_greatest">
<code class="literal">
GREATEST()
</code>
</a>
returns
<code class="literal">
NULL
</code>
if any argument is
<code class="literal">
NULL
</code>
.
</p>
</li>
<li class="listitem">
<a name="operator_in">
</a>
<p>
<a class="link" href="comparison-operators.html#operator_in">
<code class="literal">
<em class="replaceable">
<code>
expr
</code>
</em>
IN (
<em class="replaceable">
<code>
value
</code>
</em>
,...)
</code>
</a>
</p>
<a class="indexterm" name="idm46045207208912">
</a>
<p>
Returns
<code class="literal">
1
</code>
(true) if
<em class="replaceable">
<code>
expr
</code>
</em>
is equal to any of the
values in the
<code class="literal">
IN()
</code>
list, else returns
<code class="literal">
0
</code>
(false).
</p>
<p>
Type conversion takes place according to the rules described
in
<a class="xref" href="type-conversion.html" title="14.3 Type Conversion in Expression Evaluation">
Section 14.3, “Type Conversion in Expression Evaluation”
</a>
, applied to all the
arguments. If no type conversion is needed for the values in
the
<code class="literal">
IN()
</code>
list, they are all
non-
<code class="literal">
JSON
</code>
constants of the same type, and
<em class="replaceable">
<code>
expr
</code>
</em>
can be compared to each of
them as a value of the same type (possibly after type
conversion), an optimization takes place. The values the
list are sorted and the search for
<em class="replaceable">
<code>
expr
</code>
</em>
is done using a binary
search, which makes the
<code class="literal">
IN()
</code>
operation
very quick.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa56312847"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token number">2</span> <span class="token keyword">IN</span> <span class="token punctuation">(</span><span class="token number">0</span><span class="token punctuation">,</span><span class="token number">3</span><span class="token punctuation">,</span><span class="token number">5</span><span class="token punctuation">,</span><span class="token number">7</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token number">0</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token string">'wefwf'</span> <span class="token keyword">IN</span> <span class="token punctuation">(</span><span class="token string">'wee'</span><span class="token punctuation">,</span><span class="token string">'wefwf'</span><span class="token punctuation">,</span><span class="token string">'weg'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token number">1</span></code></pre>
</div>
<p>
<code class="literal">
IN()
</code>
can be used to compare row
constructors:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa76408549"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token punctuation">(</span><span class="token number">3</span><span class="token punctuation">,</span><span class="token number">4</span><span class="token punctuation">)</span> <span class="token keyword">IN</span> <span class="token punctuation">(</span><span class="token punctuation">(</span><span class="token number">1</span><span class="token punctuation">,</span><span class="token number">2</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token number">3</span><span class="token punctuation">,</span><span class="token number">4</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token number">1</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token punctuation">(</span><span class="token number">3</span><span class="token punctuation">,</span><span class="token number">4</span><span class="token punctuation">)</span> <span class="token keyword">IN</span> <span class="token punctuation">(</span><span class="token punctuation">(</span><span class="token number">1</span><span class="token punctuation">,</span><span class="token number">2</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token number">3</span><span class="token punctuation">,</span><span class="token number">5</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token number">0</span></code></pre>
</div>
<p>
You should never mix quoted and unquoted values in an
<code class="literal">
IN()
</code>
list because the comparison rules
for quoted values (such as strings) and unquoted values
(such as numbers) differ. Mixing types may therefore lead to
inconsistent results. For example, do not write an
<code class="literal">
IN()
</code>
expression like this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa63478292"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SELECT</span> val1 <span class="token keyword">FROM</span> tbl1 <span class="token keyword">WHERE</span> val1 <span class="token keyword">IN</span> <span class="token punctuation">(</span><span class="token number">1</span><span class="token punctuation">,</span><span class="token number">2</span><span class="token punctuation">,</span><span class="token string">'a'</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Instead, write it like this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa51052415"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SELECT</span> val1 <span class="token keyword">FROM</span> tbl1 <span class="token keyword">WHERE</span> val1 <span class="token keyword">IN</span> <span class="token punctuation">(</span><span class="token string">'1'</span><span class="token punctuation">,</span><span class="token string">'2'</span><span class="token punctuation">,</span><span class="token string">'a'</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Implicit type conversion may produce nonintuitive results:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa94526444"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token string">'a'</span> <span class="token keyword">IN</span> <span class="token punctuation">(</span><span class="token number">0</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token number">0</span> <span class="token keyword">IN</span> <span class="token punctuation">(</span><span class="token string">'b'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token number">1</span><span class="token punctuation">,</span> <span class="token number">1</span></code></pre>
</div>
<p>
In both cases, the comparison values are converted to
floating-point values, yielding 0.0 in each case, and a
comparison result of 1 (true).
</p>
<p>
The number of values in the
<code class="literal">
IN()
</code>
list is
only limited by the
<a class="link" href="server-system-variables.html#sysvar_max_allowed_packet">
<code class="literal">
max_allowed_packet
</code>
</a>
value.
</p>
<p>
To comply with the SQL standard,
<code class="literal">
IN()
</code>
returns
<code class="literal">
NULL
</code>
not only if the expression
on the left hand side is
<code class="literal">
NULL
</code>
, but also
if no match is found in the list and one of the expressions
in the list is
<code class="literal">
NULL
</code>
.
</p>
<p>
<code class="literal">
IN()
</code>
syntax can also be used to write
certain types of subqueries. See
<a class="xref" href="any-in-some-subqueries.html" title="15.2.15.3 Subqueries with ANY, IN, or SOME">
Section 15.2.15.3, “Subqueries with ANY, IN, or SOME”
</a>
.
</p>
</li>
<li class="listitem">
<a name="operator_not-in">
</a>
<p>
<a class="link" href="comparison-operators.html#operator_not-in">
<code class="literal">
<em class="replaceable">
<code>
expr
</code>
</em>
NOT IN (
<em class="replaceable">
<code>
value
</code>
</em>
,...)
</code>
</a>
</p>
<a class="indexterm" name="idm46045207171696">
</a>
<p>
This is the same as
<code class="literal">
NOT
(
<em class="replaceable">
<code>
expr
</code>
</em>
IN
(
<em class="replaceable">
<code>
value
</code>
</em>
,...))
</code>
.
</p>
</li>
<li class="listitem">
<a name="function_interval">
</a>
<p>
<a class="link" href="comparison-operators.html#function_interval">
<code class="literal">
INTERVAL(
<em class="replaceable">
<code>
N
</code>
</em>
,
<em class="replaceable">
<code>
N1
</code>
</em>
,
<em class="replaceable">
<code>
N2
</code>
</em>
,
<em class="replaceable">
<code>
N3
</code>
</em>
,...)
</code>
</a>
</p>
<a class="indexterm" name="idm46045207160848">
</a>
<p>
Returns
<code class="literal">
0
</code>
if
<em class="replaceable">
<code>
N
</code>
</em>
≤
<em class="replaceable">
<code>
N1
</code>
</em>
,
<code class="literal">
1
</code>
if
<em class="replaceable">
<code>
N
</code>
</em>
≤
<em class="replaceable">
<code>
N2
</code>
</em>
and so on, or
<code class="literal">
-1
</code>
if
<em class="replaceable">
<code>
N
</code>
</em>
is
<code class="literal">
NULL
</code>
. All arguments are treated as
integers. It is required that
<em class="replaceable">
<code>
N1
</code>
</em>
≤
<em class="replaceable">
<code>
N2
</code>
</em>
≤
<em class="replaceable">
<code>
N3
</code>
</em>
≤
<code class="literal">
...
</code>
≤
<em class="replaceable">
<code>
Nn
</code>
</em>
for this function to work
correctly. This is because a binary search is used (very
fast).
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa90942116"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token keyword">INTERVAL</span><span class="token punctuation">(</span><span class="token number">23</span><span class="token punctuation">,</span> <span class="token number">1</span><span class="token punctuation">,</span> <span class="token number">15</span><span class="token punctuation">,</span> <span class="token number">17</span><span class="token punctuation">,</span> <span class="token number">30</span><span class="token punctuation">,</span> <span class="token number">44</span><span class="token punctuation">,</span> <span class="token number">200</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token number">3</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token keyword">INTERVAL</span><span class="token punctuation">(</span><span class="token number">10</span><span class="token punctuation">,</span> <span class="token number">1</span><span class="token punctuation">,</span> <span class="token number">10</span><span class="token punctuation">,</span> <span class="token number">100</span><span class="token punctuation">,</span> <span class="token number">1000</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token number">2</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token keyword">INTERVAL</span><span class="token punctuation">(</span><span class="token number">22</span><span class="token punctuation">,</span> <span class="token number">23</span><span class="token punctuation">,</span> <span class="token number">30</span><span class="token punctuation">,</span> <span class="token number">44</span><span class="token punctuation">,</span> <span class="token number">200</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token number">0</span></code></pre>
</div>
</li>
<li class="listitem">
<a name="operator_is">
</a>
<p>
<a class="link" href="comparison-operators.html#operator_is">
<code class="literal">
IS
<em class="replaceable">
<code>
boolean_value
</code>
</em>
</code>
</a>
</p>
<a class="indexterm" name="idm46045207141904">
</a>
<a class="indexterm" name="idm46045207140416">
</a>
<a class="indexterm" name="idm46045207138928">
</a>
<a class="indexterm" name="idm46045207137440">
</a>
<p>
Tests a value against a boolean value, where
<em class="replaceable">
<code>
boolean_value
</code>
</em>
can be
<code class="literal">
TRUE
</code>
,
<code class="literal">
FALSE
</code>
, or
<code class="literal">
UNKNOWN
</code>
.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa58580644"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token number">1</span> <span class="token operator">IS</span> <span class="token boolean">TRUE</span><span class="token punctuation">,</span> <span class="token number">0</span> <span class="token operator">IS</span> <span class="token boolean">FALSE</span><span class="token punctuation">,</span> <span class="token boolean">NULL</span> <span class="token operator">IS</span> <span class="token keyword">UNKNOWN</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token number">1</span><span class="token punctuation">,</span> <span class="token number">1</span><span class="token punctuation">,</span> <span class="token number">1</span></code></pre>
</div>
</li>
<li class="listitem">
<a name="operator_is-not">
</a>
<p>
<a class="link" href="comparison-operators.html#operator_is-not">
<code class="literal">
IS NOT
<em class="replaceable">
<code>
boolean_value
</code>
</em>
</code>
</a>
</p>
<a class="indexterm" name="idm46045207124816">
</a>
<a class="indexterm" name="idm46045207123328">
</a>
<a class="indexterm" name="idm46045207121840">
</a>
<a class="indexterm" name="idm46045207120352">
</a>
<p>
Tests a value against a boolean value, where
<em class="replaceable">
<code>
boolean_value
</code>
</em>
can be
<code class="literal">
TRUE
</code>
,
<code class="literal">
FALSE
</code>
, or
<code class="literal">
UNKNOWN
</code>
.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa63641583"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token number">1</span> <span class="token operator">IS</span> <span class="token operator">NOT</span> <span class="token keyword">UNKNOWN</span><span class="token punctuation">,</span> <span class="token number">0</span> <span class="token operator">IS</span> <span class="token operator">NOT</span> <span class="token keyword">UNKNOWN</span><span class="token punctuation">,</span> <span class="token boolean">NULL</span> <span class="token operator">IS</span> <span class="token operator">NOT</span> <span class="token keyword">UNKNOWN</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token number">1</span><span class="token punctuation">,</span> <span class="token number">1</span><span class="token punctuation">,</span> <span class="token number">0</span></code></pre>
</div>
</li>
<li class="listitem">
<a name="operator_is-null">
</a>
<p>
<a class="link" href="comparison-operators.html#operator_is-null">
<code class="literal">
IS NULL
</code>
</a>
</p>
<a class="indexterm" name="idm46045207108000">
</a>
<a class="indexterm" name="idm46045207106512">
</a>
<p>
Tests whether a value is
<code class="literal">
NULL
</code>
.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa53132043"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token number">1</span> <span class="token operator">IS</span> <span class="token boolean">NULL</span><span class="token punctuation">,</span> <span class="token number">0</span> <span class="token operator">IS</span> <span class="token boolean">NULL</span><span class="token punctuation">,</span> <span class="token boolean">NULL</span> <span class="token operator">IS</span> <span class="token boolean">NULL</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token number">0</span><span class="token punctuation">,</span> <span class="token number">0</span><span class="token punctuation">,</span> <span class="token number">1</span></code></pre>
</div>
<p>
To work well with ODBC programs, MySQL supports the
following extra features when using
<a class="link" href="comparison-operators.html#operator_is-null">
<code class="literal">
IS
NULL
</code>
</a>
:
</p>
<a class="indexterm" name="idm46045207098752">
</a>
<a class="indexterm" name="idm46045207097680">
</a>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
If
<a class="link" href="server-system-variables.html#sysvar_sql_auto_is_null">
<code class="literal">
sql_auto_is_null
</code>
</a>
variable is set to 1, then after a statement that
successfully inserts an automatically generated
<code class="literal">
AUTO_INCREMENT
</code>
value, you can find
that value by issuing a statement of the following form:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa39169983"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> <em class="replaceable">tbl_name</em> <span class="token keyword">WHERE</span> <em class="replaceable">auto_col</em> <span class="token operator">IS</span> <span class="token boolean">NULL</span></code></pre>
</div>
<p>
If the statement returns a row, the value returned is
the same as if you invoked the
<a class="link" href="information-functions.html#function_last-insert-id">
<code class="literal">
LAST_INSERT_ID()
</code>
</a>
function. For details, including the return value after
a multiple-row insert, see
<a class="xref" href="information-functions.html" title="14.15 Information Functions">
Section 14.15, “Information Functions”
</a>
. If no
<code class="literal">
AUTO_INCREMENT
</code>
value was successfully
inserted, the
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
statement returns no row.
</p>
<p>
The behavior of retrieving an
<code class="literal">
AUTO_INCREMENT
</code>
value by using an
<a class="link" href="comparison-operators.html#operator_is-null">
<code class="literal">
IS NULL
</code>
</a>
comparison can be
disabled by setting
<a class="link" href="server-system-variables.html#sysvar_sql_auto_is_null">
<code class="literal">
sql_auto_is_null = 0
</code>
</a>
.
See
<a class="xref" href="server-system-variables.html" title="7.1.8 Server System Variables">
Section 7.1.8, “Server System Variables”
</a>
.
</p>
<p>
The default value of
<a class="link" href="server-system-variables.html#sysvar_sql_auto_is_null">
<code class="literal">
sql_auto_is_null
</code>
</a>
is 0.
</p>
</li>
<li class="listitem">
<p>
For
<a class="link" href="datetime.html" title="13.2.2 The DATE, DATETIME, and TIMESTAMP Types">
<code class="literal">
DATE
</code>
</a>
and
<a class="link" href="datetime.html" title="13.2.2 The DATE, DATETIME, and TIMESTAMP Types">
<code class="literal">
DATETIME
</code>
</a>
columns that are
declared as
<code class="literal">
NOT NULL
</code>
, you can find
the special date
<code class="literal">
'0000-00-00'
</code>
by
using a statement like this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa82828835"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> <em class="replaceable">tbl_name</em> <span class="token keyword">WHERE</span> <em class="replaceable">date_column</em> <span class="token operator">IS</span> <span class="token boolean">NULL</span></code></pre>
</div>
<p>
This is needed to get some ODBC applications to work
because ODBC does not support a
<code class="literal">
'0000-00-00'
</code>
date value.
</p>
<p>
See
<a class="ulink" href="/doc/connector-odbc/en/connector-odbc-usagenotes-functionality-last-insert-id.html" target="_top">
Obtaining Auto-Increment Values
</a>
,
and the description for the
<code class="literal">
FLAG_AUTO_IS_NULL
</code>
option at
<a class="ulink" href="/doc/connector-odbc/en/connector-odbc-configuration-connection-parameters.html" target="_top">
Connector/ODBC Connection Parameters
</a>
.
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<a name="operator_is-not-null">
</a>
<p>
<a class="link" href="comparison-operators.html#operator_is-null">
<code class="literal">
IS NOT NULL
</code>
</a>
</p>
<a class="indexterm" name="idm46045207065168">
</a>
<a class="indexterm" name="idm46045207063680">
</a>
<p>
Tests whether a value is not
<code class="literal">
NULL
</code>
.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa3409621"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token number">1</span> <span class="token operator">IS</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span><span class="token punctuation">,</span> <span class="token number">0</span> <span class="token operator">IS</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span><span class="token punctuation">,</span> <span class="token boolean">NULL</span> <span class="token operator">IS</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token number">1</span><span class="token punctuation">,</span> <span class="token number">1</span><span class="token punctuation">,</span> <span class="token number">0</span></code></pre>
</div>
</li>
<li class="listitem">
<a name="function_isnull">
</a>
<p>
<a class="link" href="comparison-operators.html#function_isnull">
<code class="literal">
ISNULL(
<em class="replaceable">
<code>
expr
</code>
</em>
)
</code>
</a>
</p>
<a class="indexterm" name="idm46045207052800">
</a>
<p>
If
<em class="replaceable">
<code>
expr
</code>
</em>
is
<code class="literal">
NULL
</code>
,
<a class="link" href="comparison-operators.html#function_isnull">
<code class="literal">
ISNULL()
</code>
</a>
returns
<code class="literal">
1
</code>
, otherwise it returns
<code class="literal">
0
</code>
.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa48433968"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">ISNULL</span><span class="token punctuation">(</span><span class="token number">1</span><span class="token operator">+</span><span class="token number">1</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token number">0</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">ISNULL</span><span class="token punctuation">(</span><span class="token number">1</span><span class="token operator">/</span><span class="token number">0</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token number">1</span></code></pre>
</div>
<p>
<a class="link" href="comparison-operators.html#function_isnull">
<code class="literal">
ISNULL()
</code>
</a>
can be used instead
of
<a class="link" href="comparison-operators.html#operator_equal">
<code class="literal">
=
</code>
</a>
to test
whether a value is
<code class="literal">
NULL
</code>
. (Comparing a
value to
<code class="literal">
NULL
</code>
using
<a class="link" href="comparison-operators.html#operator_equal">
<code class="literal">
=
</code>
</a>
always
yields
<code class="literal">
NULL
</code>
.)
</p>
<p>
The
<a class="link" href="comparison-operators.html#function_isnull">
<code class="literal">
ISNULL()
</code>
</a>
function shares
some special behaviors with the
<a class="link" href="comparison-operators.html#operator_is-null">
<code class="literal">
IS NULL
</code>
</a>
comparison operator. See the description of
<a class="link" href="comparison-operators.html#operator_is-null">
<code class="literal">
IS NULL
</code>
</a>
.
</p>
</li>
<li class="listitem">
<a name="function_least">
</a>
<p>
<a class="link" href="comparison-operators.html#function_least">
<code class="literal">
LEAST(
<em class="replaceable">
<code>
value1
</code>
</em>
,
<em class="replaceable">
<code>
value2
</code>
</em>
,...)
</code>
</a>
</p>
<a class="indexterm" name="idm46045207027264">
</a>
<p>
With two or more arguments, returns the smallest
(minimum-valued) argument. The arguments are compared using
the following rules:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
If any argument is
<code class="literal">
NULL
</code>
, the result
is
<code class="literal">
NULL
</code>
. No comparison is needed.
</p>
</li>
<li class="listitem">
<p>
If all arguments are integer-valued, they are compared
as integers.
</p>
</li>
<li class="listitem">
<p>
If at least one argument is double precision, they are
compared as double-precision values. Otherwise, if at
least one argument is a
<a class="link" href="fixed-point-types.html" title="13.1.3 Fixed-Point Types (Exact Value) - DECIMAL, NUMERIC">
<code class="literal">
DECIMAL
</code>
</a>
value, they are
compared as
<a class="link" href="fixed-point-types.html" title="13.1.3 Fixed-Point Types (Exact Value) - DECIMAL, NUMERIC">
<code class="literal">
DECIMAL
</code>
</a>
values.
</p>
</li>
<li class="listitem">
<p>
If the arguments comprise a mix of numbers and strings,
they are compared as strings.
</p>
</li>
<li class="listitem">
<p>
If any argument is a nonbinary (character) string, the
arguments are compared as nonbinary strings.
</p>
</li>
<li class="listitem">
<p>
In all other cases, the arguments are compared as binary
strings.
</p>
</li>
</ul>
</div>
<p>
The return type of
<a class="link" href="comparison-operators.html#function_least">
<code class="literal">
LEAST()
</code>
</a>
is
the aggregated type of the comparison argument types.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa79646191"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">LEAST</span><span class="token punctuation">(</span><span class="token number">2</span><span class="token punctuation">,</span><span class="token number">0</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token number">0</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">LEAST</span><span class="token punctuation">(</span><span class="token number">34.0</span><span class="token punctuation">,</span><span class="token number">3.0</span><span class="token punctuation">,</span><span class="token number">5.0</span><span class="token punctuation">,</span><span class="token number">767.0</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token number">3.0</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">LEAST</span><span class="token punctuation">(</span><span class="token string">'B'</span><span class="token punctuation">,</span><span class="token string">'A'</span><span class="token punctuation">,</span><span class="token string">'C'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token string">'A'</span></code></pre>
</div>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/group-replication-deploying-instances.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="group-replication-deploying-instances">
</a>
20.2.1.1 Deploying Instances for Group Replication
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045134278960">
</a>
<p>
The first step is to deploy at least three instances of MySQL
Server, this procedure demonstrates using multiple hosts for the
instances, named s1, s2, and s3. It is assumed that MySQL Server
is installed on each host (see
<a class="xref" href="installing.html" title="Chapter 2 Installing MySQL">
Chapter 2,
<i>
Installing MySQL
</i>
</a>
).
The Group Replication plugin is provided with MySQL Server
8.4; no additional software is required, although
the plugin must be installed in the running MySQL server. See
<a class="xref" href="group-replication-deploying-instances.html" title="20.2.1.1 Deploying Instances for Group Replication">
Section 20.2.1.1, “Deploying Instances for Group Replication”
</a>
; for
additional information, see
<a class="xref" href="server-plugins.html" title="7.6 MySQL Server Plugins">
Section 7.6, “MySQL Server Plugins”
</a>
.
</p>
<p>
In this example, three instances are used for the group, which
is the minimum number of instances to create a group. Adding
more instances increases the fault tolerance of the group. For
example if the group consists of three members, in event of
failure of one instance the group can continue. But in the event
of another failure the group can no longer continue processing
write transactions. By adding more instances, the number of
servers which can fail while the group continues to process
transactions also increases. The maximum number of instances
which can be used in a group is nine. For more information see
<a class="xref" href="group-replication-failure-detection.html" title="20.1.4.2 Failure Detection">
Section 20.1.4.2, “Failure Detection”
</a>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/miscellaneous-optimization-tips.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="miscellaneous-optimization-tips">
</a>
10.2.7 Other Optimization Tips
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045227602992">
</a>
<a class="indexterm" name="idm46045227601504">
</a>
<p>
This section lists a number of miscellaneous tips for improving
query processing speed:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
If your application makes several database requests to
perform related updates, combining the statements into a
stored routine can help performance. Similarly, if your
application computes a single result based on several column
values or large volumes of data, combining the computation
into a loadable function can help performance. The resulting
fast database operations are then available to be reused by
other queries, applications, and even code written in
different programming languages. See
<a class="xref" href="stored-routines.html" title="27.2 Using Stored Routines">
Section 27.2, “Using Stored Routines”
</a>
and
<a class="ulink" href="/doc/extending-mysql/8.4/en/adding-functions.html" target="_top">
Adding Functions to MySQL
</a>
for more information.
</p>
</li>
<li class="listitem">
<p>
To fix any compression issues that occur with
<code class="literal">
ARCHIVE
</code>
tables, use
<a class="link" href="optimize-table.html" title="15.7.3.4 OPTIMIZE TABLE Statement">
<code class="literal">
OPTIMIZE TABLE
</code>
</a>
. See
<a class="xref" href="archive-storage-engine.html" title="18.5 The ARCHIVE Storage Engine">
Section 18.5, “The ARCHIVE Storage Engine”
</a>
.
</p>
</li>
<li class="listitem">
<p>
If possible, classify reports as
<span class="quote">
“
<span class="quote">
live
</span>
”
</span>
or as
<span class="quote">
“
<span class="quote">
statistical
</span>
”
</span>
, where data needed for
statistical reports is created only from summary tables that
are generated periodically from the live data.
</p>
</li>
<li class="listitem">
<p>
If you have data that does not conform well to a
rows-and-columns table structure, you can pack and store
data into a
<a class="link" href="blob.html" title="13.3.4 The BLOB and TEXT Types">
<code class="literal">
BLOB
</code>
</a>
column. In
this case, you must provide code in your application to pack
and unpack information, but this might save I/O operations
to read and write the sets of related values.
</p>
</li>
<li class="listitem">
<p>
With Web servers, store images and other binary assets as
files, with the path name stored in the database rather than
the file itself. Most Web servers are better at caching
files than database contents, so using files is generally
faster. (Although you must handle backups and storage issues
yourself in this case.)
</p>
</li>
<li class="listitem">
<p>
If you need really high speed, look at the low-level MySQL
interfaces. For example, by accessing the MySQL
<a class="link" href="innodb-storage-engine.html" title="Chapter 17 The InnoDB Storage Engine">
<code class="literal">
InnoDB
</code>
</a>
or
<a class="link" href="myisam-storage-engine.html" title="18.2 The MyISAM Storage Engine">
<code class="literal">
MyISAM
</code>
</a>
storage engine directly,
you could get a substantial speed increase compared to using
the SQL interface.
</p>
<p>
Similarly, for databases using the
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDBCLUSTER
</code>
</a>
storage engine, you
may wish to investigate possible use of the NDB API (see
<a class="ulink" href="/doc/ndbapi/en/" target="_top">
MySQL NDB Cluster API Developer Guide
</a>
).
</p>
</li>
<li class="listitem">
<p>
Replication can provide a performance benefit for some
operations. You can distribute client retrievals among
replicas to split up the load. To avoid slowing down the
source while making backups, you can make backups using a
replica. See
<a class="xref" href="replication.html" title="Chapter 19 Replication">
Chapter 19,
<i>
Replication
</i>
</a>
.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/sql-mode.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="sql-mode">
</a>
7.1.11 Server SQL Modes
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045261679616">
</a>
<p>
The MySQL server can operate in different SQL modes, and can apply
these modes differently for different clients, depending on the
value of the
<a class="link" href="server-system-variables.html#sysvar_sql_mode">
<code class="literal">
sql_mode
</code>
</a>
system
variable. DBAs can set the global SQL mode to match site server
operating requirements, and each application can set its session
SQL mode to its own requirements.
</p>
<p>
Modes affect the SQL syntax MySQL supports and the data validation
checks it performs. This makes it easier to use MySQL in different
environments and to use MySQL together with other database
servers.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="xref" href="sql-mode.html#sql-mode-setting" title="Setting the SQL Mode">
Setting the SQL Mode
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="sql-mode.html#sql-mode-important" title="The Most Important SQL Modes">
The Most Important SQL Modes
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="sql-mode.html#sql-mode-full" title="Full List of SQL Modes">
Full List of SQL Modes
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="sql-mode.html#sql-mode-combo" title="Combination SQL Modes">
Combination SQL Modes
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="sql-mode.html#sql-mode-strict" title="Strict SQL Mode">
Strict SQL Mode
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="sql-mode.html#ignore-strict-comparison" title="Comparison of the IGNORE Keyword and Strict SQL Mode">
Comparison of the IGNORE Keyword and Strict SQL Mode
</a>
</p>
</li>
</ul>
</div>
<p>
For answers to questions often asked about server SQL modes in
MySQL, see
<a class="xref" href="faqs-sql-modes.html" title="A.3 MySQL 8.4 FAQ: Server SQL Mode">
Section A.3, “MySQL 8.4 FAQ: Server SQL Mode”
</a>
.
</p>
<p>
When working with
<code class="literal">
InnoDB
</code>
tables, consider also
the
<a class="link" href="innodb-parameters.html#sysvar_innodb_strict_mode">
<code class="literal">
innodb_strict_mode
</code>
</a>
system
variable. It enables additional error checks for
<code class="literal">
InnoDB
</code>
tables.
</p>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="sql-mode-setting">
</a>
Setting the SQL Mode
</h4>
</div>
</div>
</div>
<p>
The default SQL mode in MySQL 8.4 includes these
modes:
<a class="link" href="sql-mode.html#sqlmode_only_full_group_by">
<code class="literal">
ONLY_FULL_GROUP_BY
</code>
</a>
,
<a class="link" href="sql-mode.html#sqlmode_strict_trans_tables">
<code class="literal">
STRICT_TRANS_TABLES
</code>
</a>
,
<a class="link" href="sql-mode.html#sqlmode_no_zero_in_date">
<code class="literal">
NO_ZERO_IN_DATE
</code>
</a>
,
<a class="link" href="sql-mode.html#sqlmode_no_zero_date">
<code class="literal">
NO_ZERO_DATE
</code>
</a>
,
<a class="link" href="sql-mode.html#sqlmode_error_for_division_by_zero">
<code class="literal">
ERROR_FOR_DIVISION_BY_ZERO
</code>
</a>
,
and
<a class="link" href="sql-mode.html#sqlmode_no_engine_substitution">
<code class="literal">
NO_ENGINE_SUBSTITUTION
</code>
</a>
.
</p>
<p>
To set the SQL mode at server startup, use the
<a class="link" href="server-options.html#option_mysqld_sql-mode">
<code class="option">
--sql-mode="
<em class="replaceable">
<code>
modes
</code>
</em>
"
</code>
</a>
option on the command line, or
<a class="link" href="server-options.html#option_mysqld_sql-mode">
<code class="option">
sql-mode="
<em class="replaceable">
<code>
modes
</code>
</em>
"
</code>
</a>
in an option file such as
<code class="filename">
my.cnf
</code>
(Unix
operating systems) or
<code class="filename">
my.ini
</code>
(Windows).
<em class="replaceable">
<code>
modes
</code>
</em>
is a list of different modes
separated by commas. To clear the SQL mode explicitly, set it to
an empty string using
<a class="link" href="server-options.html#option_mysqld_sql-mode">
<code class="option">
--sql-mode=""
</code>
</a>
on the command
line, or
<a class="link" href="server-options.html#option_mysqld_sql-mode">
<code class="option">
sql-mode=""
</code>
</a>
in an option
file.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
MySQL installation programs may configure the SQL mode during
the installation process.
</p>
<p>
If the SQL mode differs from the default or from what you
expect, check for a setting in an option file that the server
reads at startup.
</p>
</div>
<p>
To change the SQL mode at runtime, set the global or session
<a class="link" href="server-system-variables.html#sysvar_sql_mode">
<code class="literal">
sql_mode
</code>
</a>
system variable using
a
<a class="link" href="set-variable.html" title="15.7.6.1 SET Syntax for Variable Assignment">
<code class="literal">
SET
</code>
</a>
statement:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa20616293"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SET</span> <span class="token keyword">GLOBAL</span> sql_mode <span class="token operator">=</span> <span class="token string">'<em class="replaceable">modes</em>'</span><span class="token punctuation">;</span>
<span class="token keyword">SET</span> <span class="token keyword">SESSION</span> sql_mode <span class="token operator">=</span> <span class="token string">'<em class="replaceable">modes</em>'</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Setting the
<code class="literal">
GLOBAL
</code>
variable requires the
<a class="link" href="privileges-provided.html#priv_system-variables-admin">
<code class="literal">
SYSTEM_VARIABLES_ADMIN
</code>
</a>
privilege
(or the deprecated
<a class="link" href="privileges-provided.html#priv_super">
<code class="literal">
SUPER
</code>
</a>
privilege) and affects the operation of all clients that connect
from that time on. Setting the
<code class="literal">
SESSION
</code>
variable affects only the current client. Each client can change
its session
<a class="link" href="server-system-variables.html#sysvar_sql_mode">
<code class="literal">
sql_mode
</code>
</a>
value at
any time.
</p>
<p>
To determine the current global or session
<a class="link" href="server-system-variables.html#sysvar_sql_mode">
<code class="literal">
sql_mode
</code>
</a>
setting, select its
value:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa48404178"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SELECT</span> <span class="token variable">@@GLOBAL.sql_mode</span><span class="token punctuation">;</span>
<span class="token keyword">SELECT</span> <span class="token variable">@@SESSION.sql_mode</span><span class="token punctuation">;</span></code></pre>
</div>
<div class="important" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Important
</div>
<p>
<b>
SQL mode and user-defined partitioning.
</b>
Changing the server SQL mode after creating and inserting
data into partitioned tables can cause major changes in the
behavior of such tables, and could lead to loss or
corruption of data. It is strongly recommended that you
never change the SQL mode once you have created tables
employing user-defined partitioning.
</p>
<p>
When replicating partitioned tables, differing SQL modes on
the source and replica can also lead to problems. For best
results, you should always use the same server SQL mode on the
source and replica.
</p>
<p>
For more information, see
<a class="xref" href="partitioning-limitations.html" title="26.6 Restrictions and Limitations on Partitioning">
Section 26.6, “Restrictions and Limitations on Partitioning”
</a>
.
</p>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="sql-mode-important">
</a>
The Most Important SQL Modes
</h4>
</div>
</div>
</div>
<p>
The most important
<a class="link" href="server-system-variables.html#sysvar_sql_mode">
<code class="literal">
sql_mode
</code>
</a>
values are probably these:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="indexterm" name="idm46045261625408">
</a>
<a class="indexterm" name="idm46045261624336">
</a>
<a class="link" href="sql-mode.html#sqlmode_ansi">
<code class="literal">
ANSI
</code>
</a>
</p>
<p>
This mode changes syntax and behavior to conform more
closely to standard SQL. It is one of the special
<a class="link" href="sql-mode.html#sql-mode-combo" title="Combination SQL Modes">
combination modes
</a>
listed at the end of this section.
</p>
</li>
<li class="listitem">
<p>
<a class="indexterm" name="idm46045261619280">
</a>
<a class="indexterm" name="idm46045261618192">
</a>
<a class="link" href="sql-mode.html#sqlmode_strict_trans_tables">
<code class="literal">
STRICT_TRANS_TABLES
</code>
</a>
</p>
<p>
If a value could not be inserted as given into a
transactional table, abort the statement. For a
nontransactional table, abort the statement if the value
occurs in a single-row statement or the first row of a
multiple-row statement. More details are given later in this
section.
</p>
</li>
<li class="listitem">
<p>
<a class="indexterm" name="idm46045261613888">
</a>
<a class="indexterm" name="idm46045261612816">
</a>
<a class="link" href="sql-mode.html#sqlmode_traditional">
<code class="literal">
TRADITIONAL
</code>
</a>
</p>
<p>
Make MySQL behave like a
<span class="quote">
“
<span class="quote">
traditional
</span>
”
</span>
SQL
database system. A simple description of this mode is
<span class="quote">
“
<span class="quote">
give an error instead of a warning
</span>
”
</span>
when
inserting an incorrect value into a column. It is one of the
special
<a class="link" href="sql-mode.html#sql-mode-combo" title="Combination SQL Modes">
combination
modes
</a>
listed at the end of this section.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
With
<a class="link" href="sql-mode.html#sqlmode_traditional">
<code class="literal">
TRADITIONAL
</code>
</a>
mode
enabled, an
<a class="link" href="insert.html" title="15.2.7 INSERT Statement">
<code class="literal">
INSERT
</code>
</a>
or
<a class="link" href="update.html" title="15.2.17 UPDATE Statement">
<code class="literal">
UPDATE
</code>
</a>
aborts as soon as an
error occurs. If you are using a nontransactional storage
engine, this may not be what you want because data changes
made prior to the error may not be rolled back, resulting
in a
<span class="quote">
“
<span class="quote">
partially done
</span>
”
</span>
update.
</p>
</div>
</li>
</ul>
</div>
<a class="indexterm" name="idm46045261602224">
</a>
<a class="indexterm" name="idm46045261601152">
</a>
<p>
When this manual refers to
<span class="quote">
“
<span class="quote">
strict mode,
</span>
”
</span>
it means
a mode with either or both
<a class="link" href="sql-mode.html#sqlmode_strict_trans_tables">
<code class="literal">
STRICT_TRANS_TABLES
</code>
</a>
or
<a class="link" href="sql-mode.html#sqlmode_strict_all_tables">
<code class="literal">
STRICT_ALL_TABLES
</code>
</a>
enabled.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="sql-mode-full">
</a>
Full List of SQL Modes
</h4>
</div>
</div>
</div>
<p>
The following list describes all supported SQL modes:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a name="sqlmode_allow_invalid_dates">
</a>
<a class="link" href="sql-mode.html#sqlmode_allow_invalid_dates">
<code class="literal">
ALLOW_INVALID_DATES
</code>
</a>
</p>
<a class="indexterm" name="idm46045261591648">
</a>
<a class="indexterm" name="idm46045261590608">
</a>
<p>
Do not perform full checking of dates. Check only that the
month is in the range from 1 to 12 and the day is in the
range from 1 to 31. This may be useful for Web applications
that obtain year, month, and day in three different fields
and store exactly what the user inserted, without date
validation. This mode applies to
<a class="link" href="datetime.html" title="13.2.2 The DATE, DATETIME, and TIMESTAMP Types">
<code class="literal">
DATE
</code>
</a>
and
<a class="link" href="datetime.html" title="13.2.2 The DATE, DATETIME, and TIMESTAMP Types">
<code class="literal">
DATETIME
</code>
</a>
columns. It does not
apply to
<a class="link" href="datetime.html" title="13.2.2 The DATE, DATETIME, and TIMESTAMP Types">
<code class="literal">
TIMESTAMP
</code>
</a>
columns,
which always require a valid date.
</p>
<p>
With
<a class="link" href="sql-mode.html#sqlmode_allow_invalid_dates">
<code class="literal">
ALLOW_INVALID_DATES
</code>
</a>
disabled, the server requires that month and day values be
legal, and not merely in the range 1 to 12 and 1 to 31,
respectively. With strict mode disabled, invalid dates such
as
<code class="literal">
'2004-04-31'
</code>
are converted to
<code class="literal">
'0000-00-00'
</code>
and a warning is generated.
With strict mode enabled, invalid dates generate an error.
To permit such dates, enable
<a class="link" href="sql-mode.html#sqlmode_allow_invalid_dates">
<code class="literal">
ALLOW_INVALID_DATES
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="sqlmode_ansi_quotes">
</a>
<a class="link" href="sql-mode.html#sqlmode_ansi_quotes">
<code class="literal">
ANSI_QUOTES
</code>
</a>
</p>
<a class="indexterm" name="idm46045261577376">
</a>
<a class="indexterm" name="idm46045261576304">
</a>
<p>
Treat
<code class="literal">
"
</code>
as an identifier quote character
(like the
<code class="literal">
`
</code>
quote character) and not as a
string quote character. You can still use
<code class="literal">
`
</code>
to quote identifiers with this mode
enabled. With
<a class="link" href="sql-mode.html#sqlmode_ansi_quotes">
<code class="literal">
ANSI_QUOTES
</code>
</a>
enabled, you cannot use double quotation marks to quote
literal strings because they are interpreted as identifiers.
</p>
</li>
<li class="listitem">
<p>
<a name="sqlmode_error_for_division_by_zero">
</a>
<a class="link" href="sql-mode.html#sqlmode_error_for_division_by_zero">
<code class="literal">
ERROR_FOR_DIVISION_BY_ZERO
</code>
</a>
</p>
<a class="indexterm" name="idm46045261568368">
</a>
<a class="indexterm" name="idm46045261567280">
</a>
<p>
The
<a class="link" href="sql-mode.html#sqlmode_error_for_division_by_zero">
<code class="literal">
ERROR_FOR_DIVISION_BY_ZERO
</code>
</a>
mode affects handling of division by zero, which includes
<a class="link" href="mathematical-functions.html#function_mod">
<code class="literal">
MOD(
<em class="replaceable">
<code>
N
</code>
</em>
,0)
</code>
</a>
.
For data-change operations
(
<a class="link" href="insert.html" title="15.2.7 INSERT Statement">
<code class="literal">
INSERT
</code>
</a>
,
<a class="link" href="update.html" title="15.2.17 UPDATE Statement">
<code class="literal">
UPDATE
</code>
</a>
), its effect also
depends on whether strict SQL mode is enabled.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
If this mode is not enabled, division by zero inserts
<code class="literal">
NULL
</code>
and produces no warning.
</p>
</li>
<li class="listitem">
<p>
If this mode is enabled, division by zero inserts
<code class="literal">
NULL
</code>
and produces a warning.
</p>
</li>
<li class="listitem">
<p>
If this mode and strict mode are enabled, division by
zero produces an error, unless
<code class="literal">
IGNORE
</code>
is given as well. For
<code class="literal">
INSERT IGNORE
</code>
and
<code class="literal">
UPDATE IGNORE
</code>
, division by zero
inserts
<code class="literal">
NULL
</code>
and produces a warning.
</p>
</li>
</ul>
</div>
<p>
For
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
, division by zero
returns
<code class="literal">
NULL
</code>
. Enabling
<a class="link" href="sql-mode.html#sqlmode_error_for_division_by_zero">
<code class="literal">
ERROR_FOR_DIVISION_BY_ZERO
</code>
</a>
causes a warning to be produced as well, regardless of
whether strict mode is enabled.
</p>
<p>
<a class="link" href="sql-mode.html#sqlmode_error_for_division_by_zero">
<code class="literal">
ERROR_FOR_DIVISION_BY_ZERO
</code>
</a>
is deprecated.
<a class="link" href="sql-mode.html#sqlmode_error_for_division_by_zero">
<code class="literal">
ERROR_FOR_DIVISION_BY_ZERO
</code>
</a>
is not part of strict mode, but should be used in
conjunction with strict mode and is enabled by default. A
warning occurs if
<a class="link" href="sql-mode.html#sqlmode_error_for_division_by_zero">
<code class="literal">
ERROR_FOR_DIVISION_BY_ZERO
</code>
</a>
is enabled without also enabling strict mode or vice versa.
</p>
<p>
Because
<a class="link" href="sql-mode.html#sqlmode_error_for_division_by_zero">
<code class="literal">
ERROR_FOR_DIVISION_BY_ZERO
</code>
</a>
is deprecated, you should expect it to be removed in a
future MySQL release as a separate mode name and its effect
included in the effects of strict SQL mode.
</p>
</li>
<li class="listitem">
<p>
<a name="sqlmode_high_not_precedence">
</a>
<a class="link" href="sql-mode.html#sqlmode_high_not_precedence">
<code class="literal">
HIGH_NOT_PRECEDENCE
</code>
</a>
</p>
<a class="indexterm" name="idm46045261539536">
</a>
<a class="indexterm" name="idm46045261538496">
</a>
<p>
The precedence of the
<a class="link" href="logical-operators.html#operator_not">
<code class="literal">
NOT
</code>
</a>
operator is such that expressions such as
<code class="literal">
NOT a
BETWEEN b AND c
</code>
are parsed as
<code class="literal">
NOT (a
BETWEEN b AND c)
</code>
. In some older versions of MySQL,
the expression was parsed as
<code class="literal">
(NOT a) BETWEEN b AND
c
</code>
. The old higher-precedence behavior can be
obtained by enabling the
<a class="link" href="sql-mode.html#sqlmode_high_not_precedence">
<code class="literal">
HIGH_NOT_PRECEDENCE
</code>
</a>
SQL
mode.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa63282799"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SET</span> sql_mode <span class="token operator">=</span> <span class="token string">''</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token operator">NOT</span> <span class="token number">1</span> <span class="token operator">BETWEEN</span> <span class="token operator">-</span><span class="token number">5</span> <span class="token operator">AND</span> <span class="token number">5</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token number">0</span>
<span class="token prompt">mysql></span> <span class="token keyword">SET</span> sql_mode <span class="token operator">=</span> <span class="token string">'HIGH_NOT_PRECEDENCE'</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token operator">NOT</span> <span class="token number">1</span> <span class="token operator">BETWEEN</span> <span class="token operator">-</span><span class="token number">5</span> <span class="token operator">AND</span> <span class="token number">5</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token number">1</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
<a name="sqlmode_ignore_space">
</a>
<a class="link" href="sql-mode.html#sqlmode_ignore_space">
<code class="literal">
IGNORE_SPACE
</code>
</a>
</p>
<a class="indexterm" name="idm46045261525296">
</a>
<a class="indexterm" name="idm46045261524224">
</a>
<p>
Permit spaces between a function name and the
<code class="literal">
(
</code>
character. This causes built-in
function names to be treated as reserved words. As a result,
identifiers that are the same as function names must be
quoted as described in
<a class="xref" href="identifiers.html" title="11.2 Schema Object Names">
Section 11.2, “Schema Object Names”
</a>
. For
example, because there is a
<a class="link" href="aggregate-functions.html#function_count">
<code class="literal">
COUNT()
</code>
</a>
function, the use of
<code class="literal">
count
</code>
as a table name in the following
statement causes an error:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa14017833"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> <span class="token function">count</span> <span class="token punctuation">(</span>i <span class="token datatype">INT</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output">ERROR 1064 (42000)<span class="token punctuation">:</span> You have an error in your SQL syntax</span></code></pre>
</div>
<p>
The table name should be quoted:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa23783479"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> <span class="token punctuation">`</span>count<span class="token punctuation">`</span> <span class="token punctuation">(</span>i <span class="token datatype">INT</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 0 rows affected (0.00 sec)</span></code></pre>
</div>
<p>
The
<a class="link" href="sql-mode.html#sqlmode_ignore_space">
<code class="literal">
IGNORE_SPACE
</code>
</a>
SQL mode
applies to built-in functions, not to loadable functions or
stored functions. It is always permissible to have spaces
after a loadable function or stored function name,
regardless of whether
<a class="link" href="sql-mode.html#sqlmode_ignore_space">
<code class="literal">
IGNORE_SPACE
</code>
</a>
is enabled.
</p>
<p>
For further discussion of
<a class="link" href="sql-mode.html#sqlmode_ignore_space">
<code class="literal">
IGNORE_SPACE
</code>
</a>
, see
<a class="xref" href="function-resolution.html" title="11.2.5 Function Name Parsing and Resolution">
Section 11.2.5, “Function Name Parsing and Resolution”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="sqlmode_no_auto_value_on_zero">
</a>
<a class="link" href="sql-mode.html#sqlmode_no_auto_value_on_zero">
<code class="literal">
NO_AUTO_VALUE_ON_ZERO
</code>
</a>
</p>
<a class="indexterm" name="idm46045261506800">
</a>
<a class="indexterm" name="idm46045261505760">
</a>
<p>
<a class="link" href="sql-mode.html#sqlmode_no_auto_value_on_zero">
<code class="literal">
NO_AUTO_VALUE_ON_ZERO
</code>
</a>
affects handling of
<code class="literal">
AUTO_INCREMENT
</code>
columns. Normally, you generate the next sequence number for
the column by inserting either
<code class="literal">
NULL
</code>
or
<code class="literal">
0
</code>
into it.
<a class="link" href="sql-mode.html#sqlmode_no_auto_value_on_zero">
<code class="literal">
NO_AUTO_VALUE_ON_ZERO
</code>
</a>
suppresses this behavior for
<code class="literal">
0
</code>
so that
only
<code class="literal">
NULL
</code>
generates the next sequence
number.
</p>
<p>
This mode can be useful if
<code class="literal">
0
</code>
has been
stored in a table's
<code class="literal">
AUTO_INCREMENT
</code>
column. (Storing
<code class="literal">
0
</code>
is not a recommended
practice, by the way.) For example, if you dump the table
with
<a class="link" href="mysqldump.html" title="6.5.4 mysqldump — A Database Backup Program">
<span class="command">
<strong>
mysqldump
</strong>
</span>
</a>
and then reload it, MySQL
normally generates new sequence numbers when it encounters
the
<code class="literal">
0
</code>
values, resulting in a table with
contents different from the one that was dumped. Enabling
<a class="link" href="sql-mode.html#sqlmode_no_auto_value_on_zero">
<code class="literal">
NO_AUTO_VALUE_ON_ZERO
</code>
</a>
before reloading the dump file solves this problem. For this
reason,
<a class="link" href="mysqldump.html" title="6.5.4 mysqldump — A Database Backup Program">
<span class="command">
<strong>
mysqldump
</strong>
</span>
</a>
automatically includes
in its output a statement that enables
<a class="link" href="sql-mode.html#sqlmode_no_auto_value_on_zero">
<code class="literal">
NO_AUTO_VALUE_ON_ZERO
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="sqlmode_no_backslash_escapes">
</a>
<a class="link" href="sql-mode.html#sqlmode_no_backslash_escapes">
<code class="literal">
NO_BACKSLASH_ESCAPES
</code>
</a>
</p>
<a class="indexterm" name="idm46045261486224">
</a>
<a class="indexterm" name="idm46045261485184">
</a>
<p>
Enabling this mode disables the use of the backslash
character (
<code class="literal">
\
</code>
) as an escape character
within strings and identifiers. With this mode enabled,
backslash becomes an ordinary character like any other, and
the default escape sequence for
<a class="link" href="string-comparison-functions.html#operator_like">
<code class="literal">
LIKE
</code>
</a>
expressions is changed so
that no escape character is used.
</p>
</li>
<li class="listitem">
<p>
<a name="sqlmode_no_dir_in_create">
</a>
<a class="link" href="sql-mode.html#sqlmode_no_dir_in_create">
<code class="literal">
NO_DIR_IN_CREATE
</code>
</a>
</p>
<a class="indexterm" name="idm46045261478320">
</a>
<a class="indexterm" name="idm46045261477280">
</a>
<p>
When creating a table, ignore all
<code class="literal">
INDEX
DIRECTORY
</code>
and
<code class="literal">
DATA DIRECTORY
</code>
directives. This option is useful on replica servers.
</p>
</li>
<li class="listitem">
<p>
<a name="sqlmode_no_engine_substitution">
</a>
<a class="link" href="sql-mode.html#sqlmode_no_engine_substitution">
<code class="literal">
NO_ENGINE_SUBSTITUTION
</code>
</a>
</p>
<a class="indexterm" name="idm46045261471312">
</a>
<a class="indexterm" name="idm46045261470272">
</a>
<p>
Control automatic substitution of the default storage engine
when a statement such as
<a class="link" href="create-table.html" title="15.1.20 CREATE TABLE Statement">
<code class="literal">
CREATE
TABLE
</code>
</a>
or
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER
TABLE
</code>
</a>
specifies a storage engine that is disabled
or not compiled in.
</p>
<p>
By default,
<a class="link" href="sql-mode.html#sqlmode_no_engine_substitution">
<code class="literal">
NO_ENGINE_SUBSTITUTION
</code>
</a>
is
enabled.
</p>
<p>
Because storage engines can be pluggable at runtime,
unavailable engines are treated the same way:
</p>
<p>
With
<a class="link" href="sql-mode.html#sqlmode_no_engine_substitution">
<code class="literal">
NO_ENGINE_SUBSTITUTION
</code>
</a>
disabled, for
<a class="link" href="create-table.html" title="15.1.20 CREATE TABLE Statement">
<code class="literal">
CREATE TABLE
</code>
</a>
the default engine is used and a warning occurs if the
desired engine is unavailable. For
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER TABLE
</code>
</a>
, a warning occurs
and the table is not altered.
</p>
<p>
With
<a class="link" href="sql-mode.html#sqlmode_no_engine_substitution">
<code class="literal">
NO_ENGINE_SUBSTITUTION
</code>
</a>
enabled, an error occurs and the table is not created or
altered if the desired engine is unavailable.
</p>
</li>
<li class="listitem">
<p>
<a name="sqlmode_no_unsigned_subtraction">
</a>
<a class="link" href="sql-mode.html#sqlmode_no_unsigned_subtraction">
<code class="literal">
NO_UNSIGNED_SUBTRACTION
</code>
</a>
</p>
<a class="indexterm" name="idm46045261454640">
</a>
<a class="indexterm" name="idm46045261453600">
</a>
<p>
Subtraction between integer values, where one is of type
<code class="literal">
UNSIGNED
</code>
, produces an unsigned result by
default. If the result would otherwise have been negative,
an error results:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa49612646"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SET</span> sql_mode <span class="token operator">=</span> <span class="token string">''</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 0 rows affected (0.00 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">CAST</span><span class="token punctuation">(</span><span class="token number">0</span> <span class="token keyword">AS</span> <span class="token keyword">UNSIGNED</span><span class="token punctuation">)</span> <span class="token operator">-</span> <span class="token number">1</span><span class="token punctuation">;</span>
<span class="token output">ERROR 1690 (22003)<span class="token punctuation">:</span> BIGINT UNSIGNED value is out of range in '(cast(0 as unsigned) - 1)'</span></code></pre>
</div>
<p>
If the
<a class="link" href="sql-mode.html#sqlmode_no_unsigned_subtraction">
<code class="literal">
NO_UNSIGNED_SUBTRACTION
</code>
</a>
SQL mode is enabled, the result is negative:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa62624752"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SET</span> sql_mode <span class="token operator">=</span> <span class="token string">'NO_UNSIGNED_SUBTRACTION'</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">CAST</span><span class="token punctuation">(</span><span class="token number">0</span> <span class="token keyword">AS</span> <span class="token keyword">UNSIGNED</span><span class="token punctuation">)</span> <span class="token operator">-</span> <span class="token number">1</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> CAST(0 AS UNSIGNED) <span class="token punctuation">-</span> 1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> <span class="token punctuation">-</span>1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
<p>
If the result of such an operation is used to update an
<code class="literal">
UNSIGNED
</code>
integer column, the result is
clipped to the maximum value for the column type, or clipped
to 0 if
<a class="link" href="sql-mode.html#sqlmode_no_unsigned_subtraction">
<code class="literal">
NO_UNSIGNED_SUBTRACTION
</code>
</a>
is
enabled. With strict SQL mode enabled, an error occurs and
the column remains unchanged.
</p>
<p>
When
<a class="link" href="sql-mode.html#sqlmode_no_unsigned_subtraction">
<code class="literal">
NO_UNSIGNED_SUBTRACTION
</code>
</a>
is
enabled, the subtraction result is signed,
<span class="emphasis">
<em>
even if
any operand is unsigned
</em>
</span>
. For example, compare the
type of column
<code class="literal">
c2
</code>
in table
<code class="literal">
t1
</code>
with that of column
<code class="literal">
c2
</code>
in table
<code class="literal">
t2
</code>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa49764665"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SET</span> sql_mode<span class="token operator">=</span><span class="token string">''</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> test <span class="token punctuation">(</span>c1 <span class="token datatype">BIGINT</span> <span class="token keyword">UNSIGNED</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> t1 <span class="token keyword">SELECT</span> c1 <span class="token operator">-</span> <span class="token number">1</span> <span class="token keyword">AS</span> c2 <span class="token keyword">FROM</span> test<span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">DESCRIBE</span> t1<span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> Field <span class="token punctuation">|</span> Type <span class="token punctuation">|</span> Null <span class="token punctuation">|</span> Key <span class="token punctuation">|</span> Default <span class="token punctuation">|</span> Extra <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> c2 <span class="token punctuation">|</span> bigint(21) unsigned <span class="token punctuation">|</span> NO <span class="token punctuation">|</span> <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span> <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token prompt">mysql></span> <span class="token keyword">SET</span> sql_mode<span class="token operator">=</span><span class="token string">'NO_UNSIGNED_SUBTRACTION'</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> t2 <span class="token keyword">SELECT</span> c1 <span class="token operator">-</span> <span class="token number">1</span> <span class="token keyword">AS</span> c2 <span class="token keyword">FROM</span> test<span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">DESCRIBE</span> t2<span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> Field <span class="token punctuation">|</span> Type <span class="token punctuation">|</span> Null <span class="token punctuation">|</span> Key <span class="token punctuation">|</span> Default <span class="token punctuation">|</span> Extra <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> c2 <span class="token punctuation">|</span> bigint(21) <span class="token punctuation">|</span> NO <span class="token punctuation">|</span> <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span> <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
<p>
This means that
<code class="literal">
BIGINT UNSIGNED
</code>
is not
100% usable in all contexts. See
<a class="xref" href="cast-functions.html" title="14.10 Cast Functions and Operators">
Section 14.10, “Cast Functions and Operators”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="sqlmode_no_zero_date">
</a>
<a class="link" href="sql-mode.html#sqlmode_no_zero_date">
<code class="literal">
NO_ZERO_DATE
</code>
</a>
</p>
<a class="indexterm" name="idm46045261424576">
</a>
<a class="indexterm" name="idm46045261423504">
</a>
<p>
The
<a class="link" href="sql-mode.html#sqlmode_no_zero_date">
<code class="literal">
NO_ZERO_DATE
</code>
</a>
mode
affects whether the server permits
<code class="literal">
'0000-00-00'
</code>
as a valid date. Its effect
also depends on whether strict SQL mode is enabled.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
If this mode is not enabled,
<code class="literal">
'0000-00-00'
</code>
is permitted and inserts
produce no warning.
</p>
</li>
<li class="listitem">
<p>
If this mode is enabled,
<code class="literal">
'0000-00-00'
</code>
is permitted and inserts produce a warning.
</p>
</li>
<li class="listitem">
<p>
If this mode and strict mode are enabled,
<code class="literal">
'0000-00-00'
</code>
is not permitted and
inserts produce an error, unless
<code class="literal">
IGNORE
</code>
is given as well. For
<code class="literal">
INSERT IGNORE
</code>
and
<code class="literal">
UPDATE
IGNORE
</code>
,
<code class="literal">
'0000-00-00'
</code>
is
permitted and inserts produce a warning.
</p>
</li>
</ul>
</div>
<p>
<a class="link" href="sql-mode.html#sqlmode_no_zero_date">
<code class="literal">
NO_ZERO_DATE
</code>
</a>
is
deprecated.
<a class="link" href="sql-mode.html#sqlmode_no_zero_date">
<code class="literal">
NO_ZERO_DATE
</code>
</a>
is not part of strict mode, but should be used in
conjunction with strict mode and is enabled by default. A
warning occurs if
<a class="link" href="sql-mode.html#sqlmode_no_zero_date">
<code class="literal">
NO_ZERO_DATE
</code>
</a>
is enabled
without also enabling strict mode or vice versa.
</p>
<p>
Because
<a class="link" href="sql-mode.html#sqlmode_no_zero_date">
<code class="literal">
NO_ZERO_DATE
</code>
</a>
is
deprecated, you should expect it to be removed in a future
MySQL release as a separate mode name and its effect
included in the effects of strict SQL mode.
</p>
</li>
<li class="listitem">
<p>
<a name="sqlmode_no_zero_in_date">
</a>
<a class="link" href="sql-mode.html#sqlmode_no_zero_in_date">
<code class="literal">
NO_ZERO_IN_DATE
</code>
</a>
</p>
<a class="indexterm" name="idm46045261402736">
</a>
<a class="indexterm" name="idm46045261401648">
</a>
<p>
The
<a class="link" href="sql-mode.html#sqlmode_no_zero_in_date">
<code class="literal">
NO_ZERO_IN_DATE
</code>
</a>
mode
affects whether the server permits dates in which the year
part is nonzero but the month or day part is 0. (This mode
affects dates such as
<code class="literal">
'2010-00-01'
</code>
or
<code class="literal">
'2010-01-00'
</code>
, but not
<code class="literal">
'0000-00-00'
</code>
. To control whether the
server permits
<code class="literal">
'0000-00-00'
</code>
, use the
<a class="link" href="sql-mode.html#sqlmode_no_zero_date">
<code class="literal">
NO_ZERO_DATE
</code>
</a>
mode.) The
effect of
<a class="link" href="sql-mode.html#sqlmode_no_zero_in_date">
<code class="literal">
NO_ZERO_IN_DATE
</code>
</a>
also depends on whether strict SQL mode is enabled.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
If this mode is not enabled, dates with zero parts are
permitted and inserts produce no warning.
</p>
</li>
<li class="listitem">
<p>
If this mode is enabled, dates with zero parts are
inserted as
<code class="literal">
'0000-00-00'
</code>
and produce
a warning.
</p>
</li>
<li class="listitem">
<p>
If this mode and strict mode are enabled, dates with
zero parts are not permitted and inserts produce an
error, unless
<code class="literal">
IGNORE
</code>
is given as
well. For
<code class="literal">
INSERT IGNORE
</code>
and
<code class="literal">
UPDATE IGNORE
</code>
, dates with zero parts
are inserted as
<code class="literal">
'0000-00-00'
</code>
and
produce a warning.
</p>
</li>
</ul>
</div>
<p>
<a class="link" href="sql-mode.html#sqlmode_no_zero_in_date">
<code class="literal">
NO_ZERO_IN_DATE
</code>
</a>
is
deprecated.
<a class="link" href="sql-mode.html#sqlmode_no_zero_in_date">
<code class="literal">
NO_ZERO_IN_DATE
</code>
</a>
is not
part of strict mode, but should be used in conjunction with
strict mode and is enabled by default. A warning occurs if
<a class="link" href="sql-mode.html#sqlmode_no_zero_in_date">
<code class="literal">
NO_ZERO_IN_DATE
</code>
</a>
is enabled
without also enabling strict mode or vice versa.
</p>
<p>
Because
<a class="link" href="sql-mode.html#sqlmode_no_zero_in_date">
<code class="literal">
NO_ZERO_IN_DATE
</code>
</a>
is
deprecated, you should expect it to be removed in a future
MySQL release as a separate mode name and its effect
included in the effects of strict SQL mode.
</p>
</li>
<li class="listitem">
<p>
<a name="sqlmode_only_full_group_by">
</a>
<a class="link" href="sql-mode.html#sqlmode_only_full_group_by">
<code class="literal">
ONLY_FULL_GROUP_BY
</code>
</a>
</p>
<a class="indexterm" name="idm46045261377344">
</a>
<a class="indexterm" name="idm46045261376304">
</a>
<a class="indexterm" name="idm46045261374816">
</a>
<p>
Reject queries for which the select list,
<code class="literal">
HAVING
</code>
condition, or
<code class="literal">
ORDER
BY
</code>
list refer to nonaggregated columns that are
neither named in the
<code class="literal">
GROUP BY
</code>
clause nor
are functionally dependent on (uniquely determined by)
<code class="literal">
GROUP BY
</code>
columns.
</p>
<p>
A MySQL extension to standard SQL permits references in the
<code class="literal">
HAVING
</code>
clause to aliased expressions in
the select list. The
<code class="literal">
HAVING
</code>
clause can
refer to aliases regardless of whether
<a class="link" href="sql-mode.html#sqlmode_only_full_group_by">
<code class="literal">
ONLY_FULL_GROUP_BY
</code>
</a>
is
enabled.
</p>
<p>
For additional discussion and examples, see
<a class="xref" href="group-by-handling.html" title="14.19.3 MySQL Handling of GROUP BY">
Section 14.19.3, “MySQL Handling of GROUP BY”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="sqlmode_pad_char_to_full_length">
</a>
<a class="link" href="sql-mode.html#sqlmode_pad_char_to_full_length">
<code class="literal">
PAD_CHAR_TO_FULL_LENGTH
</code>
</a>
</p>
<a class="indexterm" name="idm46045261363184">
</a>
<a class="indexterm" name="idm46045261362144">
</a>
<p>
By default, trailing spaces are trimmed from
<a class="link" href="char.html" title="13.3.2 The CHAR and VARCHAR Types">
<code class="literal">
CHAR
</code>
</a>
column values on
retrieval. If
<a class="link" href="sql-mode.html#sqlmode_pad_char_to_full_length">
<code class="literal">
PAD_CHAR_TO_FULL_LENGTH
</code>
</a>
is
enabled, trimming does not occur and retrieved
<a class="link" href="char.html" title="13.3.2 The CHAR and VARCHAR Types">
<code class="literal">
CHAR
</code>
</a>
values are padded to
their full length. This mode does not apply to
<a class="link" href="char.html" title="13.3.2 The CHAR and VARCHAR Types">
<code class="literal">
VARCHAR
</code>
</a>
columns, for which
trailing spaces are retained on retrieval.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
<a class="link" href="sql-mode.html#sqlmode_pad_char_to_full_length">
<code class="literal">
PAD_CHAR_TO_FULL_LENGTH
</code>
</a>
is deprecated. Expect it to be removed in a future version
of MySQL.
</p>
</div>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa48440011"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> t1 <span class="token punctuation">(</span>c1 <span class="token datatype">CHAR</span><span class="token punctuation">(</span><span class="token number">10</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 0 rows affected (0.37 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">INSERT</span> <span class="token keyword">INTO</span> t1 <span class="token punctuation">(</span>c1<span class="token punctuation">)</span> <span class="token keyword">VALUES</span><span class="token punctuation">(</span><span class="token string">'xy'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 1 row affected (0.01 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">SET</span> sql_mode <span class="token operator">=</span> <span class="token string">''</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 0 rows affected (0.00 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> c1<span class="token punctuation">,</span> <span class="token function">CHAR_LENGTH</span><span class="token punctuation">(</span>c1<span class="token punctuation">)</span> <span class="token keyword">FROM</span> t1<span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> c1 <span class="token punctuation">|</span> CHAR_LENGTH(c1) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> xy <span class="token punctuation">|</span> 2 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output">1 row in set (0.00 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">SET</span> sql_mode <span class="token operator">=</span> <span class="token string">'PAD_CHAR_TO_FULL_LENGTH'</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 0 rows affected (0.00 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> c1<span class="token punctuation">,</span> <span class="token function">CHAR_LENGTH</span><span class="token punctuation">(</span>c1<span class="token punctuation">)</span> <span class="token keyword">FROM</span> t1<span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> c1 <span class="token punctuation">|</span> CHAR_LENGTH(c1) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> xy <span class="token punctuation">|</span> 10 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output">1 row in set (0.00 sec)</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
<a name="sqlmode_pipes_as_concat">
</a>
<a class="link" href="sql-mode.html#sqlmode_pipes_as_concat">
<code class="literal">
PIPES_AS_CONCAT
</code>
</a>
</p>
<a class="indexterm" name="idm46045261344176">
</a>
<a class="indexterm" name="idm46045261343088">
</a>
<p>
Treat
<a class="link" href="logical-operators.html#operator_or">
<code class="literal">
||
</code>
</a>
as a
string concatenation operator (same as
<a class="link" href="string-functions.html#function_concat">
<code class="literal">
CONCAT()
</code>
</a>
) rather than as a
synonym for
<a class="link" href="logical-operators.html#operator_or">
<code class="literal">
OR
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="sqlmode_real_as_float">
</a>
<a class="link" href="sql-mode.html#sqlmode_real_as_float">
<code class="literal">
REAL_AS_FLOAT
</code>
</a>
</p>
<a class="indexterm" name="idm46045261334960">
</a>
<a class="indexterm" name="idm46045261333888">
</a>
<p>
Treat
<a class="link" href="floating-point-types.html" title="13.1.4 Floating-Point Types (Approximate Value) - FLOAT, DOUBLE">
<code class="literal">
REAL
</code>
</a>
as a synonym for
<a class="link" href="floating-point-types.html" title="13.1.4 Floating-Point Types (Approximate Value) - FLOAT, DOUBLE">
<code class="literal">
FLOAT
</code>
</a>
. By default, MySQL
treats
<a class="link" href="floating-point-types.html" title="13.1.4 Floating-Point Types (Approximate Value) - FLOAT, DOUBLE">
<code class="literal">
REAL
</code>
</a>
as a synonym for
<a class="link" href="floating-point-types.html" title="13.1.4 Floating-Point Types (Approximate Value) - FLOAT, DOUBLE">
<code class="literal">
DOUBLE
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="sqlmode_strict_all_tables">
</a>
<a class="link" href="sql-mode.html#sqlmode_strict_all_tables">
<code class="literal">
STRICT_ALL_TABLES
</code>
</a>
</p>
<a class="indexterm" name="idm46045261324496">
</a>
<a class="indexterm" name="idm46045261323456">
</a>
<p>
Enable strict SQL mode for all storage engines. Invalid data
values are rejected. For details, see
<a class="xref" href="sql-mode.html#sql-mode-strict" title="Strict SQL Mode">
Strict SQL Mode
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="sqlmode_strict_trans_tables">
</a>
<a class="link" href="sql-mode.html#sqlmode_strict_trans_tables">
<code class="literal">
STRICT_TRANS_TABLES
</code>
</a>
</p>
<a class="indexterm" name="idm46045261318240">
</a>
<a class="indexterm" name="idm46045261317200">
</a>
<p>
Enable strict SQL mode for transactional storage engines,
and when possible for nontransactional storage engines. For
details, see
<a class="xref" href="sql-mode.html#sql-mode-strict" title="Strict SQL Mode">
Strict SQL Mode
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="sqlmode_time_truncate_fractional">
</a>
<a class="link" href="sql-mode.html#sqlmode_time_truncate_fractional">
<code class="literal">
TIME_TRUNCATE_FRACTIONAL
</code>
</a>
</p>
<a class="indexterm" name="idm46045261311920">
</a>
<a class="indexterm" name="idm46045261310832">
</a>
<p>
Control whether rounding or truncation occurs when inserting
a
<a class="link" href="time.html" title="13.2.3 The TIME Type">
<code class="literal">
TIME
</code>
</a>
,
<a class="link" href="datetime.html" title="13.2.2 The DATE, DATETIME, and TIMESTAMP Types">
<code class="literal">
DATE
</code>
</a>
, or
<a class="link" href="datetime.html" title="13.2.2 The DATE, DATETIME, and TIMESTAMP Types">
<code class="literal">
TIMESTAMP
</code>
</a>
value with a
fractional seconds part into a column having the same type
but fewer fractional digits. The default behavior is to use
rounding. If this mode is enabled, truncation occurs
instead. The following sequence of statements illustrates
the difference:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa14562979"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> t <span class="token punctuation">(</span>id <span class="token datatype">INT</span><span class="token punctuation">,</span> tval <span class="token function">TIME</span><span class="token punctuation">(</span><span class="token number">1</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">SET</span> sql_mode<span class="token operator">=</span><span class="token string">''</span><span class="token punctuation">;</span>
<span class="token keyword">INSERT</span> <span class="token keyword">INTO</span> t <span class="token punctuation">(</span>id<span class="token punctuation">,</span> tval<span class="token punctuation">)</span> <span class="token keyword">VALUES</span><span class="token punctuation">(</span><span class="token number">1</span><span class="token punctuation">,</span> <span class="token number">1.55</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">SET</span> sql_mode<span class="token operator">=</span><span class="token string">'TIME_TRUNCATE_FRACTIONAL'</span><span class="token punctuation">;</span>
<span class="token keyword">INSERT</span> <span class="token keyword">INTO</span> t <span class="token punctuation">(</span>id<span class="token punctuation">,</span> tval<span class="token punctuation">)</span> <span class="token keyword">VALUES</span><span class="token punctuation">(</span><span class="token number">2</span><span class="token punctuation">,</span> <span class="token number">1.55</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
The resulting table contents look like this, where the first
value has been subject to rounding and the second to
truncation:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa70526421"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> id<span class="token punctuation">,</span> tval <span class="token keyword">FROM</span> t <span class="token keyword">ORDER</span> <span class="token keyword">BY</span> id<span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> id <span class="token punctuation">|</span> tval <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> 00:00:01.6 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 2 <span class="token punctuation">|</span> 00:00:01.5 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
<p>
See also
<a class="xref" href="fractional-seconds.html" title="13.2.6 Fractional Seconds in Time Values">
Section 13.2.6, “Fractional Seconds in Time Values”
</a>
.
</p>
</li>
</ul>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="sql-mode-combo">
</a>
Combination SQL Modes
</h4>
</div>
</div>
</div>
<p>
The following special modes are provided as shorthand for
combinations of mode values from the preceding list.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a name="sqlmode_ansi">
</a>
<a class="link" href="sql-mode.html#sqlmode_ansi">
<code class="literal">
ANSI
</code>
</a>
</p>
<a class="indexterm" name="idm46045261295520">
</a>
<a class="indexterm" name="idm46045261294448">
</a>
<p>
Equivalent to
<a class="link" href="sql-mode.html#sqlmode_real_as_float">
<code class="literal">
REAL_AS_FLOAT
</code>
</a>
,
<a class="link" href="sql-mode.html#sqlmode_pipes_as_concat">
<code class="literal">
PIPES_AS_CONCAT
</code>
</a>
,
<a class="link" href="sql-mode.html#sqlmode_ansi_quotes">
<code class="literal">
ANSI_QUOTES
</code>
</a>
,
<a class="link" href="sql-mode.html#sqlmode_ignore_space">
<code class="literal">
IGNORE_SPACE
</code>
</a>
, and
<a class="link" href="sql-mode.html#sqlmode_only_full_group_by">
<code class="literal">
ONLY_FULL_GROUP_BY
</code>
</a>
.
</p>
<p>
<a class="link" href="sql-mode.html#sqlmode_ansi">
<code class="literal">
ANSI
</code>
</a>
mode also causes the
server to return an error for queries where a set function
<em class="replaceable">
<code>
S
</code>
</em>
with an outer reference
<code class="literal">
<em class="replaceable">
<code>
S
</code>
</em>
(
<em class="replaceable">
<code>
outer_ref
</code>
</em>
)
</code>
cannot be aggregated in the outer query against which the
outer reference has been resolved. This is such a query:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa4626556"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> t1 <span class="token keyword">WHERE</span> t1<span class="token punctuation">.</span>a <span class="token keyword">IN</span> <span class="token punctuation">(</span><span class="token keyword">SELECT</span> <span class="token function">MAX</span><span class="token punctuation">(</span>t1<span class="token punctuation">.</span>b<span class="token punctuation">)</span> <span class="token keyword">FROM</span> t2 <span class="token keyword">WHERE</span> <span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Here,
<a class="link" href="aggregate-functions.html#function_max">
<code class="literal">
MAX(t1.b)
</code>
</a>
cannot
aggregated in the outer query because it appears in the
<code class="literal">
WHERE
</code>
clause of that query. Standard SQL
requires an error in this situation. If
<a class="link" href="sql-mode.html#sqlmode_ansi">
<code class="literal">
ANSI
</code>
</a>
mode is not enabled,
the server treats
<code class="literal">
<em class="replaceable">
<code>
S
</code>
</em>
(
<em class="replaceable">
<code>
outer_ref
</code>
</em>
)
</code>
in such queries the same way that it would interpret
<code class="literal">
<em class="replaceable">
<code>
S
</code>
</em>
(
<em class="replaceable">
<code>
const
</code>
</em>
)
</code>
.
</p>
<p>
See
<a class="xref" href="compatibility.html" title="1.7 MySQL Standards Compliance">
Section 1.7, “MySQL Standards Compliance”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="sqlmode_traditional">
</a>
<a class="link" href="sql-mode.html#sqlmode_traditional">
<code class="literal">
TRADITIONAL
</code>
</a>
</p>
<a class="indexterm" name="idm46045261271664">
</a>
<a class="indexterm" name="idm46045261270592">
</a>
<p>
<a class="link" href="sql-mode.html#sqlmode_traditional">
<code class="literal">
TRADITIONAL
</code>
</a>
is equivalent
to
<a class="link" href="sql-mode.html#sqlmode_strict_trans_tables">
<code class="literal">
STRICT_TRANS_TABLES
</code>
</a>
,
<a class="link" href="sql-mode.html#sqlmode_strict_all_tables">
<code class="literal">
STRICT_ALL_TABLES
</code>
</a>
,
<a class="link" href="sql-mode.html#sqlmode_no_zero_in_date">
<code class="literal">
NO_ZERO_IN_DATE
</code>
</a>
,
<a class="link" href="sql-mode.html#sqlmode_no_zero_date">
<code class="literal">
NO_ZERO_DATE
</code>
</a>
,
<a class="link" href="sql-mode.html#sqlmode_error_for_division_by_zero">
<code class="literal">
ERROR_FOR_DIVISION_BY_ZERO
</code>
</a>
,
and
<a class="link" href="sql-mode.html#sqlmode_no_engine_substitution">
<code class="literal">
NO_ENGINE_SUBSTITUTION
</code>
</a>
.
</p>
</li>
</ul>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="sql-mode-strict">
</a>
Strict SQL Mode
</h4>
</div>
</div>
</div>
<p>
Strict mode controls how MySQL handles invalid or missing values
in data-change statements such as
<a class="link" href="insert.html" title="15.2.7 INSERT Statement">
<code class="literal">
INSERT
</code>
</a>
or
<a class="link" href="update.html" title="15.2.17 UPDATE Statement">
<code class="literal">
UPDATE
</code>
</a>
. A value can be invalid
for several reasons. For example, it might have the wrong data
type for the column, or it might be out of range. A value is
missing when a new row to be inserted does not contain a value
for a non-
<code class="literal">
NULL
</code>
column that has no explicit
<code class="literal">
DEFAULT
</code>
clause in its definition. (For a
<code class="literal">
NULL
</code>
column,
<code class="literal">
NULL
</code>
is
inserted if the value is missing.) Strict mode also affects DDL
statements such as
<a class="link" href="create-table.html" title="15.1.20 CREATE TABLE Statement">
<code class="literal">
CREATE TABLE
</code>
</a>
.
</p>
<p>
If strict mode is not in effect, MySQL inserts adjusted values
for invalid or missing values and produces warnings (see
<a class="xref" href="show-warnings.html" title="15.7.7.42 SHOW WARNINGS Statement">
Section 15.7.7.42, “SHOW WARNINGS Statement”
</a>
). In strict mode, you can
produce this behavior by using
<a class="link" href="insert.html" title="15.2.7 INSERT Statement">
<code class="literal">
INSERT IGNORE
</code>
</a>
or
<a class="link" href="update.html" title="15.2.17 UPDATE Statement">
<code class="literal">
UPDATE
IGNORE
</code>
</a>
.
</p>
<p>
For statements such as
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
that do not change data, invalid values generate a warning in
strict mode, not an error.
</p>
<p>
Strict mode produces an error for attempts to create a key that
exceeds the maximum key length. When strict mode is not enabled,
this results in a warning and truncation of the key to the
maximum key length.
</p>
<p>
Strict mode does not affect whether foreign key constraints are
checked.
<a class="link" href="server-system-variables.html#sysvar_foreign_key_checks">
<code class="literal">
foreign_key_checks
</code>
</a>
can
be used for that. (See
<a class="xref" href="server-system-variables.html" title="7.1.8 Server System Variables">
Section 7.1.8, “Server System Variables”
</a>
.)
</p>
<p>
Strict SQL mode is in effect if either
<a class="link" href="sql-mode.html#sqlmode_strict_all_tables">
<code class="literal">
STRICT_ALL_TABLES
</code>
</a>
or
<a class="link" href="sql-mode.html#sqlmode_strict_trans_tables">
<code class="literal">
STRICT_TRANS_TABLES
</code>
</a>
is
enabled, although the effects of these modes differ somewhat:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
For transactional tables, an error occurs for invalid or
missing values in a data-change statement when either
<a class="link" href="sql-mode.html#sqlmode_strict_all_tables">
<code class="literal">
STRICT_ALL_TABLES
</code>
</a>
or
<a class="link" href="sql-mode.html#sqlmode_strict_trans_tables">
<code class="literal">
STRICT_TRANS_TABLES
</code>
</a>
is
enabled. The statement is aborted and rolled back.
</p>
</li>
<li class="listitem">
<p>
For nontransactional tables, the behavior is the same for
either mode if the bad value occurs in the first row to be
inserted or updated: The statement is aborted and the table
remains unchanged. If the statement inserts or modifies
multiple rows and the bad value occurs in the second or
later row, the result depends on which strict mode is
enabled:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
For
<a class="link" href="sql-mode.html#sqlmode_strict_all_tables">
<code class="literal">
STRICT_ALL_TABLES
</code>
</a>
,
MySQL returns an error and ignores the rest of the rows.
However, because the earlier rows have been inserted or
updated, the result is a partial update. To avoid this,
use single-row statements, which can be aborted without
changing the table.
</p>
</li>
<li class="listitem">
<p>
For
<a class="link" href="sql-mode.html#sqlmode_strict_trans_tables">
<code class="literal">
STRICT_TRANS_TABLES
</code>
</a>
,
MySQL converts an invalid value to the closest valid
value for the column and inserts the adjusted value. If
a value is missing, MySQL inserts the implicit default
value for the column data type. In either case, MySQL
generates a warning rather than an error and continues
processing the statement. Implicit defaults are
described in
<a class="xref" href="data-type-defaults.html" title="13.6 Data Type Default Values">
Section 13.6, “Data Type Default Values”
</a>
.
</p>
</li>
</ul>
</div>
</li>
</ul>
</div>
<p>
Strict mode affects handling of division by zero, zero dates,
and zeros in dates as follows:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Strict mode affects handling of division by zero, which
includes
<a class="link" href="mathematical-functions.html#function_mod">
<code class="literal">
MOD(
<em class="replaceable">
<code>
N
</code>
</em>
,0)
</code>
</a>
:
</p>
<p>
For data-change operations
(
<a class="link" href="insert.html" title="15.2.7 INSERT Statement">
<code class="literal">
INSERT
</code>
</a>
,
<a class="link" href="update.html" title="15.2.17 UPDATE Statement">
<code class="literal">
UPDATE
</code>
</a>
):
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
If strict mode is not enabled, division by zero inserts
<code class="literal">
NULL
</code>
and produces no warning.
</p>
</li>
<li class="listitem">
<p>
If strict mode is enabled, division by zero produces an
error, unless
<code class="literal">
IGNORE
</code>
is given as
well. For
<code class="literal">
INSERT IGNORE
</code>
and
<code class="literal">
UPDATE IGNORE
</code>
, division by zero
inserts
<code class="literal">
NULL
</code>
and produces a warning.
</p>
</li>
</ul>
</div>
<p>
For
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
, division by zero
returns
<code class="literal">
NULL
</code>
. Enabling strict mode causes
a warning to be produced as well.
</p>
</li>
<li class="listitem">
<p>
Strict mode affects whether the server permits
<code class="literal">
'0000-00-00'
</code>
as a valid date:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
If strict mode is not enabled,
<code class="literal">
'0000-00-00'
</code>
is permitted and inserts
produce no warning.
</p>
</li>
<li class="listitem">
<p>
If strict mode is enabled,
<code class="literal">
'0000-00-00'
</code>
is not permitted and
inserts produce an error, unless
<code class="literal">
IGNORE
</code>
is given as well. For
<code class="literal">
INSERT IGNORE
</code>
and
<code class="literal">
UPDATE
IGNORE
</code>
,
<code class="literal">
'0000-00-00'
</code>
is
permitted and inserts produce a warning.
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
Strict mode affects whether the server permits dates in
which the year part is nonzero but the month or day part is
0 (dates such as
<code class="literal">
'2010-00-01'
</code>
or
<code class="literal">
'2010-01-00'
</code>
):
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
If strict mode is not enabled, dates with zero parts are
permitted and inserts produce no warning.
</p>
</li>
<li class="listitem">
<p>
If strict mode is enabled, dates with zero parts are not
permitted and inserts produce an error, unless
<code class="literal">
IGNORE
</code>
is given as well. For
<code class="literal">
INSERT IGNORE
</code>
and
<code class="literal">
UPDATE
IGNORE
</code>
, dates with zero parts are inserted as
<code class="literal">
'0000-00-00'
</code>
(which is considered
valid with
<code class="literal">
IGNORE
</code>
) and produce a
warning.
</p>
</li>
</ul>
</div>
</li>
</ul>
</div>
<p>
For more information about strict mode with respect to
<code class="literal">
IGNORE
</code>
, see
<a class="xref" href="sql-mode.html#ignore-strict-comparison" title="Comparison of the IGNORE Keyword and Strict SQL Mode">
Comparison of the IGNORE Keyword and Strict SQL Mode
</a>
.
</p>
<p>
Strict mode affects handling of division by zero, zero dates,
and zeros in dates in conjunction with the
<a class="link" href="sql-mode.html#sqlmode_error_for_division_by_zero">
<code class="literal">
ERROR_FOR_DIVISION_BY_ZERO
</code>
</a>
,
<a class="link" href="sql-mode.html#sqlmode_no_zero_date">
<code class="literal">
NO_ZERO_DATE
</code>
</a>
, and
<a class="link" href="sql-mode.html#sqlmode_no_zero_in_date">
<code class="literal">
NO_ZERO_IN_DATE
</code>
</a>
modes.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="ignore-strict-comparison">
</a>
Comparison of the IGNORE Keyword and Strict SQL Mode
</h4>
</div>
</div>
</div>
<p>
This section compares the effect on statement execution of the
<code class="literal">
IGNORE
</code>
keyword (which downgrades errors to
warnings) and strict SQL mode (which upgrades warnings to
errors). It describes which statements they affect, and which
errors they apply to.
</p>
<p>
The following table presents a summary comparison of statement
behavior when the default is to produce an error versus a
warning. An example of when the default is to produce an error
is inserting a
<code class="literal">
NULL
</code>
into a
<code class="literal">
NOT
NULL
</code>
column. An example of when the default is to
produce a warning is inserting a value of the wrong data type
into a column (such as inserting the string
<code class="literal">
'abc'
</code>
into an integer column).
</p>
<div class="informaltable">
<table summary="Comparison of statement behavior when the default is to produce an error versus a warning.">
<colgroup>
<col style="width: 33%"/>
<col style="width: 33%"/>
<col style="width: 33%"/>
</colgroup>
<thead>
<tr>
<th scope="col">
Operational Mode
</th>
<th scope="col">
When Statement Default is Error
</th>
<th scope="col">
When Statement Default is Warning
</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">
Without
<code class="literal">
IGNORE
</code>
or strict SQL mode
</th>
<td>
Error
</td>
<td>
Warning
</td>
</tr>
<tr>
<th scope="row">
With
<code class="literal">
IGNORE
</code>
</th>
<td>
Warning
</td>
<td>
Warning (same as without
<code class="literal">
IGNORE
</code>
or strict SQL mode)
</td>
</tr>
<tr>
<th scope="row">
With strict SQL mode
</th>
<td>
Error (same as without
<code class="literal">
IGNORE
</code>
or strict SQL mode)
</td>
<td>
Error
</td>
</tr>
<tr>
<th scope="row">
With
<code class="literal">
IGNORE
</code>
and strict SQL mode
</th>
<td>
Warning
</td>
<td>
Warning
</td>
</tr>
</tbody>
</table>
</div>
<p>
One conclusion to draw from the table is that when the
<code class="literal">
IGNORE
</code>
keyword and strict SQL mode are both
in effect,
<code class="literal">
IGNORE
</code>
takes precedence. This
means that, although
<code class="literal">
IGNORE
</code>
and strict SQL
mode can be considered to have opposite effects on error
handling, they do not cancel when used together.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="xref" href="sql-mode.html#ignore-effect-on-execution" title="The Effect of IGNORE on Statement Execution">
The Effect of IGNORE on Statement Execution
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="sql-mode.html#strict-sql-mode-effect-on-execution" title="The Effect of Strict SQL Mode on Statement Execution">
The Effect of Strict SQL Mode on Statement Execution
</a>
</p>
</li>
</ul>
</div>
<h5>
<a name="ignore-effect-on-execution">
</a>
The Effect of IGNORE on Statement Execution
</h5>
<p>
Several statements in MySQL support an optional
<code class="literal">
IGNORE
</code>
keyword. This keyword causes the
server to downgrade certain types of errors and generate
warnings instead. For a multiple-row statement, downgrading an
error to a warning may enable a row to be processed. Otherwise,
<code class="literal">
IGNORE
</code>
causes the statement to skip to the
next row instead of aborting. (For nonignorable errors, an error
occurs regardless of the
<code class="literal">
IGNORE
</code>
keyword.)
</p>
<p>
Example: If the table
<code class="literal">
t
</code>
has a primary key
column
<code class="literal">
i
</code>
containing unique values, attempting
to insert the same value of
<code class="literal">
i
</code>
into multiple
rows normally produces a duplicate-key error:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa3674695"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> t <span class="token punctuation">(</span>i <span class="token datatype">INT</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span> <span class="token keyword">PRIMARY</span> <span class="token keyword">KEY</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">INSERT</span> <span class="token keyword">INTO</span> t <span class="token punctuation">(</span>i<span class="token punctuation">)</span> <span class="token keyword">VALUES</span><span class="token punctuation">(</span><span class="token number">1</span><span class="token punctuation">)</span><span class="token punctuation">,</span><span class="token punctuation">(</span><span class="token number">1</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output">ERROR 1062 (23000)<span class="token punctuation">:</span> Duplicate entry '1' for key 't.PRIMARY'</span></code></pre>
</div>
<p>
With
<code class="literal">
IGNORE
</code>
, the row containing the duplicate
key still is not inserted, but a warning occurs instead of an
error:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa8913614"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">INSERT</span> <span class="token keyword">IGNORE</span> <span class="token keyword">INTO</span> t <span class="token punctuation">(</span>i<span class="token punctuation">)</span> <span class="token keyword">VALUES</span><span class="token punctuation">(</span><span class="token number">1</span><span class="token punctuation">)</span><span class="token punctuation">,</span><span class="token punctuation">(</span><span class="token number">1</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 1 row affected, 1 warning (0.01 sec)</span>
<span class="token output">Records: 2 Duplicates: 1 Warnings: 1</span>
<span class="token prompt">mysql></span> <span class="token keyword">SHOW</span> <span class="token keyword">WARNINGS</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> Level <span class="token punctuation">|</span> Code <span class="token punctuation">|</span> Message <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> Warning <span class="token punctuation">|</span> 1062 <span class="token punctuation">|</span> Duplicate entry '1' for key 't.PRIMARY' <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output">1 row in set (0.00 sec)</span></code></pre>
</div>
<p>
Example: If the table
<code class="literal">
t2
</code>
has a
<code class="literal">
NOT
NULL
</code>
column
<code class="literal">
id
</code>
, attempting to
insert
<code class="literal">
NULL
</code>
produces an error in strict SQL
mode:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa42102891"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> t2 <span class="token punctuation">(</span>id <span class="token datatype">INT</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">INSERT</span> <span class="token keyword">INTO</span> t2 <span class="token punctuation">(</span>id<span class="token punctuation">)</span> <span class="token keyword">VALUES</span><span class="token punctuation">(</span><span class="token number">1</span><span class="token punctuation">)</span><span class="token punctuation">,</span><span class="token punctuation">(</span><span class="token boolean">NULL</span><span class="token punctuation">)</span><span class="token punctuation">,</span><span class="token punctuation">(</span><span class="token number">3</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output">ERROR 1048 (23000)<span class="token punctuation">:</span> Column 'id' cannot be null</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> t2<span class="token punctuation">;</span>
<span class="token output">Empty set (0.00 sec)</span></code></pre>
</div>
<p>
If the SQL mode is not strict,
<code class="literal">
IGNORE
</code>
causes
the
<code class="literal">
NULL
</code>
to be inserted as the column
implicit default (0 in this case), which enables the row to be
handled without skipping it:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa98446054"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">INSERT</span> <span class="token keyword">INTO</span> t2 <span class="token punctuation">(</span>id<span class="token punctuation">)</span> <span class="token keyword">VALUES</span><span class="token punctuation">(</span><span class="token number">1</span><span class="token punctuation">)</span><span class="token punctuation">,</span><span class="token punctuation">(</span><span class="token boolean">NULL</span><span class="token punctuation">)</span><span class="token punctuation">,</span><span class="token punctuation">(</span><span class="token number">3</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> t2<span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> id <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 3 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
<p>
These statements support the
<code class="literal">
IGNORE
</code>
keyword:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="link" href="create-table.html" title="15.1.20 CREATE TABLE Statement">
<code class="literal">
CREATE TABLE
... SELECT
</code>
</a>
:
<code class="literal">
IGNORE
</code>
does not
apply to the
<a class="link" href="create-table.html" title="15.1.20 CREATE TABLE Statement">
<code class="literal">
CREATE TABLE
</code>
</a>
or
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
parts of the statement
but to inserts into the table of rows produced by the
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
. Rows that duplicate
an existing row on a unique key value are discarded.
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="delete.html" title="15.2.2 DELETE Statement">
<code class="literal">
DELETE
</code>
</a>
:
<code class="literal">
IGNORE
</code>
causes MySQL to ignore errors
during the process of deleting rows.
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="insert.html" title="15.2.7 INSERT Statement">
<code class="literal">
INSERT
</code>
</a>
: With
<code class="literal">
IGNORE
</code>
, rows that duplicate an existing
row on a unique key value are discarded. Rows set to values
that would cause data conversion errors are set to the
closest valid values instead.
</p>
<p>
<a class="indexterm" name="idm46045261117168">
</a>
For partitioned tables where no partition matching a given
value is found,
<code class="literal">
IGNORE
</code>
causes the insert
operation to fail silently for rows containing the unmatched
value.
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="load-data.html" title="15.2.9 LOAD DATA Statement">
<code class="literal">
LOAD DATA
</code>
</a>
,
<a class="link" href="load-xml.html" title="15.2.10 LOAD XML Statement">
<code class="literal">
LOAD XML
</code>
</a>
: With
<code class="literal">
IGNORE
</code>
, rows that duplicate an existing
row on a unique key value are discarded.
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="update.html" title="15.2.17 UPDATE Statement">
<code class="literal">
UPDATE
</code>
</a>
: With
<code class="literal">
IGNORE
</code>
, rows for which duplicate-key
conflicts occur on a unique key value are not updated. Rows
updated to values that would cause data conversion errors
are updated to the closest valid values instead.
</p>
</li>
</ul>
</div>
<p>
The
<code class="literal">
IGNORE
</code>
keyword applies to the following
ignorable errors:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_bad_null_error" target="_top">
<code class="literal">
ER_BAD_NULL_ERROR
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_dup_entry" target="_top">
<code class="literal">
ER_DUP_ENTRY
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_dup_entry_with_key_name" target="_top">
<code class="literal">
ER_DUP_ENTRY_WITH_KEY_NAME
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_dup_key" target="_top">
<code class="literal">
ER_DUP_KEY
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_no_partition_for_given_value" target="_top">
<code class="literal">
ER_NO_PARTITION_FOR_GIVEN_VALUE
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_no_partition_for_given_value_silent" target="_top">
<code class="literal">
ER_NO_PARTITION_FOR_GIVEN_VALUE_SILENT
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_no_referenced_row_2" target="_top">
<code class="literal">
ER_NO_REFERENCED_ROW_2
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_row_does_not_match_given_partition_set" target="_top">
<code class="literal">
ER_ROW_DOES_NOT_MATCH_GIVEN_PARTITION_SET
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_row_is_referenced_2" target="_top">
<code class="literal">
ER_ROW_IS_REFERENCED_2
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_subquery_no_1_row" target="_top">
<code class="literal">
ER_SUBQUERY_NO_1_ROW
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_view_check_failed" target="_top">
<code class="literal">
ER_VIEW_CHECK_FAILED
</code>
</a>
</p>
</li>
</ul>
</div>
<h5>
<a name="strict-sql-mode-effect-on-execution">
</a>
The Effect of Strict SQL Mode on Statement Execution
</h5>
<p>
The MySQL server can operate in different SQL modes, and can
apply these modes differently for different clients, depending
on the value of the
<a class="link" href="server-system-variables.html#sysvar_sql_mode">
<code class="literal">
sql_mode
</code>
</a>
system variable. In
<span class="quote">
“
<span class="quote">
strict
</span>
”
</span>
SQL mode, the server
upgrades certain warnings to errors.
</p>
<p>
For example, in non-strict SQL mode, inserting the string
<code class="literal">
'abc'
</code>
into an integer column results in
conversion of the value to 0 and a warning:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa75191061"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SET</span> sql_mode <span class="token operator">=</span> <span class="token string">''</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 0 rows affected (0.00 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">INSERT</span> <span class="token keyword">INTO</span> t <span class="token punctuation">(</span>i<span class="token punctuation">)</span> <span class="token keyword">VALUES</span><span class="token punctuation">(</span><span class="token string">'abc'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 1 row affected, 1 warning (0.01 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">SHOW</span> <span class="token keyword">WARNINGS</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> Level <span class="token punctuation">|</span> Code <span class="token punctuation">|</span> Message <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> Warning <span class="token punctuation">|</span> 1366 <span class="token punctuation">|</span> Incorrect integer value: 'abc' for column 'i' at row 1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output">1 row in set (0.00 sec)</span></code></pre>
</div>
<p>
In strict SQL mode, the invalid value is rejected with an error:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa25710482"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SET</span> sql_mode <span class="token operator">=</span> <span class="token string">'STRICT_ALL_TABLES'</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 0 rows affected (0.00 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">INSERT</span> <span class="token keyword">INTO</span> t <span class="token punctuation">(</span>i<span class="token punctuation">)</span> <span class="token keyword">VALUES</span><span class="token punctuation">(</span><span class="token string">'abc'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output">ERROR 1366 (HY000)<span class="token punctuation">:</span> Incorrect integer value<span class="token punctuation">:</span> 'abc' for column 'i' at row 1</span></code></pre>
</div>
<p>
For more information about possible settings of the
<a class="link" href="server-system-variables.html#sysvar_sql_mode">
<code class="literal">
sql_mode
</code>
</a>
system variable, see
<a class="xref" href="sql-mode.html" title="7.1.11 Server SQL Modes">
Section 7.1.11, “Server SQL Modes”
</a>
.
</p>
<p>
Strict SQL mode applies to the following statements under
conditions for which some value might be out of range or an
invalid row is inserted into or deleted from a table:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER TABLE
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="create-table.html" title="15.1.20 CREATE TABLE Statement">
<code class="literal">
CREATE TABLE
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="create-table.html" title="15.1.20 CREATE TABLE Statement">
<code class="literal">
CREATE TABLE
... SELECT
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="delete.html" title="15.2.2 DELETE Statement">
<code class="literal">
DELETE
</code>
</a>
(both single table and
multiple table)
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="insert.html" title="15.2.7 INSERT Statement">
<code class="literal">
INSERT
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="load-data.html" title="15.2.9 LOAD DATA Statement">
<code class="literal">
LOAD DATA
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="load-xml.html" title="15.2.10 LOAD XML Statement">
<code class="literal">
LOAD XML
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
SLEEP()
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="update.html" title="15.2.17 UPDATE Statement">
<code class="literal">
UPDATE
</code>
</a>
(both single table and
multiple table)
</p>
</li>
</ul>
</div>
<p>
Within stored programs, individual statements of the types just
listed execute in strict SQL mode if the program was defined
while strict mode was in effect.
</p>
<p>
Strict SQL mode applies to the following errors, which represent
a class of errors in which an input value is either invalid or
missing. A value is invalid if it has the wrong data type for
the column or might be out of range. A value is missing if a new
row to be inserted does not contain a value for a
<code class="literal">
NOT
NULL
</code>
column that has no explicit
<code class="literal">
DEFAULT
</code>
clause in its definition.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-simple"><div class="docs-select-all right" id="sa50965071"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-simple">ER_BAD_NULL_ERROR
ER_CUT_VALUE_GROUP_CONCAT
ER_DATA_TOO_LONG
ER_DATETIME_FUNCTION_OVERFLOW
ER_DIVISION_BY_ZERO
ER_INVALID_ARGUMENT_FOR_LOGARITHM
ER_NO_DEFAULT_FOR_FIELD
ER_NO_DEFAULT_FOR_VIEW_FIELD
ER_TOO_LONG_KEY
ER_TRUNCATED_WRONG_VALUE
ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
ER_WARN_DATA_OUT_OF_RANGE
ER_WARN_NULL_TO_NOTNULL
ER_WARN_TOO_FEW_RECORDS
ER_WRONG_ARGUMENTS
ER_WRONG_VALUE_FOR_TYPE
WARN_DATA_TRUNCATED</code></pre>
</div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
Because continued MySQL development defines new errors, there
may be errors not in the preceding list to which strict SQL
mode applies.
</p>
</div>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/optimize-overview.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title">
<a name="optimize-overview">
</a>
10.1 Optimization Overview
</h2>
</div>
</div>
</div>
<p>
Database performance depends on several factors at the database
level, such as tables, queries, and configuration settings. These
software constructs result in CPU and I/O operations at the
hardware level, which you must minimize and make as efficient as
possible. As you work on database performance, you start by
learning the high-level rules and guidelines for the software
side, and measuring performance using wall-clock time. As you
become an expert, you learn more about what happens internally,
and start measuring things such as CPU cycles and I/O operations.
</p>
<p>
Typical users aim to get the best database performance out of
their existing software and hardware configurations. Advanced
users look for opportunities to improve the MySQL software itself,
or develop their own storage engines and hardware appliances to
expand the MySQL ecosystem.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="xref" href="optimize-overview.html#optimize-database-level" title="Optimizing at the Database Level">
Optimizing at the Database Level
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="optimize-overview.html#optimize-hardware-level" title="Optimizing at the Hardware Level">
Optimizing at the Hardware Level
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="optimize-overview.html#optimize-portability-performance" title="Balancing Portability and Performance">
Balancing Portability and Performance
</a>
</p>
</li>
</ul>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h3 class="title">
<a name="optimize-database-level">
</a>
Optimizing at the Database Level
</h3>
</div>
</div>
</div>
<p>
The most important factor in making a database application fast
is its basic design:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Are the tables structured properly? In particular, do the
columns have the right data types, and does each table have
the appropriate columns for the type of work? For example,
applications that perform frequent updates often have many
tables with few columns, while applications that analyze
large amounts of data often have few tables with many
columns.
</p>
</li>
<li class="listitem">
<p>
Are the right
<a class="link" href="optimization-indexes.html" title="10.3 Optimization and Indexes">
indexes
</a>
in place
to make queries efficient?
</p>
</li>
<li class="listitem">
<p>
Are you using the appropriate storage engine for each table,
and taking advantage of the strengths and features of each
storage engine you use? In particular, the choice of a
transactional storage engine such as
<code class="literal">
<a class="link" href="optimizing-innodb.html" title="10.5 Optimizing for InnoDB Tables">
InnoDB
</a>
</code>
or a nontransactional one such as
<code class="literal">
<a class="link" href="optimizing-myisam.html" title="10.6 Optimizing for MyISAM Tables">
MyISAM
</a>
</code>
can be very important for performance and scalability.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
<code class="literal">
InnoDB
</code>
is the default storage engine
for new tables. In practice, the advanced
<code class="literal">
InnoDB
</code>
performance features mean that
<code class="literal">
InnoDB
</code>
tables often outperform the
simpler
<code class="literal">
MyISAM
</code>
tables, especially for a
busy database.
</p>
</div>
</li>
<li class="listitem">
<p>
Does each table use an appropriate row format? This choice
also depends on the storage engine used for the table. In
particular, compressed tables use less disk space and so
require less disk I/O to read and write the data.
Compression is available for all kinds of workloads with
<code class="literal">
InnoDB
</code>
tables, and for read-only
<code class="literal">
MyISAM
</code>
tables.
</p>
</li>
<li class="listitem">
<p>
Does the application use an appropriate
<a class="link" href="locking-issues.html" title="10.11 Optimizing Locking Operations">
locking strategy
</a>
? For
example, by allowing shared access when possible so that
database operations can run concurrently, and requesting
exclusive access when appropriate so that critical
operations get top priority. Again, the choice of storage
engine is significant. The
<code class="literal">
InnoDB
</code>
storage
engine handles most locking issues without involvement from
you, allowing for better concurrency in the database and
reducing the amount of experimentation and tuning for your
code.
</p>
</li>
<li class="listitem">
<p>
Are all
<a class="link" href="buffering-caching.html" title="10.10 Buffering and Caching">
memory areas used
for caching
</a>
sized correctly? That is, large enough to
hold frequently accessed data, but not so large that they
overload physical memory and cause paging. The main memory
areas to configure are the
<code class="literal">
InnoDB
</code>
buffer
pool and the
<code class="literal">
MyISAM
</code>
key cache.
</p>
</li>
</ul>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h3 class="title">
<a name="optimize-hardware-level">
</a>
Optimizing at the Hardware Level
</h3>
</div>
</div>
</div>
<p>
Any database application eventually hits hardware limits as the
database becomes more and more busy. A DBA must evaluate whether
it is possible to tune the application or reconfigure the server
to avoid these
<a class="link" href="glossary.html#glos_bottleneck" title="bottleneck">
bottlenecks
</a>
, or whether
more hardware resources are required. System bottlenecks
typically arise from these sources:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Disk seeks. It takes time for the disk to find a piece of
data. With modern disks, the mean time for this is usually
lower than 10ms, so we can in theory do about 100 seeks a
second. This time improves slowly with new disks and is very
hard to optimize for a single table. The way to optimize
seek time is to distribute the data onto more than one disk.
</p>
</li>
<li class="listitem">
<p>
Disk reading and writing. When the disk is at the correct
position, we need to read or write the data. With modern
disks, one disk delivers at least 10–20MB/s
throughput. This is easier to optimize than seeks because
you can read in parallel from multiple disks.
</p>
</li>
<li class="listitem">
<p>
CPU cycles. When the data is in main memory, we must process
it to get our result. Having large tables compared to the
amount of memory is the most common limiting factor. But
with small tables, speed is usually not the problem.
</p>
</li>
<li class="listitem">
<p>
Memory bandwidth. When the CPU needs more data than can fit
in the CPU cache, main memory bandwidth becomes a
bottleneck. This is an uncommon bottleneck for most systems,
but one to be aware of.
</p>
</li>
</ul>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h3 class="title">
<a name="optimize-portability-performance">
</a>
Balancing Portability and Performance
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045230375840">
</a>
<p>
To use performance-oriented SQL extensions in a portable MySQL
program, you can wrap MySQL-specific keywords in a statement
within
<code class="literal">
/*! */
</code>
comment delimiters. Other SQL
servers ignore the commented keywords. For information about
writing comments, see
<a class="xref" href="comments.html" title="11.7 Comments">
Section 11.7, “Comments”
</a>
.
</p>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/mysql-cluster-install-windows-initial-start.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="mysql-cluster-install-windows-initial-start">
</a>
25.3.2.3 Initial Startup of NDB Cluster on Windows
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045122423808">
</a>
<p>
Once the NDB Cluster executables and needed configuration files
are in place, performing an initial start of the cluster is
simply a matter of starting the NDB Cluster executables for all
nodes in the cluster. Each cluster node process must be started
separately, and on the host computer where it resides. The
management node should be started first, followed by the data
nodes, and then finally by any SQL nodes.
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
On the management node host, issue the following command
from the command line to start the management node process.
The output should appear similar to what is shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa45247737"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">C:\mysql\bin></span><span class="token command"> ndb_mgmd</span>
2010-06-23 07<span class="token punctuation">:</span>53<span class="token punctuation">:</span>34 <span class="token punctuation">[</span>MgmtSrvr<span class="token punctuation">]</span> INFO <span class="token property">--</span> NDB Cluster Management Server<span class="token punctuation">.</span> mysql-8<span class="token punctuation">.</span>4<span class="token punctuation">.</span>0-ndb-8<span class="token punctuation">.</span>4<span class="token punctuation">.</span>0
2010-06-23 07<span class="token punctuation">:</span>53<span class="token punctuation">:</span>34 <span class="token punctuation">[</span>MgmtSrvr<span class="token punctuation">]</span> INFO <span class="token property">--</span> Reading cluster configuration from <span class="token atrule">'config.ini'</span></code></pre>
</div>
<p>
The management node process continues to print logging
output to the console. This is normal, because the
management node is not running as a Windows service. (If you
have used NDB Cluster on a Unix-like platform such as Linux,
you may notice that the management node's default
behavior in this regard on Windows is effectively the
opposite of its behavior on Unix systems, where it runs by
default as a Unix daemon process. This behavior is also true
of NDB Cluster data node processes running on Windows.) For
this reason, do not close the window in which
<a class="link" href="mysql-cluster-programs-ndb-mgmd.html" title="25.5.4 ndb_mgmd — The NDB Cluster Management Server Daemon">
<span class="command">
<strong>
ndb_mgmd.exe
</strong>
</span>
</a>
is running; doing so kills
the management node process. (See
<a class="xref" href="mysql-cluster-install-windows-service.html" title="25.3.2.4 Installing NDB Cluster Processes as Windows Services">
Section 25.3.2.4, “Installing NDB Cluster Processes as Windows Services”
</a>
,
where we show how to install and run NDB Cluster processes
as Windows services.)
</p>
<p>
The required
<code class="option">
-f
</code>
option tells the management
node where to find the global configuration file
(
<code class="filename">
config.ini
</code>
). The long form of this
option is
<a class="link" href="mysql-cluster-programs-ndb-mgmd.html#option_ndb_mgmd_config-file">
<code class="option">
--config-file
</code>
</a>
.
</p>
<div class="important" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Important
</div>
<p>
An NDB Cluster management node caches the configuration
data that it reads from
<code class="filename">
config.ini
</code>
;
once it has created a configuration cache, it ignores the
<code class="filename">
config.ini
</code>
file on subsequent starts
unless forced to do otherwise. This means that, if the
management node fails to start due to an error in this
file, you must make the management node re-read
<code class="filename">
config.ini
</code>
after you have corrected
any errors in it. You can do this by starting
<a class="link" href="mysql-cluster-programs-ndb-mgmd.html" title="25.5.4 ndb_mgmd — The NDB Cluster Management Server Daemon">
<span class="command">
<strong>
ndb_mgmd.exe
</strong>
</span>
</a>
with the
<a class="link" href="mysql-cluster-programs-ndb-mgmd.html#option_ndb_mgmd_reload">
<code class="option">
--reload
</code>
</a>
or
<a class="link" href="mysql-cluster-programs-ndb-mgmd.html#option_ndb_mgmd_initial">
<code class="option">
--initial
</code>
</a>
option on the
command line. Either of these options works to refresh the
configuration cache.
</p>
<p>
It is not necessary or advisable to use either of these
options in the management node's
<code class="filename">
my.ini
</code>
file.
</p>
</div>
</li>
<li class="listitem">
<p>
On each of the data node hosts, run the command shown here
to start the data node processes:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa28874870"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">C:\mysql\bin></span><span class="token command"> ndbd</span>
2010-06-23 07<span class="token punctuation">:</span>53<span class="token punctuation">:</span>46 <span class="token punctuation">[</span>ndbd<span class="token punctuation">]</span> INFO <span class="token property">--</span> Configuration fetched from <span class="token atrule">'localhost:1186'</span><span class="token punctuation">,</span> generation<span class="token punctuation">:</span> 1</code></pre>
</div>
<p>
In each case, the first line of output from the data node
process should resemble what is shown in the preceding
example, and is followed by additional lines of logging
output. As with the management node process, this is normal,
because the data node is not running as a Windows service.
For this reason, do not close the console window in which
the data node process is running; doing so kills
<a class="link" href="mysql-cluster-programs-ndbd.html" title="25.5.1 ndbd — The NDB Cluster Data Node Daemon">
<span class="command">
<strong>
ndbd.exe
</strong>
</span>
</a>
. (For more information, see
<a class="xref" href="mysql-cluster-install-windows-service.html" title="25.3.2.4 Installing NDB Cluster Processes as Windows Services">
Section 25.3.2.4, “Installing NDB Cluster Processes as Windows Services”
</a>
.)
</p>
</li>
<li class="listitem">
<p>
Do not start the SQL node yet; it cannot connect to the
cluster until the data nodes have finished starting, which
may take some time. Instead, in a new console window on the
management node host, start the NDB Cluster management
client
<a class="link" href="mysql-cluster-programs-ndb-mgm.html" title="25.5.5 ndb_mgm — The NDB Cluster Management Client">
<span class="command">
<strong>
ndb_mgm.exe
</strong>
</span>
</a>
, which should be in
<code class="filename">
C:\mysql\bin
</code>
on the management node
host. (Do not try to re-use the console window where
<a class="link" href="mysql-cluster-programs-ndb-mgmd.html" title="25.5.4 ndb_mgmd — The NDB Cluster Management Server Daemon">
<span class="command">
<strong>
ndb_mgmd.exe
</strong>
</span>
</a>
is running by typing
<span class="keycap">
<strong>
CTRL
</strong>
</span>
+
<span class="keycap">
<strong>
C
</strong>
</span>
, as this kills the
management node.) The resulting output should look like
this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa19991518"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">C:\mysql\bin></span><span class="token command"> ndb_mgm</span>
<span class="token property">--</span> NDB Cluster <span class="token property">--</span> Management Client <span class="token property">--</span>
ndb_mgm></code></pre>
</div>
<p>
When the prompt
<code class="literal">
ndb_mgm>
</code>
appears, this
indicates that the management client is ready to receive NDB
Cluster management commands. You can observe the status of
the data nodes as they start by entering
<a class="link" href="mysql-cluster-mgm-client-commands.html#ndbclient-status">
<code class="literal">
ALL STATUS
</code>
</a>
at the
management client prompt. This command causes a running
report of the data nodes's startup sequence, which
should look something like this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-ndbmgm"><div class="docs-select-all right" id="sa48876954"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-ndbmgm"><span class="token prompt">ndb_mgm></span> <span class="token keyword">ALL</span> <span class="token keyword">STATUS</span>
Connected to Management Server at<span class="token operator">:</span> localhost<span class="token operator">:</span>1186 <span class="token punctuation">(</span>using cleartext<span class="token punctuation">)</span>
<span class="token selector">Node 2:</span> starting <span class="token punctuation">(</span>Last completed phase 3<span class="token punctuation">)</span> <span class="token punctuation">(</span>mysql<span class="token operator">-</span>8<span class="token punctuation">.</span>4<span class="token punctuation">.</span>0<span class="token operator">-</span>ndb<span class="token operator">-</span>8<span class="token punctuation">.</span>4<span class="token punctuation">.</span>0<span class="token punctuation">)</span>
<span class="token selector">Node 3:</span> starting <span class="token punctuation">(</span>Last completed phase 3<span class="token punctuation">)</span> <span class="token punctuation">(</span>mysql<span class="token operator">-</span>8<span class="token punctuation">.</span>4<span class="token punctuation">.</span>0<span class="token operator">-</span>ndb<span class="token operator">-</span>8<span class="token punctuation">.</span>4<span class="token punctuation">.</span>0<span class="token punctuation">)</span>
<span class="token selector">Node 2:</span> starting <span class="token punctuation">(</span>Last completed phase 4<span class="token punctuation">)</span> <span class="token punctuation">(</span>mysql<span class="token operator">-</span>8<span class="token punctuation">.</span>4<span class="token punctuation">.</span>0<span class="token operator">-</span>ndb<span class="token operator">-</span>8<span class="token punctuation">.</span>4<span class="token punctuation">.</span>0<span class="token punctuation">)</span>
<span class="token selector">Node 3:</span> starting <span class="token punctuation">(</span>Last completed phase 4<span class="token punctuation">)</span> <span class="token punctuation">(</span>mysql<span class="token operator">-</span>8<span class="token punctuation">.</span>4<span class="token punctuation">.</span>0<span class="token operator">-</span>ndb<span class="token operator">-</span>8<span class="token punctuation">.</span>4<span class="token punctuation">.</span>0<span class="token punctuation">)</span>
<span class="token selector">Node 2:</span> Started <span class="token punctuation">(</span>version 8<span class="token punctuation">.</span>4<span class="token punctuation">.</span>0<span class="token punctuation">)</span>
<span class="token selector">Node 3:</span> Started <span class="token punctuation">(</span>version 8<span class="token punctuation">.</span>4<span class="token punctuation">.</span>0<span class="token punctuation">)</span>
<span class="token prompt">ndb_mgm></span></code></pre>
</div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
Commands issued in the management client are not
case-sensitive; we use uppercase as the canonical form of
these commands, but you are not required to observe this
convention when inputting them into the
<a class="link" href="mysql-cluster-programs-ndb-mgm.html" title="25.5.5 ndb_mgm — The NDB Cluster Management Client">
<span class="command">
<strong>
ndb_mgm
</strong>
</span>
</a>
client. For more information,
see
<a class="xref" href="mysql-cluster-mgm-client-commands.html" title="25.6.1 Commands in the NDB Cluster Management Client">
Section 25.6.1, “Commands in the NDB Cluster Management Client”
</a>
.
</p>
</div>
<p>
The output produced by
<a class="link" href="mysql-cluster-mgm-client-commands.html#ndbclient-status">
<code class="literal">
ALL
STATUS
</code>
</a>
is likely to vary from what is shown here,
according to the speed at which the data nodes are able to
start, the release version number of the NDB Cluster
software you are using, and other factors. What is
significant is that, when you see that both data nodes have
started, you are ready to start the SQL node.
</p>
<p>
You can leave
<a class="link" href="mysql-cluster-programs-ndb-mgm.html" title="25.5.5 ndb_mgm — The NDB Cluster Management Client">
<span class="command">
<strong>
ndb_mgm.exe
</strong>
</span>
</a>
running; it has
no negative impact on the performance of the NDB Cluster,
and we use it in the next step to verify that the SQL node
is connected to the cluster after you have started it.
</p>
</li>
<li class="listitem">
<p>
On the computer designated as the SQL node host, open a
console window and navigate to the directory where you
unpacked the NDB Cluster binaries (if you are following our
example, this is
<code class="filename">
C:\mysql\bin
</code>
).
</p>
<p>
Start the SQL node by invoking
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld.exe
</strong>
</span>
</a>
from the command line, as shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa18789179"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">C:\mysql\bin></span><span class="token command"> mysqld</span> <span class="token property">--console</span></code></pre>
</div>
<p>
The
<a class="link" href="server-options.html#option_mysqld_console">
<code class="option">
--console
</code>
</a>
option causes
logging information to be written to the console, which can
be helpful in the event of problems. (Once you are satisfied
that the SQL node is running in a satisfactory manner, you
can stop it and restart it out without the
<a class="link" href="server-options.html#option_mysqld_console">
<code class="option">
--console
</code>
</a>
option, so that
logging is performed normally.)
</p>
<p>
In the console window where the management client
(
<a class="link" href="mysql-cluster-programs-ndb-mgm.html" title="25.5.5 ndb_mgm — The NDB Cluster Management Client">
<span class="command">
<strong>
ndb_mgm.exe
</strong>
</span>
</a>
) is running on the
management node host, enter the
<a class="link" href="mysql-cluster-mgm-client-commands.html#ndbclient-show">
<code class="literal">
SHOW
</code>
</a>
command, which
should produce output similar to what is shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-ndbmgm"><div class="docs-select-all right" id="sa3439323"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-ndbmgm"><span class="token prompt">ndb_mgm></span> <span class="token keyword">SHOW</span>
Connected to Management Server at<span class="token operator">:</span> localhost<span class="token operator">:</span>1186 <span class="token punctuation">(</span>using cleartext<span class="token punctuation">)</span>
Cluster Configuration
<span class="token operator">--</span><span class="token operator">--</span><span class="token operator">--</span><span class="token operator">--</span><span class="token operator">--</span><span class="token operator">--</span><span class="token operator">--</span><span class="token operator">--</span><span class="token operator">--</span><span class="token operator">--</span><span class="token operator">-</span>
<span class="token selector">[ndbd(NDB)]</span> 2 node<span class="token punctuation">(</span>s<span class="token punctuation">)</span>
id<span class="token operator">=</span>2 @198<span class="token punctuation">.</span>51<span class="token punctuation">.</span>100<span class="token punctuation">.</span>30 <span class="token punctuation">(</span>Version<span class="token operator">:</span> 8<span class="token punctuation">.</span>4<span class="token punctuation">.</span>0<span class="token operator">-</span>ndb<span class="token operator">-</span>8<span class="token punctuation">.</span>4<span class="token punctuation">.</span>0<span class="token punctuation">,</span> Nodegroup<span class="token operator">:</span> 0<span class="token punctuation">,</span> <span class="token operator">*</span><span class="token punctuation">)</span>
id<span class="token operator">=</span>3 @198<span class="token punctuation">.</span>51<span class="token punctuation">.</span>100<span class="token punctuation">.</span>40 <span class="token punctuation">(</span>Version<span class="token operator">:</span> 8<span class="token punctuation">.</span>4<span class="token punctuation">.</span>0<span class="token operator">-</span>ndb<span class="token operator">-</span>8<span class="token punctuation">.</span>4<span class="token punctuation">.</span>0<span class="token punctuation">,</span> Nodegroup<span class="token operator">:</span> 0<span class="token punctuation">)</span>
<span class="token selector">[ndb_mgmd(MGM)]</span> 1 node<span class="token punctuation">(</span>s<span class="token punctuation">)</span>
id<span class="token operator">=</span>1 @198<span class="token punctuation">.</span>51<span class="token punctuation">.</span>100<span class="token punctuation">.</span>10 <span class="token punctuation">(</span>Version<span class="token operator">:</span> 8<span class="token punctuation">.</span>4<span class="token punctuation">.</span>0<span class="token operator">-</span>ndb<span class="token operator">-</span>8<span class="token punctuation">.</span>4<span class="token punctuation">.</span>0<span class="token punctuation">)</span>
<span class="token selector">[mysqld(API)]</span> 1 node<span class="token punctuation">(</span>s<span class="token punctuation">)</span>
id<span class="token operator">=</span>4 @198<span class="token punctuation">.</span>51<span class="token punctuation">.</span>100<span class="token punctuation">.</span>20 <span class="token punctuation">(</span>Version<span class="token operator">:</span> 8<span class="token punctuation">.</span>4<span class="token punctuation">.</span>0<span class="token operator">-</span>ndb<span class="token operator">-</span>8<span class="token punctuation">.</span>4<span class="token punctuation">.</span>0<span class="token punctuation">)</span></code></pre>
</div>
<p>
You can also verify that the SQL node is connected to the
NDB Cluster in the
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
client
(
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql.exe
</strong>
</span>
</a>
) using the
<a class="link" href="show-engine.html#show-engine-ndb-status" title="SHOW ENGINE NDB STATUS">
<code class="literal">
SHOW ENGINE NDB STATUS
</code>
</a>
statement.
</p>
</li>
</ol>
</div>
<p>
You should now be ready to work with database objects and data
using NDB Cluster 's
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDBCLUSTER
</code>
</a>
storage engine. See
<a class="xref" href="mysql-cluster-install-example-data.html" title="25.3.5 NDB Cluster Example with Tables and Data">
Section 25.3.5, “NDB Cluster Example with Tables and Data”
</a>
, for more
information and examples.
</p>
<p>
You can also install
<a class="link" href="mysql-cluster-programs-ndb-mgmd.html" title="25.5.4 ndb_mgmd — The NDB Cluster Management Server Daemon">
<span class="command">
<strong>
ndb_mgmd.exe
</strong>
</span>
</a>
,
<a class="link" href="mysql-cluster-programs-ndbd.html" title="25.5.1 ndbd — The NDB Cluster Data Node Daemon">
<span class="command">
<strong>
ndbd.exe
</strong>
</span>
</a>
, and
<a class="link" href="mysql-cluster-programs-ndbmtd.html" title="25.5.3 ndbmtd — The NDB Cluster Data Node Daemon (Multi-Threaded)">
<span class="command">
<strong>
ndbmtd.exe
</strong>
</span>
</a>
as Windows services. For information on how to do this, see
<a class="xref" href="mysql-cluster-install-windows-service.html" title="25.3.2.4 Installing NDB Cluster Processes as Windows Services">
Section 25.3.2.4, “Installing NDB Cluster Processes as Windows Services”
</a>
).
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/replication-features-truncate.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="replication-features-truncate">
</a>
19.5.1.37 Replication and TRUNCATE TABLE
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045134868688">
</a>
<a class="indexterm" name="idm46045134867200">
</a>
<p>
<a class="link" href="truncate-table.html" title="15.1.37 TRUNCATE TABLE Statement">
<code class="literal">
TRUNCATE TABLE
</code>
</a>
is normally
regarded as a DML statement, and so would be expected to be
logged and replicated using row-based format when the binary
logging mode is
<code class="literal">
ROW
</code>
or
<code class="literal">
MIXED
</code>
. However this caused issues when
logging or replicating, in
<code class="literal">
STATEMENT
</code>
or
<code class="literal">
MIXED
</code>
mode, tables that used transactional
storage engines such as
<a class="link" href="innodb-storage-engine.html" title="Chapter 17 The InnoDB Storage Engine">
<code class="literal">
InnoDB
</code>
</a>
when
the transaction isolation level was
<code class="literal">
READ
COMMITTED
</code>
or
<code class="literal">
READ UNCOMMITTED
</code>
,
which precludes statement-based logging.
</p>
<p>
<a class="link" href="truncate-table.html" title="15.1.37 TRUNCATE TABLE Statement">
<code class="literal">
TRUNCATE TABLE
</code>
</a>
is treated for
purposes of logging and replication as DDL rather than DML so
that it can be logged and replicated as a statement. However,
the effects of the statement as applicable to
<a class="link" href="innodb-storage-engine.html" title="Chapter 17 The InnoDB Storage Engine">
<code class="literal">
InnoDB
</code>
</a>
and other transactional
tables on replicas still follow the rules described in
<a class="xref" href="truncate-table.html" title="15.1.37 TRUNCATE TABLE Statement">
Section 15.1.37, “TRUNCATE TABLE Statement”
</a>
governing such tables. (Bug
#36763)
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/option-file-options.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="option-file-options">
</a>
6.2.2.3 Command-Line Options that Affect Option-File Handling
</h4>
</div>
</div>
</div>
<p>
Most MySQL programs that support option files handle the
following options. Because these options affect option-file
handling, they must be given on the command line and not in an
option file. To work properly, each of these options must be
given before other options, with these exceptions:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="link" href="option-file-options.html#option_general_print-defaults">
<code class="option">
--print-defaults
</code>
</a>
may be used
immediately after
<a class="link" href="option-file-options.html#option_general_defaults-file">
<code class="option">
--defaults-file
</code>
</a>
,
<a class="link" href="option-file-options.html#option_general_defaults-extra-file">
<code class="option">
--defaults-extra-file
</code>
</a>
,
<a class="link" href="option-file-options.html#option_general_login-path">
<code class="option">
--login-path
</code>
</a>
, or
<a class="link" href="option-file-options.html#option_general_no-login-paths">
<code class="option">
--no-login-paths
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
On Windows, if the server is started with the
<a class="link" href="option-file-options.html#option_general_defaults-file">
<code class="option">
--defaults-file
</code>
</a>
and
<a class="link" href="server-options.html#option_mysqld_install">
<code class="option">
--install
</code>
</a>
options,
<a class="link" href="server-options.html#option_mysqld_install">
<code class="option">
--install
</code>
</a>
must be first. See
<a class="xref" href="windows-start-service.html" title="2.3.3.8 Starting MySQL as a Windows Service">
Section 2.3.3.8, “Starting MySQL as a Windows Service”
</a>
.
</p>
</li>
</ul>
</div>
<p>
When specifying file names as option values, avoid the use of
the
<code class="literal">
~
</code>
shell metacharacter because it might
not be interpreted as you expect.
</p>
<div class="table">
<a name="idm46045323885584">
</a>
<p class="title">
<b>
Table 6.3 Option File Option Summary
</b>
</p>
<div class="table-contents">
<table frame="box" rules="all" summary="Command-line options available for handling option files.">
<colgroup>
<col style="width: 35%"/>
<col style="width: 64%"/>
</colgroup>
<thead>
<tr>
<th>
Option Name
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a class="link" href="option-file-options.html#option_general_defaults-extra-file">
--defaults-extra-file
</a>
</td>
<td>
Read named option file in addition to usual option files
</td>
</tr>
<tr>
<td>
<a class="link" href="option-file-options.html#option_general_defaults-file">
--defaults-file
</a>
</td>
<td>
Read only named option file
</td>
</tr>
<tr>
<td>
<a class="link" href="option-file-options.html#option_general_defaults-group-suffix">
--defaults-group-suffix
</a>
</td>
<td>
Option group suffix value
</td>
</tr>
<tr>
<td>
<a class="link" href="option-file-options.html#option_general_login-path">
--login-path
</a>
</td>
<td>
Read login path options from .mylogin.cnf
</td>
</tr>
<tr>
<td>
<a class="link" href="option-file-options.html#option_general_no-defaults">
--no-defaults
</a>
</td>
<td>
Read no option files
</td>
</tr>
<tr>
<td>
<a class="link" href="option-file-options.html#option_general_no-login-paths">
--no-login-paths
</a>
</td>
<td>
Do not read options from login path file
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br class="table-break"/>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a name="option_general_defaults-extra-file">
</a>
<a class="link" href="option-file-options.html#option_general_defaults-extra-file">
<code class="option">
--defaults-extra-file=
<em class="replaceable">
<code>
file_name
</code>
</em>
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for defaults-extra-file">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--defaults-extra-file=filename
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
File name
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
[none]
</code>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045323850704">
</a>
<p>
Read this option file after the global option file but (on
Unix) before the user option file and (on all platforms)
before the login path file. (For information about the order
in which option files are used, see
<a class="xref" href="option-files.html" title="6.2.2.2 Using Option Files">
Section 6.2.2.2, “Using Option Files”
</a>
.) If the file does not exist
or is otherwise inaccessible, an error occurs. If
<em class="replaceable">
<code>
file_name
</code>
</em>
is not an absolute path
name, it is interpreted relative to the current directory.
</p>
<p>
See the introduction to this section regarding constraints
on the position in which this option may be specified.
</p>
</li>
<li class="listitem">
<p>
<a name="option_general_defaults-file">
</a>
<a class="link" href="option-file-options.html#option_general_defaults-file">
<code class="option">
--defaults-file=
<em class="replaceable">
<code>
file_name
</code>
</em>
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for defaults-file">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--defaults-file=filename
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
File name
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
[none]
</code>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045323834576">
</a>
<p>
Read only the given option file. If the file does not exist
or is otherwise inaccessible, an error occurs.
<em class="replaceable">
<code>
file_name
</code>
</em>
is interpreted relative
to the current directory if given as a relative path name
rather than a full path name.
</p>
<p>
Exceptions: Even with
<a class="link" href="option-file-options.html#option_general_defaults-file">
<code class="option">
--defaults-file
</code>
</a>
,
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
reads
<code class="filename">
mysqld-auto.cnf
</code>
and client programs
read
<code class="filename">
.mylogin.cnf
</code>
.
</p>
<p>
See the introduction to this section regarding constraints
on the position in which this option may be specified.
</p>
</li>
<li class="listitem">
<p>
<a name="option_general_defaults-group-suffix">
</a>
<a class="link" href="option-file-options.html#option_general_defaults-group-suffix">
<code class="option">
--defaults-group-suffix=
<em class="replaceable">
<code>
str
</code>
</em>
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for defaults-group-suffix">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--defaults-group-suffix=string
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
[none]
</code>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045323815216">
</a>
<p>
Read not only the usual option groups, but also groups with
the usual names and a suffix of
<em class="replaceable">
<code>
str
</code>
</em>
. For example, the
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
client normally reads the
<code class="literal">
[client]
</code>
and
<code class="literal">
[mysql]
</code>
groups. If this option is given as
<a class="link" href="option-file-options.html#option_general_defaults-group-suffix">
<code class="option">
--defaults-group-suffix=_other
</code>
</a>
,
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
also reads the
<code class="literal">
[client_other]
</code>
and
<code class="literal">
[mysql_other]
</code>
groups.
</p>
</li>
<li class="listitem">
<p>
<a name="option_general_login-path">
</a>
<a class="link" href="option-file-options.html#option_general_login-path">
<code class="option">
--login-path=
<em class="replaceable">
<code>
name
</code>
</em>
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for login-path">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--login-path=name
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
[none]
</code>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045323794304">
</a>
<p>
Read options from the named login path in the
<code class="filename">
.mylogin.cnf
</code>
login path file. A
<span class="quote">
“
<span class="quote">
login path
</span>
”
</span>
is an option group containing
options that specify which MySQL server to connect to and
which account to authenticate as. To create or modify a
login path file, use the
<a class="link" href="mysql-config-editor.html" title="6.6.7 mysql_config_editor — MySQL Configuration Utility">
<span class="command">
<strong>
mysql_config_editor
</strong>
</span>
</a>
utility. See
<a class="xref" href="mysql-config-editor.html" title="6.6.7 mysql_config_editor — MySQL Configuration Utility">
Section 6.6.7, “mysql_config_editor — MySQL Configuration Utility”
</a>
.
</p>
<p>
A client program reads the option group corresponding to the
named login path, in addition to option groups that the
program reads by default. Consider this command:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa27293409"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal">mysql <span class="token constant">--login-path</span><span class="token attr-value"><span class="token punctuation">=</span>mypath</span></code></pre>
</div>
<p>
By default, the
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
client reads the
<code class="literal">
[client]
</code>
and
<code class="literal">
[mysql]
</code>
option groups. So for the command shown,
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
reads
<code class="literal">
[client]
</code>
and
<code class="literal">
[mysql]
</code>
from other option files, and
<code class="literal">
[client]
</code>
,
<code class="literal">
[mysql]
</code>
, and
<code class="literal">
[mypath]
</code>
from the login path file.
</p>
<p>
Client programs read the login path file even when the
<a class="link" href="option-file-options.html#option_general_no-defaults">
<code class="option">
--no-defaults
</code>
</a>
option is
used, unless
<a class="link" href="option-file-options.html#option_general_no-login-paths">
<code class="option">
--no-login-paths
</code>
</a>
is set.
</p>
<a class="indexterm" name="idm46045323777312">
</a>
<a class="indexterm" name="idm46045323776208">
</a>
<p>
To specify an alternate login path file name, set the
<code class="literal">
MYSQL_TEST_LOGIN_FILE
</code>
environment
variable.
</p>
<p>
See the introduction to this section regarding constraints
on the position in which this option may be specified.
</p>
</li>
<li class="listitem">
<p>
<a name="option_general_no-login-paths">
</a>
<a class="link" href="option-file-options.html#option_general_no-login-paths">
<code class="option">
--no-login-paths
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for no-login-paths">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--no-login-paths
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
Boolean
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
false
</code>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045323760784">
</a>
<p>
Skips reading options from the login path file. Client
programs always read the login path file without this option
even when the
<a class="link" href="option-file-options.html#option_general_no-defaults">
<code class="option">
--no-defaults
</code>
</a>
option is used.
</p>
<p>
See
<a class="link" href="option-file-options.html#option_general_login-path">
<code class="option">
--login-path
</code>
</a>
for related
information.
</p>
<p>
See the introduction to this section regarding constraints
on the position in which this option may be specified.
</p>
</li>
<li class="listitem">
<p>
<a name="option_general_no-defaults">
</a>
<a class="link" href="option-file-options.html#option_general_no-defaults">
<code class="option">
--no-defaults
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for no-defaults">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--no-defaults
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
Boolean
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
false
</code>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045323744016">
</a>
<p>
Do not read any option files. If program startup fails due
to reading unknown options from an option file,
<a class="link" href="option-file-options.html#option_general_no-defaults">
<code class="option">
--no-defaults
</code>
</a>
can be used to
prevent them from being read.
</p>
<p>
The exception is that client programs read the
<code class="filename">
.mylogin.cnf
</code>
login path file, if it
exists, even when
<a class="link" href="option-file-options.html#option_general_no-defaults">
<code class="option">
--no-defaults
</code>
</a>
is used unless
<a class="link" href="option-file-options.html#option_general_no-login-paths">
<code class="option">
--no-login-paths
</code>
</a>
is set.
This permits passwords to be specified in a safer way than
on the command line even if
<a class="link" href="option-file-options.html#option_general_no-defaults">
<code class="option">
--no-defaults
</code>
</a>
is present. To
create
<code class="filename">
.mylogin.cnf
</code>
, use the
<a class="link" href="mysql-config-editor.html" title="6.6.7 mysql_config_editor — MySQL Configuration Utility">
<span class="command">
<strong>
mysql_config_editor
</strong>
</span>
</a>
utility. See
<a class="xref" href="mysql-config-editor.html" title="6.6.7 mysql_config_editor — MySQL Configuration Utility">
Section 6.6.7, “mysql_config_editor — MySQL Configuration Utility”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_general_print-defaults">
</a>
<a class="link" href="option-file-options.html#option_general_print-defaults">
<code class="option">
--print-defaults
</code>
</a>
</p>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for print-defaults">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--print-defaults
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
Boolean
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
false
</code>
</td>
</tr>
</tbody>
</table>
</div>
<a class="indexterm" name="idm46045323722144">
</a>
<p>
Print the program name and all options that it gets from
option files. Password values are masked.
</p>
<p>
See the introduction to this section regarding constraints
on the position in which this option may be specified.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/performance-schema-performance-timers-table.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="performance-schema-performance-timers-table">
</a>
29.12.22.6 The performance_timers Table
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045067404608">
</a>
<a class="indexterm" name="idm46045067403104">
</a>
<p>
The
<a class="link" href="performance-schema-performance-timers-table.html" title="29.12.22.6 The performance_timers Table">
<code class="literal">
performance_timers
</code>
</a>
table
shows which event timers are available:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa34080340"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> performance_schema<span class="token punctuation">.</span>performance_timers<span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> TIMER_NAME <span class="token punctuation">|</span> TIMER_FREQUENCY <span class="token punctuation">|</span> TIMER_RESOLUTION <span class="token punctuation">|</span> TIMER_OVERHEAD <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> CYCLE <span class="token punctuation">|</span> 2389029850 <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> 72 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> NANOSECOND <span class="token punctuation">|</span> 1000000000 <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> 112 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> MICROSECOND <span class="token punctuation">|</span> 1000000 <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> 136 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> MILLISECOND <span class="token punctuation">|</span> 1036 <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> 168 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> THREAD_CPU <span class="token punctuation">|</span> 339101694 <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> 798 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
<p>
If the values associated with a given timer name are
<code class="literal">
NULL
</code>
, that timer is not supported on your
platform. For an explanation of how event timing occurs, see
<a class="xref" href="performance-schema-timing.html" title="29.4.1 Performance Schema Event Timing">
Section 29.4.1, “Performance Schema Event Timing”
</a>
.
</p>
<p>
The
<a class="link" href="performance-schema-performance-timers-table.html" title="29.12.22.6 The performance_timers Table">
<code class="literal">
performance_timers
</code>
</a>
table has
these columns:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
TIMER_NAME
</code>
</p>
<p>
The timer name.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
TIMER_FREQUENCY
</code>
</p>
<p>
The number of timer units per second. For a cycle timer,
the frequency is generally related to the CPU speed. For
example, on a system with a 2.4GHz processor, the
<code class="literal">
CYCLE
</code>
may be close to 2400000000.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
TIMER_RESOLUTION
</code>
</p>
<p>
Indicates the number of timer units by which timer values
increase. If a timer has a resolution of 10, its value
increases by 10 each time.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
TIMER_OVERHEAD
</code>
</p>
<p>
The minimal number of cycles of overhead to obtain one
timing with the given timer. The Performance Schema
determines this value by invoking the timer 20 times
during initialization and picking the smallest value. The
total overhead really is twice this amount because the
instrumentation invokes the timer at the start and end of
each event. The timer code is called only for timed
events, so this overhead does not apply for nontimed
events.
</p>
</li>
</ul>
</div>
<p>
The
<a class="link" href="performance-schema-performance-timers-table.html" title="29.12.22.6 The performance_timers Table">
<code class="literal">
performance_timers
</code>
</a>
table has
no indexes.
</p>
<p>
<a class="link" href="truncate-table.html" title="15.1.37 TRUNCATE TABLE Statement">
<code class="literal">
TRUNCATE TABLE
</code>
</a>
is not permitted
for the
<a class="link" href="performance-schema-performance-timers-table.html" title="29.12.22.6 The performance_timers Table">
<code class="literal">
performance_timers
</code>
</a>
table.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/myisam-table-maintenance.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title">
<a name="myisam-table-maintenance">
</a>
9.6 MyISAM Table Maintenance and Crash Recovery
</h2>
</div>
</div>
</div>
<div class="toc">
<dl class="toc">
<dt>
<span class="section">
<a href="myisam-crash-recovery.html">
9.6.1 Using myisamchk for Crash Recovery
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="myisam-check.html">
9.6.2 How to Check MyISAM Tables for Errors
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="myisam-repair.html">
9.6.3 How to Repair MyISAM Tables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="myisam-optimization.html">
9.6.4 MyISAM Table Optimization
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="myisam-maintenance-schedule.html">
9.6.5 Setting Up a MyISAM Table Maintenance Schedule
</a>
</span>
</dt>
</dl>
</div>
<p>
This section discusses how to use
<a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
<span class="command">
<strong>
myisamchk
</strong>
</span>
</a>
to
check or repair
<code class="literal">
MyISAM
</code>
tables (tables that have
<code class="filename">
.MYD
</code>
and
<code class="filename">
.MYI
</code>
files for
storing data and indexes). For general
<a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
<span class="command">
<strong>
myisamchk
</strong>
</span>
</a>
background, see
<a class="xref" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
Section 6.6.4, “myisamchk — MyISAM Table-Maintenance Utility”
</a>
. Other table-repair information can be
found at
<a class="xref" href="rebuilding-tables.html" title="3.14 Rebuilding or Repairing Tables or Indexes">
Section 3.14, “Rebuilding or Repairing Tables or Indexes”
</a>
.
</p>
<p>
You can use
<a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
<span class="command">
<strong>
myisamchk
</strong>
</span>
</a>
to check, repair, or
optimize database tables. The following sections describe how to
perform these operations and how to set up a table maintenance
schedule. For information about using
<a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
<span class="command">
<strong>
myisamchk
</strong>
</span>
</a>
to get information about your tables, see
<a class="xref" href="myisamchk-table-info.html" title="6.6.4.5 Obtaining Table Information with myisamchk">
Section 6.6.4.5, “Obtaining Table Information with myisamchk”
</a>
.
</p>
<p>
Even though table repair with
<a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
<span class="command">
<strong>
myisamchk
</strong>
</span>
</a>
is
quite secure, it is always a good idea to make a backup
<span class="emphasis">
<em>
before
</em>
</span>
doing a repair or any maintenance
operation that could make a lot of changes to a table.
</p>
<p>
<a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
<span class="command">
<strong>
myisamchk
</strong>
</span>
</a>
operations that affect indexes can
cause
<code class="literal">
MyISAM
</code>
<code class="literal">
FULLTEXT
</code>
indexes to be rebuilt with full-text parameters that are
incompatible with the values used by the MySQL server. To avoid
this problem, follow the guidelines in
<a class="xref" href="myisamchk-general-options.html" title="6.6.4.1 myisamchk General Options">
Section 6.6.4.1, “myisamchk General Options”
</a>
.
</p>
<p>
<code class="literal">
MyISAM
</code>
table maintenance can also be done using
the SQL statements that perform operations similar to what
<a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
<span class="command">
<strong>
myisamchk
</strong>
</span>
</a>
can do:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
To check
<code class="literal">
MyISAM
</code>
tables, use
<a class="link" href="check-table.html" title="15.7.3.2 CHECK TABLE Statement">
<code class="literal">
CHECK TABLE
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
To repair
<code class="literal">
MyISAM
</code>
tables, use
<a class="link" href="repair-table.html" title="15.7.3.5 REPAIR TABLE Statement">
<code class="literal">
REPAIR TABLE
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
To optimize
<code class="literal">
MyISAM
</code>
tables, use
<a class="link" href="optimize-table.html" title="15.7.3.4 OPTIMIZE TABLE Statement">
<code class="literal">
OPTIMIZE TABLE
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
To analyze
<code class="literal">
MyISAM
</code>
tables, use
<a class="link" href="analyze-table.html" title="15.7.3.1 ANALYZE TABLE Statement">
<code class="literal">
ANALYZE TABLE
</code>
</a>
.
</p>
</li>
</ul>
</div>
<p>
For additional information about these statements, see
<a class="xref" href="table-maintenance-statements.html" title="15.7.3 Table Maintenance Statements">
Section 15.7.3, “Table Maintenance Statements”
</a>
.
</p>
<p>
These statements can be used directly or by means of the
<a class="link" href="mysqlcheck.html" title="6.5.3 mysqlcheck — A Table Maintenance Program">
<span class="command">
<strong>
mysqlcheck
</strong>
</span>
</a>
client program. One advantage of
these statements over
<a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
<span class="command">
<strong>
myisamchk
</strong>
</span>
</a>
is that the
server does all the work. With
<a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
<span class="command">
<strong>
myisamchk
</strong>
</span>
</a>
, you
must make sure that the server does not use the tables at the same
time so that there is no unwanted interaction between
<a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
<span class="command">
<strong>
myisamchk
</strong>
</span>
</a>
and the server.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/linux-installation.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title">
<a name="linux-installation">
</a>
2.5 Installing MySQL on Linux
</h2>
</div>
</div>
</div>
<div class="toc">
<dl class="toc">
<dt>
<span class="section">
<a href="linux-installation-yum-repo.html">
2.5.1 Installing MySQL on Linux Using the MySQL Yum Repository
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="linux-installation-apt-repo.html">
2.5.2 Installing MySQL on Linux Using the MySQL APT Repository
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="linux-installation-sles-repo.html">
2.5.3 Using the MySQL SLES Repository
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="linux-installation-rpm.html">
2.5.4 Installing MySQL on Linux Using RPM Packages from Oracle
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="linux-installation-debian.html">
2.5.5 Installing MySQL on Linux Using Debian Packages from Oracle
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="linux-installation-docker.html">
2.5.6 Deploying MySQL on Linux with Docker Containers
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="linux-installation-native.html">
2.5.7 Installing MySQL on Linux from the Native Software Repositories
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="linux-installation-juju.html">
2.5.8 Installing MySQL on Linux with Juju
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="using-systemd.html">
2.5.9 Managing MySQL Server with systemd
</a>
</span>
</dt>
</dl>
</div>
<p>
Linux supports a number of different solutions for installing MySQL.
We recommend that you use one of the distributions from Oracle, for
which several methods for installation are available:
</p>
<div class="table">
<a name="linux-installation-methods">
</a>
<p class="title">
<b>
Table 2.7 Linux Installation Methods and Information
</b>
</p>
<div class="table-contents">
<table>
<colgroup>
<col style="width: 30%"/>
<col style="width: 30%"/>
<col style="width: 40%"/>
</colgroup>
<thead>
<tr>
<th scope="col">
Type
</th>
<th scope="col">
Setup Method
</th>
<th scope="col">
Additional Information
</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">
Apt
</th>
<td>
Enable the
<a class="ulink" href="https://dev.mysql.com/downloads/repo/apt/" target="_top">
MySQL Apt
repository
</a>
</td>
<td>
<a class="link" href="linux-installation-apt-repo.html" title="2.5.2 Installing MySQL on Linux Using the MySQL APT Repository">
Documentation
</a>
</td>
</tr>
<tr>
<th scope="row">
Yum
</th>
<td>
Enable the
<a class="ulink" href="https://dev.mysql.com/downloads/repo/yum/" target="_top">
MySQL Yum
repository
</a>
</td>
<td>
<a class="link" href="linux-installation-yum-repo.html" title="2.5.1 Installing MySQL on Linux Using the MySQL Yum Repository">
Documentation
</a>
</td>
</tr>
<tr>
<th scope="row">
Zypper
</th>
<td>
Enable the
<a class="ulink" href="https://dev.mysql.com/downloads/repo/suse/" target="_top">
MySQL SLES
repository
</a>
</td>
<td>
<a class="link" href="linux-installation-sles-repo.html" title="2.5.3 Using the MySQL SLES Repository">
Documentation
</a>
</td>
</tr>
<tr>
<th scope="row">
RPM
</th>
<td>
<a class="ulink" href="https://dev.mysql.com/downloads/mysql/" target="_top">
Download
</a>
a specific
package
</td>
<td>
<a class="link" href="linux-installation-rpm.html" title="2.5.4 Installing MySQL on Linux Using RPM Packages from Oracle">
Documentation
</a>
</td>
</tr>
<tr>
<th scope="row">
DEB
</th>
<td>
<a class="ulink" href="https://dev.mysql.com/downloads/mysql/" target="_top">
Download
</a>
a specific
package
</td>
<td>
<a class="link" href="linux-installation-debian.html" title="2.5.5 Installing MySQL on Linux Using Debian Packages from Oracle">
Documentation
</a>
</td>
</tr>
<tr>
<th scope="row">
Generic
</th>
<td>
<a class="ulink" href="https://dev.mysql.com/downloads/mysql/" target="_top">
Download
</a>
a generic
package
</td>
<td>
<a class="link" href="binary-installation.html" title="2.2 Installing MySQL on Unix/Linux Using Generic Binaries">
Documentation
</a>
</td>
</tr>
<tr>
<th scope="row">
Source
</th>
<td>
Compile from
<a class="ulink" href="https://dev.mysql.com/downloads/mysql/" target="_top">
source
</a>
</td>
<td>
<a class="link" href="source-installation.html" title="2.8 Installing MySQL from Source">
Documentation
</a>
</td>
</tr>
<tr>
<th scope="row">
Docker
</th>
<td>
Use the
<a class="ulink" href="https://container-registry.oracle.com/" target="_blank">
Oracle
Container Registry
</a>
. You can also use
<a class="ulink" href="https://support.oracle.com/" target="_blank">
My Oracle
Support
</a>
for the MySQL Enterprise Edition.
</td>
<td>
<a class="link" href="linux-installation-docker.html" title="2.5.6 Deploying MySQL on Linux with Docker Containers">
Documentation
</a>
</td>
</tr>
<tr>
<th scope="row">
Oracle Unbreakable Linux Network
</th>
<td>
Use ULN channels
</td>
<td>
<a class="link" href="uln-installation.html" title="2.6 Installing MySQL Using Unbreakable Linux Network (ULN)">
Documentation
</a>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br class="table-break"/>
<p>
As an alternative, you can use the package manager on your system to
automatically download and install MySQL with packages from the
native software repositories of your Linux distribution. These
native packages are often several versions behind the currently
available release. You are also normally unable to install
innovation releases, since these are not usually made available in
the native repositories. For more information on using the native
package installers, see
<a class="xref" href="linux-installation-native.html" title="2.5.7 Installing MySQL on Linux from the Native Software Repositories">
Section 2.5.7, “Installing MySQL on Linux from the Native Software Repositories”
</a>
.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
For many Linux installations, you want to set up MySQL to be
started automatically when your machine starts. Many of the native
package installations perform this operation for you, but for
source, binary and RPM solutions you may need to set this up
separately. The required script,
<a class="link" href="mysql-server.html" title="6.3.3 mysql.server — MySQL Server Startup Script">
<span class="command">
<strong>
mysql.server
</strong>
</span>
</a>
,
can be found in the
<code class="filename">
support-files
</code>
directory
under the MySQL installation directory or in a MySQL source tree.
You can install it as
<code class="filename">
/etc/init.d/mysql
</code>
for
automatic MySQL startup and shutdown. See
<a class="xref" href="mysql-server.html" title="6.3.3 mysql.server — MySQL Server Startup Script">
Section 6.3.3, “mysql.server — MySQL Server Startup Script”
</a>
.
</p>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/replication-notes.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title">
<a name="replication-notes">
</a>
19.5 Replication Notes and Tips
</h2>
</div>
</div>
</div>
<div class="toc">
<dl class="toc">
<dt>
<span class="section">
<a href="replication-features.html">
19.5.1 Replication Features and Issues
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="replication-compatibility.html">
19.5.2 Replication Compatibility Between MySQL Versions
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="replication-upgrade.html">
19.5.3 Upgrading or Downgrading a Replication Topology
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="replication-problems.html">
19.5.4 Troubleshooting Replication
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="replication-bugs.html">
19.5.5 How to Report Replication Bugs or Problems
</a>
</span>
</dt>
</dl>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/innodb-redo-log-buffer.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="innodb-redo-log-buffer">
</a>
17.5.4 Log Buffer
</h3>
</div>
</div>
</div>
<p>
The log buffer is the memory area that holds data to be written to
the log files on disk. Log buffer size is defined by the
<a class="link" href="innodb-parameters.html#sysvar_innodb_log_buffer_size">
<code class="literal">
innodb_log_buffer_size
</code>
</a>
variable.
The default size is 64MB. The contents of the log buffer are
periodically flushed to disk. A large log buffer enables large
transactions to run without the need to write redo log data to
disk before the transactions commit. Thus, if you have
transactions that update, insert, or delete many rows, increasing
the size of the log buffer saves disk I/O.
</p>
<p>
The
<a class="link" href="innodb-parameters.html#sysvar_innodb_flush_log_at_trx_commit">
<code class="literal">
innodb_flush_log_at_trx_commit
</code>
</a>
variable controls how the contents of the log buffer are written
and flushed to disk. The
<a class="link" href="innodb-parameters.html#sysvar_innodb_flush_log_at_timeout">
<code class="literal">
innodb_flush_log_at_timeout
</code>
</a>
variable controls log flushing frequency.
</p>
<p>
For related information, see
<a class="xref" href="innodb-init-startup-configuration.html#innodb-startup-memory-configuration" title="Memory Configuration">
Memory Configuration
</a>
, and
<a class="xref" href="optimizing-innodb-logging.html" title="10.5.4 Optimizing InnoDB Redo Logging">
Section 10.5.4, “Optimizing InnoDB Redo Logging”
</a>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/binary-log-mysql-database.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="binary-log-mysql-database">
</a>
7.4.4.4 Logging Format for Changes to mysql Database Tables
</h4>
</div>
</div>
</div>
<p>
The contents of the grant tables in the
<code class="literal">
mysql
</code>
database can be modified directly (for example, with
<a class="link" href="insert.html" title="15.2.7 INSERT Statement">
<code class="literal">
INSERT
</code>
</a>
or
<a class="link" href="delete.html" title="15.2.2 DELETE Statement">
<code class="literal">
DELETE
</code>
</a>
) or indirectly (for
example, with
<a class="link" href="grant.html" title="15.7.1.6 GRANT Statement">
<code class="literal">
GRANT
</code>
</a>
or
<a class="link" href="create-user.html" title="15.7.1.3 CREATE USER Statement">
<code class="literal">
CREATE USER
</code>
</a>
). Statements that
affect
<code class="literal">
mysql
</code>
database tables are written to
the binary log using the following rules:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Data manipulation statements that change data in
<code class="literal">
mysql
</code>
database tables directly are logged
according to the setting of the
<a class="link" href="replication-options-binary-log.html#sysvar_binlog_format">
<code class="literal">
binlog_format
</code>
</a>
system
variable. This pertains to statements such as
<a class="link" href="insert.html" title="15.2.7 INSERT Statement">
<code class="literal">
INSERT
</code>
</a>
,
<a class="link" href="update.html" title="15.2.17 UPDATE Statement">
<code class="literal">
UPDATE
</code>
</a>
,
<a class="link" href="delete.html" title="15.2.2 DELETE Statement">
<code class="literal">
DELETE
</code>
</a>
,
<a class="link" href="replace.html" title="15.2.12 REPLACE Statement">
<code class="literal">
REPLACE
</code>
</a>
,
<a class="link" href="do.html" title="15.2.3 DO Statement">
<code class="literal">
DO
</code>
</a>
,
<a class="link" href="load-data.html" title="15.2.9 LOAD DATA Statement">
<code class="literal">
LOAD
DATA
</code>
</a>
,
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
, and
<a class="link" href="truncate-table.html" title="15.1.37 TRUNCATE TABLE Statement">
<code class="literal">
TRUNCATE TABLE
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
Statements that change the
<code class="literal">
mysql
</code>
database
indirectly are logged as statements regardless of the value
of
<a class="link" href="replication-options-binary-log.html#sysvar_binlog_format">
<code class="literal">
binlog_format
</code>
</a>
. This
pertains to statements such as
<a class="link" href="grant.html" title="15.7.1.6 GRANT Statement">
<code class="literal">
GRANT
</code>
</a>
,
<a class="link" href="revoke.html" title="15.7.1.8 REVOKE Statement">
<code class="literal">
REVOKE
</code>
</a>
,
<a class="link" href="set-password.html" title="15.7.1.10 SET PASSWORD Statement">
<code class="literal">
SET PASSWORD
</code>
</a>
,
<a class="link" href="rename-user.html" title="15.7.1.7 RENAME USER Statement">
<code class="literal">
RENAME USER
</code>
</a>
,
<code class="literal">
CREATE
</code>
(all forms except
<a class="link" href="create-table.html" title="15.1.20 CREATE TABLE Statement">
<code class="literal">
CREATE TABLE
... SELECT
</code>
</a>
),
<code class="literal">
ALTER
</code>
(all forms),
and
<code class="literal">
DROP
</code>
(all forms).
</p>
</li>
</ul>
</div>
<p>
<a class="link" href="create-table.html" title="15.1.20 CREATE TABLE Statement">
<code class="literal">
CREATE TABLE ...
SELECT
</code>
</a>
is a combination of data definition and data
manipulation. The
<a class="link" href="create-table.html" title="15.1.20 CREATE TABLE Statement">
<code class="literal">
CREATE TABLE
</code>
</a>
part is logged using statement format and the
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
part is logged according
to the value of
<a class="link" href="replication-options-binary-log.html#sysvar_binlog_format">
<code class="literal">
binlog_format
</code>
</a>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/apis-eiffel.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title">
<a name="apis-eiffel">
</a>
31.13 MySQL Eiffel Wrapper
</h2>
</div>
</div>
</div>
<a class="indexterm" name="idm46045060278464">
</a>
<a class="indexterm" name="idm46045060277424">
</a>
<p>
Eiffel MySQL is an interface to the MySQL database server using the
<a class="ulink" href="http://en.wikipedia.org/wiki/Eiffel_(programming_language)" target="_blank">
Eiffel
programming language
</a>
, written by Michael Ravits. It can be
found at
<a class="ulink" href="http://efsa.sourceforge.net/archive/ravits/mysql.htm" target="_blank">
http://efsa.sourceforge.net/archive/ravits/mysql.htm
</a>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/data-masking-component-function-reference.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="data-masking-component-function-reference">
</a>
8.5.2.3 MySQL Enterprise Data Masking and De-Identification Component Function Reference
</h4>
</div>
</div>
</div>
<div class="table">
<a name="idm46045233140832">
</a>
<p class="title">
<b>
Table 8.46 MySQL Enterprise Data Masking and De-Identification Component Functions
</b>
</p>
<div class="table-contents">
<table frame="box" rules="all" summary="A reference that lists MySQL Enterprise Data Masking and De-Identification functions.">
<colgroup>
<col style="width: 28%"/>
<col style="width: 71%"/>
</colgroup>
<thead>
<tr>
<th>
Name
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a class="link" href="data-masking-component-functions.html#function_gen-blocklist">
<code class="literal">
gen_blocklist()
</code>
</a>
</td>
<td>
Perform dictionary term replacement
</td>
</tr>
<tr>
<td>
<a class="link" href="data-masking-component-functions.html#function_gen-dictionary">
<code class="literal">
gen_dictionary()
</code>
</a>
</td>
<td>
Return random term from dictionary
</td>
</tr>
<tr>
<td>
<a class="link" href="data-masking-component-functions.html#function_gen-range">
<code class="literal">
gen_range()
</code>
</a>
</td>
<td>
Generate random number within range
</td>
</tr>
<tr>
<td>
<a class="link" href="data-masking-component-functions.html#function_gen-rnd-canada-sin">
<code class="literal">
gen_rnd_canada_sin()
</code>
</a>
</td>
<td>
Generate random Canada Social Insurance Number
</td>
</tr>
<tr>
<td>
<a class="link" href="data-masking-component-functions.html#function_gen-rnd-email">
<code class="literal">
gen_rnd_email()
</code>
</a>
</td>
<td>
Generate random email address
</td>
</tr>
<tr>
<td>
<a class="link" href="data-masking-component-functions.html#function_gen-rnd-iban">
<code class="literal">
gen_rnd_iban()
</code>
</a>
</td>
<td>
Generate random International Bank Account Number
</td>
</tr>
<tr>
<td>
<a class="link" href="data-masking-component-functions.html#function_gen-rnd-pan">
<code class="literal">
gen_rnd_pan()
</code>
</a>
</td>
<td>
Generate random payment card Primary Account Number
</td>
</tr>
<tr>
<td>
<a class="link" href="data-masking-component-functions.html#function_gen-rnd-ssn">
<code class="literal">
gen_rnd_ssn()
</code>
</a>
</td>
<td>
Generate random US Social Security Number
</td>
</tr>
<tr>
<td>
<a class="link" href="data-masking-component-functions.html#function_gen-rnd-uk-nin">
<code class="literal">
gen_rnd_uk_nin()
</code>
</a>
</td>
<td>
Generate random United Kingdom National Insurance Number
</td>
</tr>
<tr>
<td>
<a class="link" href="data-masking-component-functions.html#function_gen-rnd-us-phone">
<code class="literal">
gen_rnd_us_phone()
</code>
</a>
</td>
<td>
Generate random US phone number
</td>
</tr>
<tr>
<td>
<a class="link" href="data-masking-component-functions.html#function_gen-rnd-uuid">
<code class="literal">
gen_rnd_uuid()
</code>
</a>
</td>
<td>
Generate random Universally Unique Identifier
</td>
</tr>
<tr>
<td>
<a class="link" href="data-masking-component-functions.html#function_mask-canada-sin">
<code class="literal">
mask_canada_sin()
</code>
</a>
</td>
<td>
Mask Canada Social Insurance Number
</td>
</tr>
<tr>
<td>
<a class="link" href="data-masking-component-functions.html#function_mask-iban">
<code class="literal">
mask_iban()
</code>
</a>
</td>
<td>
Mask International Bank Account Number
</td>
</tr>
<tr>
<td>
<a class="link" href="data-masking-component-functions.html#function_mask-inner">
<code class="literal">
mask_inner()
</code>
</a>
</td>
<td>
Mask interior part of string
</td>
</tr>
<tr>
<td>
<a class="link" href="data-masking-component-functions.html#function_mask-outer">
<code class="literal">
mask_outer()
</code>
</a>
</td>
<td>
Mask left and right parts of string
</td>
</tr>
<tr>
<td>
<a class="link" href="data-masking-component-functions.html#function_mask-pan">
<code class="literal">
mask_pan()
</code>
</a>
</td>
<td>
Mask payment card Primary Account Number part of string
</td>
</tr>
<tr>
<td>
<a class="link" href="data-masking-component-functions.html#function_mask-pan-relaxed">
<code class="literal">
mask_pan_relaxed()
</code>
</a>
</td>
<td>
Mask payment card Primary Account Number part of string
</td>
</tr>
<tr>
<td>
<a class="link" href="data-masking-component-functions.html#function_mask-ssn">
<code class="literal">
mask_ssn()
</code>
</a>
</td>
<td>
Mask US Social Security Number
</td>
</tr>
<tr>
<td>
<a class="link" href="data-masking-component-functions.html#function_mask-uk-nin">
<code class="literal">
mask_uk_nin()
</code>
</a>
</td>
<td>
Mask United Kingdom National Insurance Number
</td>
</tr>
<tr>
<td>
<a class="link" href="data-masking-component-functions.html#function_mask-uuid">
<code class="literal">
mask_uuid()
</code>
</a>
</td>
<td>
Mask Universally Unique Identifier part of string
</td>
</tr>
<tr>
<td>
<a class="link" href="data-masking-component-functions.html#function_masking-dictionaries-flush">
<code class="literal">
masking_dictionaries_flush()
</code>
</a>
</td>
<td>
Cause masking_dictionaries cache to be reloaded from table
</td>
</tr>
<tr>
<td>
<a class="link" href="data-masking-component-functions.html#function_masking-dictionary-remove">
<code class="literal">
masking_dictionary_remove()
</code>
</a>
</td>
<td>
Remove dictionary from the database table
</td>
</tr>
<tr>
<td>
<a class="link" href="data-masking-component-functions.html#function_masking-dictionary-term-add">
<code class="literal">
masking_dictionary_term_add()
</code>
</a>
</td>
<td>
Add new term to the dictionary
</td>
</tr>
<tr>
<td>
<a class="link" href="data-masking-component-functions.html#function_masking-dictionary-term-remove">
<code class="literal">
masking_dictionary_term_remove()
</code>
</a>
</td>
<td>
Remove existing term from the dictionary
</td>
</tr>
</tbody>
</table>
</div>
<div class="table-contents">
<table cellpadding="0" cellspacing="0" style="position: fixed; top: 0px; display: none; left: 401px; width: 739px;">
<thead>
<tr>
<th style="width: 267.016px;">
Name
</th>
<th style="width: 470.984px;">
Description
</th>
</tr>
</thead>
</table>
</div>
</div>
<br class="table-break"/>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/partitioning-limitations-storage-engines.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="partitioning-limitations-storage-engines">
</a>
26.6.2 Partitioning Limitations Relating to Storage Engines
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045082767472">
</a>
<p>
In MySQL 8.4, partitioning support is not actually
provided by the MySQL Server, but rather by a table storage
engine's own or native partitioning handler. In MySQL
8.4, only the
<a class="link" href="innodb-storage-engine.html" title="Chapter 17 The InnoDB Storage Engine">
<code class="literal">
InnoDB
</code>
</a>
and
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
storage engines provide
native partitioning handlers. This means that partitioned tables
cannot be created using any other storage engine than these.
(You must be using MySQL NDB Cluster with the
<code class="literal">
NDB
</code>
storage engine to create
<code class="literal">
NDB
</code>
tables.)
</p>
<p>
<a name="partitioning-limitations-innodb">
</a>
<b>
InnoDB storage engine.
</b>
<a class="link" href="innodb-storage-engine.html" title="Chapter 17 The InnoDB Storage Engine">
<code class="literal">
InnoDB
</code>
</a>
foreign keys and MySQL
partitioning are not compatible. Partitioned
<code class="literal">
InnoDB
</code>
tables cannot have foreign key
references, nor can they have columns referenced by foreign
keys.
<code class="literal">
InnoDB
</code>
tables which have or which are
referenced by foreign keys cannot be partitioned.
</p>
<p>
<a class="link" href="alter-table-partition-operations.html" title="15.1.9.1 ALTER TABLE Partition Operations">
<code class="literal">
ALTER
TABLE ... OPTIMIZE PARTITION
</code>
</a>
does not work correctly
with partitioned tables that use
<code class="literal">
InnoDB
</code>
. Use
<code class="literal">
ALTER TABLE ... REBUILD PARTITION
</code>
and
<code class="literal">
ALTER TABLE ... ANALYZE PARTITION
</code>
, instead,
for such tables. For more information, see
<a class="xref" href="alter-table-partition-operations.html" title="15.1.9.1 ALTER TABLE Partition Operations">
Section 15.1.9.1, “ALTER TABLE Partition Operations”
</a>
.
</p>
<p>
<a name="partitioning-limitations-ndb">
</a>
<b>
User-defined partitioning and the NDB storage engine (NDB Cluster).
</b>
Partitioning by
<code class="literal">
KEY
</code>
(including
<code class="literal">
LINEAR KEY
</code>
) is the only type of
partitioning supported for the
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
storage engine. It is not
possible under normal circumstances in NDB Cluster to create
an NDB Cluster table using any partitioning type other than
[
<code class="literal">
LINEAR
</code>
]
<code class="literal">
KEY
</code>
, and
attempting to do so fails with an error.
</p>
<p>
The maximum number of partitions that can be defined for an
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
table depends on the number of
data nodes and node groups in the cluster, the version of the
NDB Cluster software in use, and other factors. See
<a class="xref" href="mysql-cluster-nodes-groups.html#mysql-cluster-nodes-groups-user-partitioning" title="NDB and user-defined partitioning">
NDB and user-defined partitioning
</a>
,
for more information.
</p>
<p>
The maximum amount of fixed-size data that can be stored per
partition in an
<code class="literal">
NDB
</code>
table is 128 TB.
Previously, this was 16 GB.
</p>
<p>
<a class="link" href="create-table.html" title="15.1.20 CREATE TABLE Statement">
<code class="literal">
CREATE TABLE
</code>
</a>
and
<a class="link" href="alter-table-partition-operations.html" title="15.1.9.1 ALTER TABLE Partition Operations">
<code class="literal">
ALTER
TABLE
</code>
</a>
statements that would cause a user-partitioned
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
table not to meet either or
both of the following two requirements are not permitted, and
fail with an error:
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
The table must have an explicit primary key.
</p>
</li>
<li class="listitem">
<p>
All columns listed in the table's partitioning
expression must be part of the primary key.
</p>
</li>
</ol>
</div>
<p>
<b>
Exception.
</b>
If a user-partitioned
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
table
is created using an empty column-list (that is, using
<code class="literal">
PARTITION BY KEY()
</code>
or
<code class="literal">
PARTITION BY
LINEAR KEY()
</code>
), then no explicit primary key is
required.
</p>
<p>
<b>
Partition selection.
</b>
Partition selection is not supported for
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
tables. See
<a class="xref" href="partitioning-selection.html" title="26.5 Partition Selection">
Section 26.5, “Partition Selection”
</a>
, for more
information.
</p>
<p>
<b>
Upgrading partitioned tables.
</b>
When performing an upgrade, tables which are partitioned by
<code class="literal">
KEY
</code>
must be dumped and reloaded.
</p>
<p>
For information about converting
<code class="literal">
MyISAM
</code>
tables to
<code class="literal">
InnoDB
</code>
, see
<a class="xref" href="converting-tables-to-innodb.html" title="17.6.1.5 Converting Tables from MyISAM to InnoDB">
Section 17.6.1.5, “Converting Tables from MyISAM to InnoDB”
</a>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/invoking-programs.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="invoking-programs">
</a>
6.2.1 Invoking MySQL Programs
</h3>
</div>
</div>
</div>
<p>
To invoke a MySQL program from the command line (that is, from
your shell or command prompt), enter the program name followed by
any options or other arguments needed to instruct the program what
you want it to do. The following commands show some sample program
invocations.
<code class="literal">
$>
</code>
represents the prompt for
your command interpreter; it is not part of what you type. The
particular prompt you see depends on your command interpreter.
Typical prompts are
<code class="literal">
$
</code>
for
<span class="command">
<strong>
sh
</strong>
</span>
,
<span class="command">
<strong>
ksh
</strong>
</span>
, or
<span class="command">
<strong>
bash
</strong>
</span>
,
<code class="literal">
%
</code>
for
<span class="command">
<strong>
csh
</strong>
</span>
or
<span class="command">
<strong>
tcsh
</strong>
</span>
, and
<code class="literal">
C:\>
</code>
for the Windows
<span class="command">
<strong>
command.com
</strong>
</span>
or
<span class="command">
<strong>
cmd.exe
</strong>
</span>
command interpreters.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa69550990"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">mysql</span> <span class="token constant">--user</span><span class="token attr-value"><span class="token punctuation">=</span>root</span> test
<span class="token prompt">$> </span><span class="token command">mysqladmin</span> extended-status variables
<span class="token prompt">$> </span><span class="token command">mysqlshow</span> <span class="token property">--help</span>
<span class="token prompt">$> </span><span class="token command">mysqldump</span> <span class="token property">-u</span> root personnel</code></pre>
</div>
<p>
Arguments that begin with a single or double dash
(
<code class="literal">
-
</code>
,
<code class="literal">
--
</code>
) specify program
options. Options typically indicate the type of connection a
program should make to the server or affect its operational mode.
Option syntax is described in
<a class="xref" href="program-options.html" title="6.2.2 Specifying Program Options">
Section 6.2.2, “Specifying Program Options”
</a>
.
</p>
<p>
Nonoption arguments (arguments with no leading dash) provide
additional information to the program. For example, the
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
program interprets the first nonoption
argument as a database name, so the command
<code class="literal">
mysql
--user=root test
</code>
indicates that you want to use the
<code class="literal">
test
</code>
database.
</p>
<p>
Later sections that describe individual programs indicate which
options a program supports and describe the meaning of any
additional nonoption arguments.
</p>
<p>
Some options are common to a number of programs. The most
frequently used of these are the
<a class="link" href="connection-options.html#option_general_host">
<code class="option">
--host
</code>
</a>
(or
<code class="option">
-h
</code>
),
<a class="link" href="connection-options.html#option_general_user">
<code class="option">
--user
</code>
</a>
(or
<code class="option">
-u
</code>
),
and
<a class="link" href="connection-options.html#option_general_password">
<code class="option">
--password
</code>
</a>
(or
<code class="option">
-p
</code>
) options that specify connection parameters.
They indicate the host where the MySQL server is running, and the
user name and password of your MySQL account. All MySQL client
programs understand these options; they enable you to specify
which server to connect to and the account to use on that server.
Other connection options are
<a class="link" href="connection-options.html#option_general_port">
<code class="option">
--port
</code>
</a>
(or
<code class="option">
-P
</code>
) to
specify a TCP/IP port number and
<a class="link" href="connection-options.html#option_general_socket">
<code class="option">
--socket
</code>
</a>
(or
<code class="option">
-S
</code>
)
to specify a Unix socket file on Unix (or named-pipe name on
Windows). For more information on options that specify connection
options, see
<a class="xref" href="connecting.html" title="6.2.4 Connecting to the MySQL Server Using Command Options">
Section 6.2.4, “Connecting to the MySQL Server Using Command Options”
</a>
.
</p>
<a class="indexterm" name="idm46045324271232">
</a>
<a class="indexterm" name="idm46045324270144">
</a>
<p>
You may find it necessary to invoke MySQL programs using the path
name to the
<code class="filename">
bin
</code>
directory in which they are
installed. This is likely to be the case if you get a
<span class="quote">
“
<span class="quote">
program not found
</span>
”
</span>
error whenever you attempt to run
a MySQL program from any directory other than the
<code class="filename">
bin
</code>
directory. To make it more convenient to
use MySQL, you can add the path name of the
<code class="filename">
bin
</code>
directory to your
<code class="literal">
PATH
</code>
environment variable setting. That enables you to run a program by
typing only its name, not its entire path name. For example, if
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
is installed in
<code class="filename">
/usr/local/mysql/bin
</code>
, you can run the program
by invoking it as
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
, and it is not
necessary to invoke it as
<span class="command">
<strong>
/usr/local/mysql/bin/mysql
</strong>
</span>
.
</p>
<p>
Consult the documentation for your command interpreter for
instructions on setting your
<code class="literal">
PATH
</code>
variable. The
syntax for setting environment variables is interpreter-specific.
(Some information is given in
<a class="xref" href="setting-environment-variables.html" title="6.2.9 Setting Environment Variables">
Section 6.2.9, “Setting Environment Variables”
</a>
.) After modifying
your
<code class="literal">
PATH
</code>
setting, open a new console window on
Windows or log in again on Unix so that the setting goes into
effect.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/group-replication-observability.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="group-replication-observability">
</a>
20.1.4.4 Observability
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045134321264">
</a>
<p>
There is a lot of automation built into the Group Replication
plugin. Nonetheless, you might sometimes need to understand what
is happening behind the scenes. This is where the
instrumentation of Group Replication and Performance Schema
becomes important. The entire state of the system (including the
view, conflict statistics and service states) can be queried
through Performance Schema tables. The distributed nature of the
replication protocol and the fact that server instances agree
and thus synchronize on transactions and metadata makes it
simpler to inspect the state of the group. For example, you can
connect to a single server in the group and obtain both local
and global information by issuing select statements on the Group
Replication related Performance Schema tables. For more
information, see
<a class="xref" href="group-replication-monitoring.html" title="20.4 Monitoring Group Replication">
Section 20.4, “Monitoring Group Replication”
</a>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/explain-output.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="explain-output">
</a>
10.8.2 EXPLAIN Output Format
</h3>
</div>
</div>
</div>
<p>
The
<a class="link" href="explain.html" title="15.8.2 EXPLAIN Statement">
<code class="literal">
EXPLAIN
</code>
</a>
statement provides
information about how MySQL executes statements.
<a class="link" href="explain.html" title="15.8.2 EXPLAIN Statement">
<code class="literal">
EXPLAIN
</code>
</a>
works with
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
,
<a class="link" href="delete.html" title="15.2.2 DELETE Statement">
<code class="literal">
DELETE
</code>
</a>
,
<a class="link" href="insert.html" title="15.2.7 INSERT Statement">
<code class="literal">
INSERT
</code>
</a>
,
<a class="link" href="replace.html" title="15.2.12 REPLACE Statement">
<code class="literal">
REPLACE
</code>
</a>
, and
<a class="link" href="update.html" title="15.2.17 UPDATE Statement">
<code class="literal">
UPDATE
</code>
</a>
statements.
</p>
<p>
<a class="link" href="explain.html" title="15.8.2 EXPLAIN Statement">
<code class="literal">
EXPLAIN
</code>
</a>
returns a row of
information for each table used in the
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
statement. It lists the
tables in the output in the order that MySQL would read them
while processing the statement. This means that MySQL reads a
row from the first table, then finds a matching row in the
second table, and then in the third table, and so on. When all
tables are processed, MySQL outputs the selected columns and
backtracks through the table list until a table is found for
which there are more matching rows. The next row is read from
this table and the process continues with the next table.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
MySQL Workbench has a Visual Explain capability that provides a
visual representation of
<a class="link" href="explain.html" title="15.8.2 EXPLAIN Statement">
<code class="literal">
EXPLAIN
</code>
</a>
output. See
<a class="ulink" href="/doc/workbench/en/wb-tutorial-visual-explain-dbt3.html" target="_top">
Tutorial: Using Explain to Improve Query Performance
</a>
.
</p>
</div>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="xref" href="explain-output.html#explain-output-columns" title="EXPLAIN Output Columns">
EXPLAIN Output Columns
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="explain-output.html#explain-join-types" title="EXPLAIN Join Types">
EXPLAIN Join Types
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="explain-output.html#explain-extra-information" title="EXPLAIN Extra Information">
EXPLAIN Extra Information
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="explain-output.html#explain-output-interpretation" title="EXPLAIN Output Interpretation">
EXPLAIN Output Interpretation
</a>
</p>
</li>
</ul>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="explain-output-columns">
</a>
EXPLAIN Output Columns
</h4>
</div>
</div>
</div>
<p>
This section describes the output columns produced by
<a class="link" href="explain.html" title="15.8.2 EXPLAIN Statement">
<code class="literal">
EXPLAIN
</code>
</a>
. Later sections provide
additional information about the
<a class="link" href="explain-output.html#explain-join-types" title="EXPLAIN Join Types">
<code class="literal">
type
</code>
</a>
and
<a class="link" href="explain-output.html#explain-extra-information" title="EXPLAIN Extra Information">
<code class="literal">
Extra
</code>
</a>
columns.
</p>
<p>
Each output row from
<a class="link" href="explain.html" title="15.8.2 EXPLAIN Statement">
<code class="literal">
EXPLAIN
</code>
</a>
provides information about one table. Each row contains the
values summarized in
<a class="xref" href="explain-output.html#explain-output-column-table" title="Table 10.1 EXPLAIN Output Columns">
Table 10.1, “EXPLAIN Output Columns”
</a>
, and described
in more detail following the table. Column names are shown in
the table's first column; the second column provides the
equivalent property name shown in the output when
<code class="literal">
FORMAT=JSON
</code>
is used.
</p>
<div class="table">
<a name="explain-output-column-table">
</a>
<p class="title">
<b>
Table 10.1 EXPLAIN Output Columns
</b>
</p>
<div class="table-contents">
<table summary="Output columns produced by the EXPLAIN statement.">
<colgroup>
<col style="width: 25%"/>
<col style="width: 25%"/>
<col style="width: 50%"/>
</colgroup>
<thead>
<tr>
<th scope="col">
Column
</th>
<th scope="col">
JSON Name
</th>
<th scope="col">
Meaning
</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">
<a class="link" href="explain-output.html#explain_id">
<code class="literal">
id
</code>
</a>
</th>
<td>
<code class="literal">
select_id
</code>
</td>
<td>
The
<code class="literal">
SELECT
</code>
identifier
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="explain-output.html#explain_select_type">
<code class="literal">
select_type
</code>
</a>
</th>
<td>
None
</td>
<td>
The
<code class="literal">
SELECT
</code>
type
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="explain-output.html#explain_table">
<code class="literal">
table
</code>
</a>
</th>
<td>
<code class="literal">
table_name
</code>
</td>
<td>
The table for the output row
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="explain-output.html#explain_partitions">
<code class="literal">
partitions
</code>
</a>
</th>
<td>
<code class="literal">
partitions
</code>
</td>
<td>
The matching partitions
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="explain-output.html#explain_type">
<code class="literal">
type
</code>
</a>
</th>
<td>
<code class="literal">
access_type
</code>
</td>
<td>
The join type
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="explain-output.html#explain_possible_keys">
<code class="literal">
possible_keys
</code>
</a>
</th>
<td>
<code class="literal">
possible_keys
</code>
</td>
<td>
The possible indexes to choose
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="explain-output.html#explain_key">
<code class="literal">
key
</code>
</a>
</th>
<td>
<code class="literal">
key
</code>
</td>
<td>
The index actually chosen
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="explain-output.html#explain_key_len">
<code class="literal">
key_len
</code>
</a>
</th>
<td>
<code class="literal">
key_length
</code>
</td>
<td>
The length of the chosen key
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="explain-output.html#explain_ref">
<code class="literal">
ref
</code>
</a>
</th>
<td>
<code class="literal">
ref
</code>
</td>
<td>
The columns compared to the index
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="explain-output.html#explain_rows">
<code class="literal">
rows
</code>
</a>
</th>
<td>
<code class="literal">
rows
</code>
</td>
<td>
Estimate of rows to be examined
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="explain-output.html#explain_filtered">
<code class="literal">
filtered
</code>
</a>
</th>
<td>
<code class="literal">
filtered
</code>
</td>
<td>
Percentage of rows filtered by table condition
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="explain-output.html#explain_extra">
<code class="literal">
Extra
</code>
</a>
</th>
<td>
None
</td>
<td>
Additional information
</td>
</tr>
</tbody>
</table>
</div>
<div class="table-contents">
<table cellpadding="0" cellspacing="0" style="position: fixed; top: 0px; display: none; left: 401px; width: 586px;">
<thead>
<tr>
<th scope="col" style="width: 146.25px;">
Column
</th>
<th scope="col" style="width: 146.25px;">
JSON Name
</th>
<th scope="col" style="width: 292.5px;">
Meaning
</th>
</tr>
</thead>
</table>
</div>
</div>
<br class="table-break"/>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
JSON properties which are
<code class="literal">
NULL
</code>
are not
displayed in JSON-formatted
<code class="literal">
EXPLAIN
</code>
output.
</p>
</div>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a name="explain_id">
</a>
<code class="literal">
id
</code>
(JSON name:
<code class="literal">
select_id
</code>
)
</p>
<p>
The
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
identifier. This
is the sequential number of the
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
within the query.
The value can be
<code class="literal">
NULL
</code>
if the row refers
to the union result of other rows. In this case, the
<code class="literal">
table
</code>
column shows a value like
<code class="literal">
<union
<em class="replaceable">
<code>
M
</code>
</em>
,
<em class="replaceable">
<code>
N
</code>
</em>
>
</code>
to indicate that the row refers to the union of the rows
with
<code class="literal">
id
</code>
values of
<em class="replaceable">
<code>
M
</code>
</em>
and
<em class="replaceable">
<code>
N
</code>
</em>
.
</p>
</li>
<li class="listitem">
<p>
<a name="explain_select_type">
</a>
<code class="literal">
select_type
</code>
(JSON name: none)
</p>
<p>
The type of
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
, which
can be any of those shown in the following table. A
JSON-formatted
<code class="literal">
EXPLAIN
</code>
exposes the
<code class="literal">
SELECT
</code>
type as a property of a
<code class="literal">
query_block
</code>
, unless it is
<code class="literal">
SIMPLE
</code>
or
<code class="literal">
PRIMARY
</code>
.
The JSON names (where applicable) are also shown in the
table.
</p>
<div class="informaltable">
<table summary="select_type values and the meaning of each value.">
<colgroup>
<col style="width: 25%"/>
<col style="width: 25%"/>
<col style="width: 50%"/>
</colgroup>
<thead>
<tr>
<th scope="col">
<code class="literal">
select_type
</code>
Value
</th>
<th scope="col">
JSON Name
</th>
<th scope="col">
Meaning
</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">
<code class="literal">
SIMPLE
</code>
</th>
<td>
None
</td>
<td>
Simple
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
(not using
<a class="link" href="union.html" title="15.2.18 UNION Clause">
<code class="literal">
UNION
</code>
</a>
or subqueries)
</td>
</tr>
<tr>
<th scope="row">
<code class="literal">
PRIMARY
</code>
</th>
<td>
None
</td>
<td>
Outermost
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="union.html" title="15.2.18 UNION Clause">
<code class="literal">
UNION
</code>
</a>
</th>
<td>
None
</td>
<td>
Second or later
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
statement in a
<a class="link" href="union.html" title="15.2.18 UNION Clause">
<code class="literal">
UNION
</code>
</a>
</td>
</tr>
<tr>
<th scope="row">
<code class="literal">
DEPENDENT UNION
</code>
</th>
<td>
<code class="literal">
dependent
</code>
(
<code class="literal">
true
</code>
)
</td>
<td>
Second or later
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
statement in a
<a class="link" href="union.html" title="15.2.18 UNION Clause">
<code class="literal">
UNION
</code>
</a>
, dependent on
outer query
</td>
</tr>
<tr>
<th scope="row">
<code class="literal">
UNION RESULT
</code>
</th>
<td>
<code class="literal">
union_result
</code>
</td>
<td>
Result of a
<a class="link" href="union.html" title="15.2.18 UNION Clause">
<code class="literal">
UNION
</code>
</a>
.
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="optimizer-hints.html#optimizer-hints-subquery" title="Subquery Optimizer Hints">
<code class="literal">
SUBQUERY
</code>
</a>
</th>
<td>
None
</td>
<td>
First
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
in subquery
</td>
</tr>
<tr>
<th scope="row">
<code class="literal">
DEPENDENT SUBQUERY
</code>
</th>
<td>
<code class="literal">
dependent
</code>
(
<code class="literal">
true
</code>
)
</td>
<td>
First
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
in subquery, dependent on
outer query
</td>
</tr>
<tr>
<th scope="row">
<code class="literal">
DERIVED
</code>
</th>
<td>
None
</td>
<td>
Derived table
</td>
</tr>
<tr>
<th scope="row">
<code class="literal">
DEPENDENT DERIVED
</code>
</th>
<td>
<code class="literal">
dependent
</code>
(
<code class="literal">
true
</code>
)
</td>
<td>
Derived table dependent on another table
</td>
</tr>
<tr>
<th scope="row">
<code class="literal">
MATERIALIZED
</code>
</th>
<td>
<code class="literal">
materialized_from_subquery
</code>
</td>
<td>
Materialized subquery
</td>
</tr>
<tr>
<th scope="row">
<code class="literal">
UNCACHEABLE SUBQUERY
</code>
</th>
<td>
<code class="literal">
cacheable
</code>
(
<code class="literal">
false
</code>
)
</td>
<td>
A subquery for which the result cannot be cached and must be
re-evaluated for each row of the outer query
</td>
</tr>
<tr>
<th scope="row">
<code class="literal">
UNCACHEABLE UNION
</code>
</th>
<td>
<code class="literal">
cacheable
</code>
(
<code class="literal">
false
</code>
)
</td>
<td>
The second or later select in a
<a class="link" href="union.html" title="15.2.18 UNION Clause">
<code class="literal">
UNION
</code>
</a>
that belongs to an uncacheable subquery (see
<code class="literal">
UNCACHEABLE SUBQUERY
</code>
)
</td>
</tr>
</tbody>
</table>
</div>
<div class="informaltable">
<table cellpadding="0" cellspacing="0" style="position: fixed; top: 0px; display: none; left: 431px; width: 709px;">
<thead>
<tr>
<th scope="col" style="width: 167.938px;">
<code class="literal">
select_type
</code>
Value
</th>
<th scope="col" style="width: 218.266px;">
JSON Name
</th>
<th scope="col" style="width: 321.797px;">
Meaning
</th>
</tr>
</thead>
</table>
</div>
<p>
<code class="literal">
DEPENDENT
</code>
typically signifies the use
of a correlated subquery. See
<a class="xref" href="correlated-subqueries.html" title="15.2.15.7 Correlated Subqueries">
Section 15.2.15.7, “Correlated Subqueries”
</a>
.
</p>
<p>
<code class="literal">
DEPENDENT SUBQUERY
</code>
evaluation differs
from
<code class="literal">
UNCACHEABLE SUBQUERY
</code>
evaluation.
For
<code class="literal">
DEPENDENT SUBQUERY
</code>
, the subquery is
re-evaluated only once for each set of different values of
the variables from its outer context. For
<code class="literal">
UNCACHEABLE SUBQUERY
</code>
, the subquery is
re-evaluated for each row of the outer context.
</p>
<p>
When you specify
<code class="literal">
FORMAT=JSON
</code>
with
<code class="literal">
EXPLAIN
</code>
, the output has no single
property directly equivalent to
<code class="literal">
select_type
</code>
; the
<code class="literal">
query_block
</code>
property corresponds to a
given
<code class="literal">
SELECT
</code>
. Properties equivalent to
most of the
<code class="literal">
SELECT
</code>
subquery types just
shown are available (an example being
<code class="literal">
materialized_from_subquery
</code>
for
<code class="literal">
MATERIALIZED
</code>
), and are displayed when
appropriate. There are no JSON equivalents for
<code class="literal">
SIMPLE
</code>
or
<code class="literal">
PRIMARY
</code>
.
</p>
<p>
The
<code class="literal">
select_type
</code>
value for
non-
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
statements
displays the statement type for affected tables. For
example,
<code class="literal">
select_type
</code>
is
<code class="literal">
DELETE
</code>
for
<a class="link" href="delete.html" title="15.2.2 DELETE Statement">
<code class="literal">
DELETE
</code>
</a>
statements.
</p>
</li>
<li class="listitem">
<p>
<a name="explain_table">
</a>
<code class="literal">
table
</code>
(JSON name:
<code class="literal">
table_name
</code>
)
</p>
<p>
The name of the table to which the row of output refers.
This can also be one of the following values:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<code class="literal">
<union
<em class="replaceable">
<code>
M
</code>
</em>
,
<em class="replaceable">
<code>
N
</code>
</em>
>
</code>
:
The row refers to the union of the rows with
<code class="literal">
id
</code>
values of
<em class="replaceable">
<code>
M
</code>
</em>
and
<em class="replaceable">
<code>
N
</code>
</em>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
<derived
<em class="replaceable">
<code>
N
</code>
</em>
>
</code>
:
The row refers to the derived table result for the row
with an
<code class="literal">
id
</code>
value of
<em class="replaceable">
<code>
N
</code>
</em>
. A derived table may
result, for example, from a subquery in the
<code class="literal">
FROM
</code>
clause.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
<subquery
<em class="replaceable">
<code>
N
</code>
</em>
>
</code>
:
The row refers to the result of a materialized
subquery for the row with an
<code class="literal">
id
</code>
value of
<em class="replaceable">
<code>
N
</code>
</em>
. See
<a class="xref" href="subquery-materialization.html" title="10.2.2.2 Optimizing Subqueries with Materialization">
Section 10.2.2.2, “Optimizing Subqueries with Materialization”
</a>
.
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
<a name="explain_partitions">
</a>
<code class="literal">
partitions
</code>
(JSON name:
<code class="literal">
partitions
</code>
)
</p>
<p>
The partitions from which records would be matched by the
query. The value is
<code class="literal">
NULL
</code>
for
nonpartitioned tables. See
<a class="xref" href="partitioning-info.html" title="26.3.5 Obtaining Information About Partitions">
Section 26.3.5, “Obtaining Information About Partitions”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="explain_type">
</a>
<code class="literal">
type
</code>
(JSON name:
<code class="literal">
access_type
</code>
)
</p>
<p>
The join type. For descriptions of the different types,
see
<a class="link" href="explain-output.html#explain-join-types" title="EXPLAIN Join Types">
<code class="literal">
EXPLAIN
</code>
Join Types
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="explain_possible_keys">
</a>
<code class="literal">
possible_keys
</code>
(JSON name:
<code class="literal">
possible_keys
</code>
)
</p>
<p>
The
<code class="literal">
possible_keys
</code>
column indicates the
indexes from which MySQL can choose to find the rows in
this table. Note that this column is totally independent
of the order of the tables as displayed in the output from
<a class="link" href="explain.html" title="15.8.2 EXPLAIN Statement">
<code class="literal">
EXPLAIN
</code>
</a>
. That means that
some of the keys in
<code class="literal">
possible_keys
</code>
might
not be usable in practice with the generated table order.
</p>
<p>
If this column is
<code class="literal">
NULL
</code>
(or undefined in
JSON-formatted output), there are no relevant indexes. In
this case, you may be able to improve the performance of
your query by examining the
<code class="literal">
WHERE
</code>
clause to check whether it refers to some column or
columns that would be suitable for indexing. If so, create
an appropriate index and check the query with
<a class="link" href="explain.html" title="15.8.2 EXPLAIN Statement">
<code class="literal">
EXPLAIN
</code>
</a>
again. See
<a class="xref" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
Section 15.1.9, “ALTER TABLE Statement”
</a>
.
</p>
<p>
To see what indexes a table has, use
<code class="literal">
SHOW INDEX
FROM
<em class="replaceable">
<code>
tbl_name
</code>
</em>
</code>
.
</p>
</li>
<li class="listitem">
<p>
<a name="explain_key">
</a>
<code class="literal">
key
</code>
(JSON name:
<code class="literal">
key
</code>
)
</p>
<p>
The
<code class="literal">
key
</code>
column indicates the key
(index) that MySQL actually decided to use. If MySQL
decides to use one of the
<code class="literal">
possible_keys
</code>
indexes to look up rows, that index is listed as the key
value.
</p>
<p>
It is possible that
<code class="literal">
key
</code>
may name an
index that is not present in the
<code class="literal">
possible_keys
</code>
value. This can happen if
none of the
<code class="literal">
possible_keys
</code>
indexes are
suitable for looking up rows, but all the columns selected
by the query are columns of some other index. That is, the
named index covers the selected columns, so although it is
not used to determine which rows to retrieve, an index
scan is more efficient than a data row scan.
</p>
<p>
For
<code class="literal">
InnoDB
</code>
, a secondary index might
cover the selected columns even if the query also selects
the primary key because
<code class="literal">
InnoDB
</code>
stores
the primary key value with each secondary index. If
<code class="literal">
key
</code>
is
<code class="literal">
NULL
</code>
, MySQL
found no index to use for executing the query more
efficiently.
</p>
<p>
To force MySQL to use or ignore an index listed in the
<code class="literal">
possible_keys
</code>
column, use
<code class="literal">
FORCE INDEX
</code>
,
<code class="literal">
USE
INDEX
</code>
, or
<code class="literal">
IGNORE INDEX
</code>
in
your query. See
<a class="xref" href="index-hints.html" title="10.9.4 Index Hints">
Section 10.9.4, “Index Hints”
</a>
.
</p>
<p>
For
<code class="literal">
MyISAM
</code>
tables, running
<a class="link" href="analyze-table.html" title="15.7.3.1 ANALYZE TABLE Statement">
<code class="literal">
ANALYZE TABLE
</code>
</a>
helps the
optimizer choose better indexes. For
<code class="literal">
MyISAM
</code>
tables,
<a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
<span class="command">
<strong>
myisamchk
--analyze
</strong>
</span>
</a>
does the same. See
<a class="xref" href="analyze-table.html" title="15.7.3.1 ANALYZE TABLE Statement">
Section 15.7.3.1, “ANALYZE TABLE Statement”
</a>
, and
<a class="xref" href="myisam-table-maintenance.html" title="9.6 MyISAM Table Maintenance and Crash Recovery">
Section 9.6, “MyISAM Table Maintenance and Crash Recovery”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="explain_key_len">
</a>
<code class="literal">
key_len
</code>
(JSON name:
<code class="literal">
key_length
</code>
)
</p>
<p>
The
<code class="literal">
key_len
</code>
column indicates the length
of the key that MySQL decided to use. The value of
<code class="literal">
key_len
</code>
enables you to determine how
many parts of a multiple-part key MySQL actually uses. If
the
<code class="literal">
key
</code>
column says
<code class="literal">
NULL
</code>
, the
<code class="literal">
key_len
</code>
column also says
<code class="literal">
NULL
</code>
.
</p>
<p>
Due to the key storage format, the key length is one
greater for a column that can be
<code class="literal">
NULL
</code>
than for a
<code class="literal">
NOT NULL
</code>
column.
</p>
</li>
<li class="listitem">
<p>
<a name="explain_ref">
</a>
<code class="literal">
ref
</code>
(JSON name:
<code class="literal">
ref
</code>
)
</p>
<p>
The
<code class="literal">
ref
</code>
column shows which columns or
constants are compared to the index named in the
<code class="literal">
key
</code>
column to select rows from the
table.
</p>
<p>
If the value is
<code class="literal">
func
</code>
, the value used is
the result of some function. To see which function, use
<a class="link" href="show-warnings.html" title="15.7.7.42 SHOW WARNINGS Statement">
<code class="literal">
SHOW WARNINGS
</code>
</a>
following
<a class="link" href="explain.html" title="15.8.2 EXPLAIN Statement">
<code class="literal">
EXPLAIN
</code>
</a>
to see the extended
<a class="link" href="explain.html" title="15.8.2 EXPLAIN Statement">
<code class="literal">
EXPLAIN
</code>
</a>
output. The
function might actually be an operator such as an
arithmetic operator.
</p>
</li>
<li class="listitem">
<p>
<a name="explain_rows">
</a>
<code class="literal">
rows
</code>
(JSON name:
<code class="literal">
rows
</code>
)
</p>
<p>
The
<code class="literal">
rows
</code>
column indicates the number of
rows MySQL believes it must examine to execute the query.
</p>
<p>
For
<a class="link" href="innodb-storage-engine.html" title="Chapter 17 The InnoDB Storage Engine">
<code class="literal">
InnoDB
</code>
</a>
tables, this
number is an estimate, and may not always be exact.
</p>
</li>
<li class="listitem">
<p>
<a name="explain_filtered">
</a>
<code class="literal">
filtered
</code>
(JSON name:
<code class="literal">
filtered
</code>
)
</p>
<p>
The
<code class="literal">
filtered
</code>
column indicates an
estimated percentage of table rows that are filtered by
the table condition. The maximum value is 100, which means
no filtering of rows occurred. Values decreasing from 100
indicate increasing amounts of filtering.
<code class="literal">
rows
</code>
shows the estimated number of rows
examined and
<code class="literal">
rows
</code>
×
<code class="literal">
filtered
</code>
shows the number of rows that
are joined with the following table. For example, if
<code class="literal">
rows
</code>
is 1000 and
<code class="literal">
filtered
</code>
is 50.00 (50%), the number of
rows to be joined with the following table is 1000 ×
50% = 500.
</p>
</li>
<li class="listitem">
<p>
<a name="explain_extra">
</a>
<code class="literal">
Extra
</code>
(JSON name: none)
</p>
<p>
This column contains additional information about how
MySQL resolves the query. For descriptions of the
different values, see
<a class="link" href="explain-output.html#explain-extra-information" title="EXPLAIN Extra Information">
<code class="literal">
EXPLAIN
</code>
Extra Information
</a>
.
</p>
<p>
There is no single JSON property corresponding to the
<code class="literal">
Extra
</code>
column; however, values that can
occur in this column are exposed as JSON properties, or as
the text of the
<code class="literal">
message
</code>
property.
</p>
</li>
</ul>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="explain-join-types">
</a>
EXPLAIN Join Types
</h4>
</div>
</div>
</div>
<p>
The
<code class="literal">
type
</code>
column of
<a class="link" href="explain.html" title="15.8.2 EXPLAIN Statement">
<code class="literal">
EXPLAIN
</code>
</a>
output describes how
tables are joined. In JSON-formatted output, these are found
as values of the
<code class="literal">
access_type
</code>
property. The
following list describes the join types, ordered from the best
type to the worst:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a name="jointype_system">
</a>
<a class="link" href="explain-output.html#jointype_system">
<code class="literal">
system
</code>
</a>
</p>
<a class="indexterm" name="idm46045225241312">
</a>
<a class="indexterm" name="idm46045225239824">
</a>
<a class="indexterm" name="idm46045225238336">
</a>
<p>
The table has only one row (= system table). This is a
special case of the
<a class="link" href="explain-output.html#jointype_const">
<code class="literal">
const
</code>
</a>
join type.
</p>
</li>
<li class="listitem">
<p>
<a name="jointype_const">
</a>
<a class="link" href="explain-output.html#jointype_const">
<code class="literal">
const
</code>
</a>
</p>
<a class="indexterm" name="idm46045225232688">
</a>
<a class="indexterm" name="idm46045225231200">
</a>
<a class="indexterm" name="idm46045225229712">
</a>
<p>
The table has at most one matching row, which is read at
the start of the query. Because there is only one row,
values from the column in this row can be regarded as
constants by the rest of the optimizer.
<a class="link" href="explain-output.html#jointype_const">
<code class="literal">
const
</code>
</a>
tables are very
fast because they are read only once.
</p>
<p>
<a class="link" href="explain-output.html#jointype_const">
<code class="literal">
const
</code>
</a>
is used when you
compare all parts of a
<code class="literal">
PRIMARY KEY
</code>
or
<code class="literal">
UNIQUE
</code>
index to constant values. In the
following queries,
<em class="replaceable">
<code>
tbl_name
</code>
</em>
can
be used as a
<a class="link" href="explain-output.html#jointype_const">
<code class="literal">
const
</code>
</a>
table:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa15552947"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> <em class="replaceable">tbl_name</em> <span class="token keyword">WHERE</span> <em class="replaceable">primary_key</em><span class="token operator">=</span><span class="token number">1</span><span class="token punctuation">;</span>
<span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> <em class="replaceable">tbl_name</em>
<span class="token keyword">WHERE</span> <em class="replaceable">primary_key_part1</em><span class="token operator">=</span><span class="token number">1</span> <span class="token operator">AND</span> <em class="replaceable">primary_key_part2</em><span class="token operator">=</span><span class="token number">2</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
<a name="jointype_eq_ref">
</a>
<a class="link" href="explain-output.html#jointype_eq_ref">
<code class="literal">
eq_ref
</code>
</a>
</p>
<a class="indexterm" name="idm46045225215904">
</a>
<a class="indexterm" name="idm46045225214416">
</a>
<p>
One row is read from this table for each combination of
rows from the previous tables. Other than the
<a class="link" href="explain-output.html#jointype_system">
<code class="literal">
system
</code>
</a>
and
<a class="link" href="explain-output.html#jointype_const">
<code class="literal">
const
</code>
</a>
types, this is
the best possible join type. It is used when all parts of
an index are used by the join and the index is a
<code class="literal">
PRIMARY KEY
</code>
or
<code class="literal">
UNIQUE NOT
NULL
</code>
index.
</p>
<p>
<a class="link" href="explain-output.html#jointype_eq_ref">
<code class="literal">
eq_ref
</code>
</a>
can be used for
indexed columns that are compared using the
<code class="literal">
=
</code>
operator. The comparison value can be
a constant or an expression that uses columns from tables
that are read before this table. In the following
examples, MySQL can use an
<a class="link" href="explain-output.html#jointype_eq_ref">
<code class="literal">
eq_ref
</code>
</a>
join to process
<em class="replaceable">
<code>
ref_table
</code>
</em>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa26718298"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> <em class="replaceable">ref_table</em><span class="token punctuation">,</span><em class="replaceable">other_table</em>
<span class="token keyword">WHERE</span> <em class="replaceable">ref_table</em><span class="token punctuation">.</span><em class="replaceable">key_column</em><span class="token operator">=</span><em class="replaceable">other_table</em><span class="token punctuation">.</span><span class="token keyword"><em class="replaceable">column</em></span><span class="token punctuation">;</span>
<span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> <em class="replaceable">ref_table</em><span class="token punctuation">,</span><em class="replaceable">other_table</em>
<span class="token keyword">WHERE</span> <em class="replaceable">ref_table</em><span class="token punctuation">.</span><em class="replaceable">key_column_part1</em><span class="token operator">=</span><em class="replaceable">other_table</em><span class="token punctuation">.</span><span class="token keyword"><em class="replaceable">column</em></span>
<span class="token operator">AND</span> <em class="replaceable">ref_table</em><span class="token punctuation">.</span><em class="replaceable">key_column_part2</em><span class="token operator">=</span><span class="token number">1</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
<a name="jointype_ref">
</a>
<a class="link" href="explain-output.html#jointype_ref">
<code class="literal">
ref
</code>
</a>
</p>
<a class="indexterm" name="idm46045225194752">
</a>
<a class="indexterm" name="idm46045225193296">
</a>
<p>
All rows with matching index values are read from this
table for each combination of rows from the previous
tables.
<a class="link" href="explain-output.html#jointype_ref">
<code class="literal">
ref
</code>
</a>
is used if
the join uses only a leftmost prefix of the key or if the
key is not a
<code class="literal">
PRIMARY KEY
</code>
or
<code class="literal">
UNIQUE
</code>
index (in other words, if the
join cannot select a single row based on the key value).
If the key that is used matches only a few rows, this is a
good join type.
</p>
<p>
<a class="link" href="explain-output.html#jointype_ref">
<code class="literal">
ref
</code>
</a>
can be used for
indexed columns that are compared using the
<code class="literal">
=
</code>
or
<code class="literal">
<=>
</code>
operator. In the following examples, MySQL can use a
<a class="link" href="explain-output.html#jointype_ref">
<code class="literal">
ref
</code>
</a>
join to process
<em class="replaceable">
<code>
ref_table
</code>
</em>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa66345880"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> <em class="replaceable">ref_table</em> <span class="token keyword">WHERE</span> <em class="replaceable">key_column</em><span class="token operator">=</span><em class="replaceable">expr</em><span class="token punctuation">;</span>
<span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> <em class="replaceable">ref_table</em><span class="token punctuation">,</span><em class="replaceable">other_table</em>
<span class="token keyword">WHERE</span> <em class="replaceable">ref_table</em><span class="token punctuation">.</span><em class="replaceable">key_column</em><span class="token operator">=</span><em class="replaceable">other_table</em><span class="token punctuation">.</span><span class="token keyword"><em class="replaceable">column</em></span><span class="token punctuation">;</span>
<span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> <em class="replaceable">ref_table</em><span class="token punctuation">,</span><em class="replaceable">other_table</em>
<span class="token keyword">WHERE</span> <em class="replaceable">ref_table</em><span class="token punctuation">.</span><em class="replaceable">key_column_part1</em><span class="token operator">=</span><em class="replaceable">other_table</em><span class="token punctuation">.</span><span class="token keyword"><em class="replaceable">column</em></span>
<span class="token operator">AND</span> <em class="replaceable">ref_table</em><span class="token punctuation">.</span><em class="replaceable">key_column_part2</em><span class="token operator">=</span><span class="token number">1</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
<a name="jointype_fulltext">
</a>
<a class="link" href="explain-output.html#jointype_fulltext">
<code class="literal">
fulltext
</code>
</a>
</p>
<a class="indexterm" name="idm46045225171840">
</a>
<a class="indexterm" name="idm46045225170352">
</a>
<p>
The join is performed using a
<code class="literal">
FULLTEXT
</code>
index.
</p>
</li>
<li class="listitem">
<p>
<a name="jointype_ref_or_null">
</a>
<a class="link" href="explain-output.html#jointype_ref_or_null">
<code class="literal">
ref_or_null
</code>
</a>
</p>
<a class="indexterm" name="idm46045225165280">
</a>
<a class="indexterm" name="idm46045225163792">
</a>
<p>
This join type is like
<a class="link" href="explain-output.html#jointype_ref">
<code class="literal">
ref
</code>
</a>
, but with the
addition that MySQL does an extra search for rows that
contain
<code class="literal">
NULL
</code>
values. This join type
optimization is used most often in resolving subqueries.
In the following examples, MySQL can use a
<a class="link" href="explain-output.html#jointype_ref_or_null">
<code class="literal">
ref_or_null
</code>
</a>
join to
process
<em class="replaceable">
<code>
ref_table
</code>
</em>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa74694256"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> <em class="replaceable">ref_table</em>
<span class="token keyword">WHERE</span> <em class="replaceable">key_column</em><span class="token operator">=</span><em class="replaceable">expr</em> <span class="token operator">OR</span> <em class="replaceable">key_column</em> <span class="token operator">IS</span> <span class="token boolean">NULL</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
See
<a class="xref" href="is-null-optimization.html" title="10.2.1.15 IS NULL Optimization">
Section 10.2.1.15, “IS NULL Optimization”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="jointype_index_merge">
</a>
<a class="link" href="explain-output.html#jointype_index_merge">
<code class="literal">
index_merge
</code>
</a>
</p>
<a class="indexterm" name="idm46045225151760">
</a>
<a class="indexterm" name="idm46045225150272">
</a>
<p>
This join type indicates that the Index Merge optimization
is used. In this case, the
<code class="literal">
key
</code>
column
in the output row contains a list of indexes used, and
<code class="literal">
key_len
</code>
contains a list of the longest
key parts for the indexes used. For more information, see
<a class="xref" href="index-merge-optimization.html" title="10.2.1.3 Index Merge Optimization">
Section 10.2.1.3, “Index Merge Optimization”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="jointype_unique_subquery">
</a>
<a class="link" href="explain-output.html#jointype_unique_subquery">
<code class="literal">
unique_subquery
</code>
</a>
</p>
<a class="indexterm" name="idm46045225143536">
</a>
<a class="indexterm" name="idm46045225142048">
</a>
<p>
This type replaces
<a class="link" href="explain-output.html#jointype_eq_ref">
<code class="literal">
eq_ref
</code>
</a>
for some
<code class="literal">
IN
</code>
subqueries of the following form:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa39959782"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword"><em class="replaceable">value</em></span> <span class="token keyword">IN</span> <span class="token punctuation">(</span><span class="token keyword">SELECT</span> <em class="replaceable">primary_key</em> <span class="token keyword">FROM</span> <em class="replaceable">single_table</em> <span class="token keyword">WHERE</span> <em class="replaceable">some_expr</em><span class="token punctuation">)</span></code></pre>
</div>
<p>
<a class="link" href="explain-output.html#jointype_unique_subquery">
<code class="literal">
unique_subquery
</code>
</a>
is just
an index lookup function that replaces the subquery
completely for better efficiency.
</p>
</li>
<li class="listitem">
<p>
<a name="jointype_index_subquery">
</a>
<a class="link" href="explain-output.html#jointype_index_subquery">
<code class="literal">
index_subquery
</code>
</a>
</p>
<a class="indexterm" name="idm46045225131488">
</a>
<a class="indexterm" name="idm46045225130000">
</a>
<p>
This join type is similar to
<a class="link" href="explain-output.html#jointype_unique_subquery">
<code class="literal">
unique_subquery
</code>
</a>
. It
replaces
<code class="literal">
IN
</code>
subqueries, but it works
for nonunique indexes in subqueries of the following form:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa61428563"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword"><em class="replaceable">value</em></span> <span class="token keyword">IN</span> <span class="token punctuation">(</span><span class="token keyword">SELECT</span> <em class="replaceable">key_column</em> <span class="token keyword">FROM</span> <em class="replaceable">single_table</em> <span class="token keyword">WHERE</span> <em class="replaceable">some_expr</em><span class="token punctuation">)</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
<a name="jointype_range">
</a>
<a class="link" href="explain-output.html#jointype_range">
<code class="literal">
range
</code>
</a>
</p>
<a class="indexterm" name="idm46045225121104">
</a>
<a class="indexterm" name="idm46045225119616">
</a>
<p>
Only rows that are in a given range are retrieved, using
an index to select the rows. The
<code class="literal">
key
</code>
column in the output row indicates which index is used.
The
<code class="literal">
key_len
</code>
contains the longest key
part that was used. The
<code class="literal">
ref
</code>
column is
<code class="literal">
NULL
</code>
for this type.
</p>
<p>
<a class="link" href="explain-output.html#jointype_range">
<code class="literal">
range
</code>
</a>
can be used when
a key column is compared to a constant using any of the
<a class="link" href="comparison-operators.html#operator_equal">
<code class="literal">
=
</code>
</a>
,
<a class="link" href="comparison-operators.html#operator_not-equal">
<code class="literal">
<>
</code>
</a>
,
<a class="link" href="comparison-operators.html#operator_greater-than">
<code class="literal">
>
</code>
</a>
,
<a class="link" href="comparison-operators.html#operator_greater-than-or-equal">
<code class="literal">
>=
</code>
</a>
,
<a class="link" href="comparison-operators.html#operator_less-than">
<code class="literal">
<
</code>
</a>
,
<a class="link" href="comparison-operators.html#operator_less-than-or-equal">
<code class="literal">
<=
</code>
</a>
,
<a class="link" href="comparison-operators.html#operator_is-null">
<code class="literal">
IS NULL
</code>
</a>
,
<a class="link" href="comparison-operators.html#operator_equal-to">
<code class="literal">
<=>
</code>
</a>
,
<a class="link" href="comparison-operators.html#operator_between">
<code class="literal">
BETWEEN
</code>
</a>
,
<a class="link" href="string-comparison-functions.html#operator_like">
<code class="literal">
LIKE
</code>
</a>
, or
<a class="link" href="comparison-operators.html#operator_in">
<code class="literal">
IN()
</code>
</a>
operators:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa31856867"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> <em class="replaceable">tbl_name</em>
<span class="token keyword">WHERE</span> <em class="replaceable">key_column</em> <span class="token operator">=</span> <span class="token number">10</span><span class="token punctuation">;</span>
<span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> <em class="replaceable">tbl_name</em>
<span class="token keyword">WHERE</span> <em class="replaceable">key_column</em> <span class="token operator">BETWEEN</span> <span class="token number">10</span> <span class="token operator">and</span> <span class="token number">20</span><span class="token punctuation">;</span>
<span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> <em class="replaceable">tbl_name</em>
<span class="token keyword">WHERE</span> <em class="replaceable">key_column</em> <span class="token keyword">IN</span> <span class="token punctuation">(</span><span class="token number">10</span><span class="token punctuation">,</span><span class="token number">20</span><span class="token punctuation">,</span><span class="token number">30</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> <em class="replaceable">tbl_name</em>
<span class="token keyword">WHERE</span> <em class="replaceable">key_part1</em> <span class="token operator">=</span> <span class="token number">10</span> <span class="token operator">AND</span> <em class="replaceable">key_part2</em> <span class="token keyword">IN</span> <span class="token punctuation">(</span><span class="token number">10</span><span class="token punctuation">,</span><span class="token number">20</span><span class="token punctuation">,</span><span class="token number">30</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
<a name="jointype_index">
</a>
<a class="link" href="explain-output.html#jointype_index">
<code class="literal">
index
</code>
</a>
</p>
<a class="indexterm" name="idm46045225091952">
</a>
<a class="indexterm" name="idm46045225090464">
</a>
<p>
The
<code class="literal">
index
</code>
join type is the same as
<a class="link" href="explain-output.html#jointype_all">
<code class="literal">
ALL
</code>
</a>
, except that the
index tree is scanned. This occurs two ways:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
If the index is a covering index for the queries and
can be used to satisfy all data required from the
table, only the index tree is scanned. In this case,
the
<code class="literal">
Extra
</code>
column says
<code class="literal">
Using index
</code>
. An index-only scan
usually is faster than
<a class="link" href="explain-output.html#jointype_all">
<code class="literal">
ALL
</code>
</a>
because the
size of the index usually is smaller than the table
data.
</p>
</li>
<li class="listitem">
<p>
A full table scan is performed using reads from the
index to look up data rows in index order.
<code class="literal">
Uses index
</code>
does not appear in the
<code class="literal">
Extra
</code>
column.
</p>
</li>
</ul>
</div>
<p>
MySQL can use this join type when the query uses only
columns that are part of a single index.
</p>
</li>
<li class="listitem">
<p>
<a name="jointype_all">
</a>
<a class="link" href="explain-output.html#jointype_all">
<code class="literal">
ALL
</code>
</a>
</p>
<a class="indexterm" name="idm46045225076960">
</a>
<a class="indexterm" name="idm46045225075504">
</a>
<p>
A full table scan is done for each combination of rows
from the previous tables. This is normally not good if the
table is the first table not marked
<a class="link" href="explain-output.html#jointype_const">
<code class="literal">
const
</code>
</a>
, and usually
<span class="emphasis">
<em>
very
</em>
</span>
bad in all other cases.
Normally, you can avoid
<a class="link" href="explain-output.html#jointype_all">
<code class="literal">
ALL
</code>
</a>
by adding indexes
that enable row retrieval from the table based on constant
values or column values from earlier tables.
</p>
</li>
</ul>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="explain-extra-information">
</a>
EXPLAIN Extra Information
</h4>
</div>
</div>
</div>
<p>
The
<code class="literal">
Extra
</code>
column of
<a class="link" href="explain.html" title="15.8.2 EXPLAIN Statement">
<code class="literal">
EXPLAIN
</code>
</a>
output contains
additional information about how MySQL resolves the query. The
following list explains the values that can appear in this
column. Each item also indicates for JSON-formatted output
which property displays the
<code class="literal">
Extra
</code>
value.
For some of these, there is a specific property. The others
display as the text of the
<code class="literal">
message
</code>
property.
</p>
<p>
If you want to make your queries as fast as possible, look out
for
<code class="literal">
Extra
</code>
column values of
<code class="literal">
Using
filesort
</code>
and
<code class="literal">
Using temporary
</code>
, or,
in JSON-formatted
<code class="literal">
EXPLAIN
</code>
output, for
<code class="literal">
using_filesort
</code>
and
<code class="literal">
using_temporary_table
</code>
properties equal to
<code class="literal">
true
</code>
.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
Backward index scan
</code>
(JSON:
<code class="literal">
backward_index_scan
</code>
)
</p>
<p>
The optimizer is able to use a descending index on an
<code class="literal">
InnoDB
</code>
table. Shown together with
<code class="literal">
Using index
</code>
. For more information, see
<a class="xref" href="descending-indexes.html" title="10.3.13 Descending Indexes">
Section 10.3.13, “Descending Indexes”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
Child of '
<em class="replaceable">
<code>
table
</code>
</em>
'
pushed join@1
</code>
(JSON:
<code class="literal">
message
</code>
text)
</p>
<p>
This table is referenced as the child of
<em class="replaceable">
<code>
table
</code>
</em>
in a join that can be
pushed down to the NDB kernel. Applies only in NDB
Cluster, when pushed-down joins are enabled. See the
description of the
<a class="link" href="mysql-cluster-options-variables.html#sysvar_ndb_join_pushdown">
<code class="literal">
ndb_join_pushdown
</code>
</a>
server
system variable for more information and examples.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
const row not found
</code>
(JSON property:
<code class="literal">
const_row_not_found
</code>
)
</p>
<p>
For a query such as
<code class="literal">
SELECT ... FROM
<em class="replaceable">
<code>
tbl_name
</code>
</em>
</code>
, the table
was empty.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
Deleting all rows
</code>
(JSON property:
<code class="literal">
message
</code>
)
</p>
<p>
For
<a class="link" href="delete.html" title="15.2.2 DELETE Statement">
<code class="literal">
DELETE
</code>
</a>
, some storage
engines (such as
<a class="link" href="myisam-storage-engine.html" title="18.2 The MyISAM Storage Engine">
<code class="literal">
MyISAM
</code>
</a>
)
support a handler method that removes all table rows in a
simple and fast way. This
<code class="literal">
Extra
</code>
value
is displayed if the engine uses this optimization.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
Distinct
</code>
(JSON property:
<code class="literal">
distinct
</code>
)
</p>
<p>
MySQL is looking for distinct values, so it stops
searching for more rows for the current row combination
after it has found the first matching row.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
FirstMatch(
<em class="replaceable">
<code>
tbl_name
</code>
</em>
)
</code>
(JSON property:
<code class="literal">
first_match
</code>
)
</p>
<p>
The semijoin FirstMatch join shortcutting strategy is used
for
<em class="replaceable">
<code>
tbl_name
</code>
</em>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
Full scan on NULL key
</code>
(JSON property:
<code class="literal">
message
</code>
)
</p>
<p>
This occurs for subquery optimization as a fallback
strategy when the optimizer cannot use an index-lookup
access method.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
Impossible HAVING
</code>
(JSON property:
<code class="literal">
message
</code>
)
</p>
<p>
The
<code class="literal">
HAVING
</code>
clause is always false and
cannot select any rows.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
Impossible WHERE
</code>
(JSON property:
<code class="literal">
message
</code>
)
</p>
<p>
The
<code class="literal">
WHERE
</code>
clause is always false and
cannot select any rows.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
Impossible WHERE noticed after reading const
tables
</code>
(JSON property:
<code class="literal">
message
</code>
)
</p>
<p>
MySQL has read all
<a class="link" href="explain-output.html#jointype_const">
<code class="literal">
const
</code>
</a>
(and
<a class="link" href="explain-output.html#jointype_system">
<code class="literal">
system
</code>
</a>
) tables and
notice that the
<code class="literal">
WHERE
</code>
clause is always
false.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
LooseScan(
<em class="replaceable">
<code>
m
</code>
</em>
..
<em class="replaceable">
<code>
n
</code>
</em>
)
</code>
(JSON property:
<code class="literal">
message
</code>
)
</p>
<p>
The semijoin LooseScan strategy is used.
<em class="replaceable">
<code>
m
</code>
</em>
and
<em class="replaceable">
<code>
n
</code>
</em>
are key part numbers.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
No matching min/max row
</code>
(JSON property:
<code class="literal">
message
</code>
)
</p>
<p>
No row satisfies the condition for a query such as
<code class="literal">
SELECT MIN(...) FROM ... WHERE
<em class="replaceable">
<code>
condition
</code>
</em>
</code>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
no matching row in const table
</code>
(JSON
property:
<code class="literal">
message
</code>
)
</p>
<p>
For a query with a join, there was an empty table or a
table with no rows satisfying a unique index condition.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
No matching rows after partition
pruning
</code>
(JSON property:
<code class="literal">
message
</code>
)
</p>
<p>
For
<a class="link" href="delete.html" title="15.2.2 DELETE Statement">
<code class="literal">
DELETE
</code>
</a>
or
<a class="link" href="update.html" title="15.2.17 UPDATE Statement">
<code class="literal">
UPDATE
</code>
</a>
, the optimizer found
nothing to delete or update after partition pruning. It is
similar in meaning to
<code class="literal">
Impossible WHERE
</code>
for
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
statements.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
No tables used
</code>
(JSON property:
<code class="literal">
message
</code>
)
</p>
<p>
The query has no
<code class="literal">
FROM
</code>
clause, or has a
<code class="literal">
FROM DUAL
</code>
clause.
</p>
<p>
For
<a class="link" href="insert.html" title="15.2.7 INSERT Statement">
<code class="literal">
INSERT
</code>
</a>
or
<a class="link" href="replace.html" title="15.2.12 REPLACE Statement">
<code class="literal">
REPLACE
</code>
</a>
statements,
<a class="link" href="explain.html" title="15.8.2 EXPLAIN Statement">
<code class="literal">
EXPLAIN
</code>
</a>
displays this value
when there is no
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
part. For example, it appears for
<code class="literal">
EXPLAIN INSERT
INTO t VALUES(10)
</code>
because that is equivalent to
<code class="literal">
EXPLAIN INSERT INTO t SELECT 10 FROM
DUAL
</code>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
Not exists
</code>
(JSON property:
<code class="literal">
message
</code>
)
</p>
<p>
MySQL was able to do a
<code class="literal">
LEFT JOIN
</code>
optimization on the query and does not examine more rows
in this table for the previous row combination after it
finds one row that matches the
<code class="literal">
LEFT
JOIN
</code>
criteria. Here is an example of the type of
query that can be optimized this way:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa96169046"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> t1 <span class="token keyword">LEFT</span> <span class="token keyword">JOIN</span> t2 <span class="token keyword">ON</span> t1<span class="token punctuation">.</span>id<span class="token operator">=</span>t2<span class="token punctuation">.</span>id
<span class="token keyword">WHERE</span> t2<span class="token punctuation">.</span>id <span class="token operator">IS</span> <span class="token boolean">NULL</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Assume that
<code class="literal">
t2.id
</code>
is defined as
<code class="literal">
NOT NULL
</code>
. In this case, MySQL scans
<code class="literal">
t1
</code>
and looks up the rows in
<code class="literal">
t2
</code>
using the values of
<code class="literal">
t1.id
</code>
. If MySQL finds a matching row in
<code class="literal">
t2
</code>
, it knows that
<code class="literal">
t2.id
</code>
can never be
<code class="literal">
NULL
</code>
, and does not scan through the
rest of the rows in
<code class="literal">
t2
</code>
that have the
same
<code class="literal">
id
</code>
value. In other words, for each
row in
<code class="literal">
t1
</code>
, MySQL needs to do only a
single lookup in
<code class="literal">
t2
</code>
, regardless of how
many rows actually match in
<code class="literal">
t2
</code>
.
</p>
<p>
This can also indicate that a
<code class="literal">
WHERE
</code>
condition of the form
<code class="literal">
NOT IN
(
<em class="replaceable">
<code>
subquery
</code>
</em>
)
</code>
or
<code class="literal">
NOT EXISTS
(
<em class="replaceable">
<code>
subquery
</code>
</em>
)
</code>
has been
transformed internally into an antijoin. This removes the
subquery and brings its tables into the plan for the
topmost query, providing improved cost planning. By
merging semijoins and antijoins, the optimizer can reorder
tables in the execution plan more freely, in some cases
resulting in a faster plan.
</p>
<p>
You can see when an antijoin transformation is performed
for a given query by checking the
<code class="literal">
Message
</code>
column from
<code class="literal">
SHOW
WARNINGS
</code>
following execution of
<code class="literal">
EXPLAIN
</code>
, or in the output of
<code class="literal">
EXPLAIN FORMAT=TREE
</code>
.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
An antijoin is the complement of a semijoin
<code class="literal">
<em class="replaceable">
<code>
table_a
</code>
</em>
JOIN
<em class="replaceable">
<code>
table_b
</code>
</em>
ON
<em class="replaceable">
<code>
condition
</code>
</em>
</code>
. The
antijoin returns all rows from
<em class="replaceable">
<code>
table_a
</code>
</em>
for which there is
<span class="emphasis">
<em>
no
</em>
</span>
row in
<em class="replaceable">
<code>
table_b
</code>
</em>
which matches
<em class="replaceable">
<code>
condition
</code>
</em>
.
</p>
</div>
</li>
<li class="listitem">
<p>
<code class="literal">
Plan isn't ready yet
</code>
(JSON property:
none)
</p>
<p>
This value occurs with
<a class="link" href="explain-for-connection.html" title="10.8.4 Obtaining Execution Plan Information for a Named Connection">
<code class="literal">
EXPLAIN FOR
CONNECTION
</code>
</a>
when the optimizer has not finished
creating the execution plan for the statement executing in
the named connection. If execution plan output comprises
multiple lines, any or all of them could have this
<code class="literal">
Extra
</code>
value, depending on the progress
of the optimizer in determining the full execution plan.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
Range checked for each record (index map:
<em class="replaceable">
<code>
N
</code>
</em>
)
</code>
(JSON property:
<code class="literal">
message
</code>
)
</p>
<p>
MySQL found no good index to use, but found that some of
indexes might be used after column values from preceding
tables are known. For each row combination in the
preceding tables, MySQL checks whether it is possible to
use a
<a class="link" href="explain-output.html#jointype_range">
<code class="literal">
range
</code>
</a>
or
<a class="link" href="explain-output.html#jointype_index_merge">
<code class="literal">
index_merge
</code>
</a>
access
method to retrieve rows. This is not very fast, but is
faster than performing a join with no index at all. The
applicability criteria are as described in
<a class="xref" href="range-optimization.html" title="10.2.1.2 Range Optimization">
Section 10.2.1.2, “Range Optimization”
</a>
, and
<a class="xref" href="index-merge-optimization.html" title="10.2.1.3 Index Merge Optimization">
Section 10.2.1.3, “Index Merge Optimization”
</a>
, with the
exception that all column values for the preceding table
are known and considered to be constants.
</p>
<p>
Indexes are numbered beginning with 1, in the same order
as shown by
<a class="link" href="show-index.html" title="15.7.7.23 SHOW INDEX Statement">
<code class="literal">
SHOW INDEX
</code>
</a>
for
the table. The index map value
<em class="replaceable">
<code>
N
</code>
</em>
is a bitmask value that
indicates which indexes are candidates. For example, a
value of
<code class="literal">
0x19
</code>
(binary 11001) means that
indexes 1, 4, and 5 are considered.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
Recursive
</code>
(JSON property:
<code class="literal">
recursive
</code>
)
</p>
<p>
This indicates that the row applies to the recursive
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
part of a recursive
common table expression. See
<a class="xref" href="with.html" title="15.2.20 WITH (Common Table Expressions)">
Section 15.2.20, “WITH (Common Table Expressions)”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
Rematerialize
</code>
(JSON property:
<code class="literal">
rematerialize
</code>
)
</p>
<a class="indexterm" name="idm46045224938320">
</a>
<a class="indexterm" name="idm46045224936832">
</a>
<p>
<code class="literal">
Rematerialize (X,...)
</code>
is displayed in
the
<code class="literal">
EXPLAIN
</code>
row for table
<code class="literal">
T
</code>
, where
<code class="literal">
X
</code>
is any
lateral derived table whose rematerialization is triggered
when a new row of
<code class="literal">
T
</code>
is read. For
example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa53047838"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SELECT</span>
<span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span>
<span class="token keyword">FROM</span>
t<span class="token punctuation">,</span>
<span class="token keyword">LATERAL</span> <span class="token punctuation">(</span><em class="replaceable">derived <span class="token keyword">table</span> that refers <span class="token keyword">to</span> t</em><span class="token punctuation">)</span> <span class="token keyword">AS</span> dt
<span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span></code></pre>
</div>
<p>
The content of the derived table is rematerialized to
bring it up to date each time a new row of
<code class="literal">
t
</code>
is processed by the top query.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
Scanned
<em class="replaceable">
<code>
N
</code>
</em>
databases
</code>
(JSON property:
<code class="literal">
message
</code>
)
</p>
<p>
This indicates how many directory scans the server
performs when processing a query for
<code class="literal">
INFORMATION_SCHEMA
</code>
tables, as described
in
<a class="xref" href="information-schema-optimization.html" title="10.2.3 Optimizing INFORMATION_SCHEMA Queries">
Section 10.2.3, “Optimizing INFORMATION_SCHEMA Queries”
</a>
. The
value of
<em class="replaceable">
<code>
N
</code>
</em>
can be 0, 1, or
<code class="literal">
all
</code>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
Select tables optimized away
</code>
(JSON
property:
<code class="literal">
message
</code>
)
</p>
<p>
The optimizer determined 1) that at most one row should be
returned, and 2) that to produce this row, a deterministic
set of rows must be read. When the rows to be read can be
read during the optimization phase (for example, by
reading index rows), there is no need to read any tables
during query execution.
</p>
<p>
The first condition is fulfilled when the query is
implicitly grouped (contains an aggregate function but no
<code class="literal">
GROUP BY
</code>
clause). The second condition
is fulfilled when one row lookup is performed per index
used. The number of indexes read determines the number of
rows to read.
</p>
<p>
Consider the following implicitly grouped query:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa6910043"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SELECT</span> <span class="token function">MIN</span><span class="token punctuation">(</span>c1<span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token function">MIN</span><span class="token punctuation">(</span>c2<span class="token punctuation">)</span> <span class="token keyword">FROM</span> t1<span class="token punctuation">;</span></code></pre>
</div>
<p>
Suppose that
<code class="literal">
MIN(c1)
</code>
can be retrieved
by reading one index row and
<code class="literal">
MIN(c2)
</code>
can be retrieved by reading one row from a different
index. That is, for each column
<code class="literal">
c1
</code>
and
<code class="literal">
c2
</code>
, there exists an index where the
column is the first column of the index. In this case, one
row is returned, produced by reading two deterministic
rows.
</p>
<p>
This
<code class="literal">
Extra
</code>
value does not occur if the
rows to read are not deterministic. Consider this query:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa29006230"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SELECT</span> <span class="token function">MIN</span><span class="token punctuation">(</span>c2<span class="token punctuation">)</span> <span class="token keyword">FROM</span> t1 <span class="token keyword">WHERE</span> c1 <span class="token operator"><=</span> <span class="token number">10</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Suppose that
<code class="literal">
(c1, c2)
</code>
is a covering
index. Using this index, all rows with
<code class="literal">
c1 <=
10
</code>
must be scanned to find the minimum
<code class="literal">
c2
</code>
value. By contrast, consider this
query:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa315111"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SELECT</span> <span class="token function">MIN</span><span class="token punctuation">(</span>c2<span class="token punctuation">)</span> <span class="token keyword">FROM</span> t1 <span class="token keyword">WHERE</span> c1 <span class="token operator">=</span> <span class="token number">10</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
In this case, the first index row with
<code class="literal">
c1 =
10
</code>
contains the minimum
<code class="literal">
c2
</code>
value. Only one row must be read to produce the returned
row.
</p>
<p>
For storage engines that maintain an exact row count per
table (such as
<code class="literal">
MyISAM
</code>
, but not
<code class="literal">
InnoDB
</code>
), this
<code class="literal">
Extra
</code>
value can occur for
<code class="literal">
COUNT(*)
</code>
queries
for which the
<code class="literal">
WHERE
</code>
clause is missing
or always true and there is no
<code class="literal">
GROUP BY
</code>
clause. (This is an instance of an implicitly grouped
query where the storage engine influences whether a
deterministic number of rows can be read.)
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
Skip_open_table
</code>
,
<code class="literal">
Open_frm_only
</code>
,
<code class="literal">
Open_full_table
</code>
(JSON property:
<code class="literal">
message
</code>
)
</p>
<p>
These values indicate file-opening optimizations that
apply to queries for
<code class="literal">
INFORMATION_SCHEMA
</code>
tables.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<code class="literal">
Skip_open_table
</code>
: Table files do not
need to be opened. The information is already
available from the data dictionary.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
Open_frm_only
</code>
: Only the data
dictionary need be read for table information.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
Open_full_table
</code>
: Unoptimized
information lookup. Table information must be read
from the data dictionary and by reading table files.
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
<code class="literal">
Start temporary
</code>
,
<code class="literal">
End
temporary
</code>
(JSON property:
<code class="literal">
message
</code>
)
</p>
<p>
This indicates temporary table use for the semijoin
Duplicate Weedout strategy.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
unique row not found
</code>
(JSON property:
<code class="literal">
message
</code>
)
</p>
<p>
For a query such as
<code class="literal">
SELECT ... FROM
<em class="replaceable">
<code>
tbl_name
</code>
</em>
</code>
, no rows
satisfy the condition for a
<code class="literal">
UNIQUE
</code>
index or
<code class="literal">
PRIMARY KEY
</code>
on the table.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
Using filesort
</code>
(JSON property:
<code class="literal">
using_filesort
</code>
)
</p>
<p>
MySQL must do an extra pass to find out how to retrieve
the rows in sorted order. The sort is done by going
through all rows according to the join type and storing
the sort key and pointer to the row for all rows that
match the
<code class="literal">
WHERE
</code>
clause. The keys then
are sorted and the rows are retrieved in sorted order. See
<a class="xref" href="order-by-optimization.html" title="10.2.1.16 ORDER BY Optimization">
Section 10.2.1.16, “ORDER BY Optimization”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
Using index
</code>
(JSON property:
<code class="literal">
using_index
</code>
)
</p>
<p>
The column information is retrieved from the table using
only information in the index tree without having to do an
additional seek to read the actual row. This strategy can
be used when the query uses only columns that are part of
a single index.
</p>
<p>
For
<code class="literal">
InnoDB
</code>
tables that have a
user-defined clustered index, that index can be used even
when
<code class="literal">
Using index
</code>
is absent from the
<code class="literal">
Extra
</code>
column. This is the case if
<code class="literal">
type
</code>
is
<a class="link" href="explain-output.html#jointype_index">
<code class="literal">
index
</code>
</a>
and
<code class="literal">
key
</code>
is
<code class="literal">
PRIMARY
</code>
.
</p>
<p>
Information about any covering indexes used is shown for
<code class="literal">
EXPLAIN FORMAT=TRADITIONAL
</code>
and
<code class="literal">
EXPLAIN FORMAT=JSON
</code>
. It is also shown
for
<code class="literal">
EXPLAIN FORMAT=TREE
</code>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
Using index condition
</code>
(JSON property:
<code class="literal">
using_index_condition
</code>
)
</p>
<p>
Tables are read by accessing index tuples and testing them
first to determine whether to read full table rows. In
this way, index information is used to defer (
<span class="quote">
“
<span class="quote">
push
down
</span>
”
</span>
) reading full table rows unless it is
necessary. See
<a class="xref" href="index-condition-pushdown-optimization.html" title="10.2.1.6 Index Condition Pushdown Optimization">
Section 10.2.1.6, “Index Condition Pushdown Optimization”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
Using index for group-by
</code>
(JSON
property:
<code class="literal">
using_index_for_group_by
</code>
)
</p>
<p>
Similar to the
<code class="literal">
Using index
</code>
table access
method,
<code class="literal">
Using index for group-by
</code>
indicates that MySQL found an index that can be used to
retrieve all columns of a
<code class="literal">
GROUP BY
</code>
or
<code class="literal">
DISTINCT
</code>
query without any extra disk
access to the actual table. Additionally, the index is
used in the most efficient way so that for each group,
only a few index entries are read. For details, see
<a class="xref" href="group-by-optimization.html" title="10.2.1.17 GROUP BY Optimization">
Section 10.2.1.17, “GROUP BY Optimization”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
Using index for skip scan
</code>
(JSON
property:
<code class="literal">
using_index_for_skip_scan
</code>
)
</p>
<p>
Indicates that the Skip Scan access method is used. See
<a class="xref" href="range-optimization.html#range-access-skip-scan" title="Skip Scan Range Access Method">
Skip Scan Range Access Method
</a>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
Using join buffer (Block Nested Loop)
</code>
,
<code class="literal">
Using join buffer (Batched Key Access)
</code>
,
<code class="literal">
Using join buffer (hash join)
</code>
(JSON
property:
<code class="literal">
using_join_buffer
</code>
)
</p>
<p>
Tables from earlier joins are read in portions into the
join buffer, and then their rows are used from the buffer
to perform the join with the current table.
<code class="literal">
(Block Nested Loop)
</code>
indicates use of
the Block Nested-Loop algorithm,
<code class="literal">
(Batched Key
Access)
</code>
indicates use of the Batched Key Access
algorithm, and
<code class="literal">
(hash join)
</code>
indicates
use of a hash join. That is, the keys from the table on
the preceding line of the
<a class="link" href="explain.html" title="15.8.2 EXPLAIN Statement">
<code class="literal">
EXPLAIN
</code>
</a>
output are
buffered, and the matching rows are fetched in batches
from the table represented by the line in which
<code class="literal">
Using join buffer
</code>
appears.
</p>
<p>
In JSON-formatted output, the value of
<code class="literal">
using_join_buffer
</code>
is always one of
<code class="literal">
Block Nested Loop
</code>
,
<code class="literal">
Batched Key
Access
</code>
, or
<code class="literal">
hash join
</code>
.
</p>
<p>
For more information about hash joins, see
<a class="xref" href="hash-joins.html" title="10.2.1.4 Hash Join Optimization">
Section 10.2.1.4, “Hash Join Optimization”
</a>
.
</p>
<p>
See
<a class="xref" href="bnl-bka-optimization.html#bka-optimization" title="Batched Key Access Joins">
Batched Key Access Joins
</a>
, for information
about the Batched Key Access algorithm.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
Using MRR
</code>
(JSON property:
<code class="literal">
message
</code>
)
</p>
<p>
Tables are read using the Multi-Range Read optimization
strategy. See
<a class="xref" href="mrr-optimization.html" title="10.2.1.11 Multi-Range Read Optimization">
Section 10.2.1.11, “Multi-Range Read Optimization”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
Using sort_union(...)
</code>
,
<code class="literal">
Using
union(...)
</code>
,
<code class="literal">
Using
intersect(...)
</code>
(JSON property:
<code class="literal">
message
</code>
)
</p>
<p>
These indicate the particular algorithm showing how index
scans are merged for the
<a class="link" href="explain-output.html#jointype_index_merge">
<code class="literal">
index_merge
</code>
</a>
join type.
See
<a class="xref" href="index-merge-optimization.html" title="10.2.1.3 Index Merge Optimization">
Section 10.2.1.3, “Index Merge Optimization”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
Using temporary
</code>
(JSON property:
<code class="literal">
using_temporary_table
</code>
)
</p>
<p>
To resolve the query, MySQL needs to create a temporary
table to hold the result. This typically happens if the
query contains
<code class="literal">
GROUP BY
</code>
and
<code class="literal">
ORDER BY
</code>
clauses that list columns
differently.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
Using where
</code>
(JSON property:
<code class="literal">
attached_condition
</code>
)
</p>
<p>
A
<code class="literal">
WHERE
</code>
clause is used to restrict
which rows to match against the next table or send to the
client. Unless you specifically intend to fetch or examine
all rows from the table, you may have something wrong in
your query if the
<code class="literal">
Extra
</code>
value is not
<code class="literal">
Using where
</code>
and the table join type is
<a class="link" href="explain-output.html#jointype_all">
<code class="literal">
ALL
</code>
</a>
or
<a class="link" href="explain-output.html#jointype_index">
<code class="literal">
index
</code>
</a>
.
</p>
<p>
<code class="literal">
Using where
</code>
has no direct counterpart
in JSON-formatted output; the
<code class="literal">
attached_condition
</code>
property contains
any
<code class="literal">
WHERE
</code>
condition used.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
Using where with pushed condition
</code>
(JSON
property:
<code class="literal">
message
</code>
)
</p>
<p>
This item applies to
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
tables
<span class="emphasis">
<em>
only
</em>
</span>
. It means that NDB
Cluster is using the Condition Pushdown optimization to
improve the efficiency of a direct comparison between a
nonindexed column and a constant. In such cases, the
condition is
<span class="quote">
“
<span class="quote">
pushed down
</span>
”
</span>
to the
cluster's data nodes and is evaluated on all data
nodes simultaneously. This eliminates the need to send
nonmatching rows over the network, and can speed up such
queries by a factor of 5 to 10 times over cases where
Condition Pushdown could be but is not used. For more
information, see
<a class="xref" href="engine-condition-pushdown-optimization.html" title="10.2.1.5 Engine Condition Pushdown Optimization">
Section 10.2.1.5, “Engine Condition Pushdown Optimization”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
Zero limit
</code>
(JSON property:
<code class="literal">
message
</code>
)
</p>
<p>
The query had a
<code class="literal">
LIMIT 0
</code>
clause and
cannot select any rows.
</p>
</li>
</ul>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="explain-output-interpretation">
</a>
EXPLAIN Output Interpretation
</h4>
</div>
</div>
</div>
<p>
You can get a good indication of how good a join is by taking
the product of the values in the
<code class="literal">
rows
</code>
column of the
<a class="link" href="explain.html" title="15.8.2 EXPLAIN Statement">
<code class="literal">
EXPLAIN
</code>
</a>
output.
This should tell you roughly how many rows MySQL must examine
to execute the query. If you restrict queries with the
<a class="link" href="server-system-variables.html#sysvar_max_join_size">
<code class="literal">
max_join_size
</code>
</a>
system
variable, this row product also is used to determine which
multiple-table
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
statements to execute and which to abort. See
<a class="xref" href="server-configuration.html" title="7.1.1 Configuring the Server">
Section 7.1.1, “Configuring the Server”
</a>
.
</p>
<p>
The following example shows how a multiple-table join can be
optimized progressively based on the information provided by
<a class="link" href="explain.html" title="15.8.2 EXPLAIN Statement">
<code class="literal">
EXPLAIN
</code>
</a>
.
</p>
<p>
Suppose that you have the
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
statement shown here and
that you plan to examine it using
<a class="link" href="explain.html" title="15.8.2 EXPLAIN Statement">
<code class="literal">
EXPLAIN
</code>
</a>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa38518014"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">EXPLAIN</span> <span class="token keyword">SELECT</span> tt<span class="token punctuation">.</span>TicketNumber<span class="token punctuation">,</span> tt<span class="token punctuation">.</span>TimeIn<span class="token punctuation">,</span>
tt<span class="token punctuation">.</span>ProjectReference<span class="token punctuation">,</span> tt<span class="token punctuation">.</span>EstimatedShipDate<span class="token punctuation">,</span>
tt<span class="token punctuation">.</span>ActualShipDate<span class="token punctuation">,</span> tt<span class="token punctuation">.</span>ClientID<span class="token punctuation">,</span>
tt<span class="token punctuation">.</span>ServiceCodes<span class="token punctuation">,</span> tt<span class="token punctuation">.</span>RepetitiveID<span class="token punctuation">,</span>
tt<span class="token punctuation">.</span>CurrentProcess<span class="token punctuation">,</span> tt<span class="token punctuation">.</span>CurrentDPPerson<span class="token punctuation">,</span>
tt<span class="token punctuation">.</span>RecordVolume<span class="token punctuation">,</span> tt<span class="token punctuation">.</span>DPPrinted<span class="token punctuation">,</span> et<span class="token punctuation">.</span>COUNTRY<span class="token punctuation">,</span>
et_1<span class="token punctuation">.</span>COUNTRY<span class="token punctuation">,</span> <span class="token keyword">do</span><span class="token punctuation">.</span>CUSTNAME
<span class="token keyword">FROM</span> tt<span class="token punctuation">,</span> et<span class="token punctuation">,</span> et <span class="token keyword">AS</span> et_1<span class="token punctuation">,</span> <span class="token keyword">do</span>
<span class="token keyword">WHERE</span> tt<span class="token punctuation">.</span>SubmitTime <span class="token operator">IS</span> <span class="token boolean">NULL</span>
<span class="token operator">AND</span> tt<span class="token punctuation">.</span>ActualPC <span class="token operator">=</span> et<span class="token punctuation">.</span>EMPLOYID
<span class="token operator">AND</span> tt<span class="token punctuation">.</span>AssignedPC <span class="token operator">=</span> et_1<span class="token punctuation">.</span>EMPLOYID
<span class="token operator">AND</span> tt<span class="token punctuation">.</span>ClientID <span class="token operator">=</span> <span class="token keyword">do</span><span class="token punctuation">.</span>CUSTNMBR<span class="token punctuation">;</span></code></pre>
</div>
<p>
For this example, make the following assumptions:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
The columns being compared have been declared as follows.
</p>
<div class="informaltable">
<table summary="Table names, column names, and data types for the columns being compared in the EXPLAIN example described in the preceding text.">
<colgroup>
<col style="width: 10%"/>
<col style="width: 25%"/>
<col style="width: 25%"/>
</colgroup>
<thead>
<tr>
<th scope="col">
Table
</th>
<th scope="col">
Column
</th>
<th scope="col">
Data Type
</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">
<code class="literal">
tt
</code>
</th>
<td>
<code class="literal">
ActualPC
</code>
</td>
<td>
<code class="literal">
CHAR(10)
</code>
</td>
</tr>
<tr>
<th scope="row">
<code class="literal">
tt
</code>
</th>
<td>
<code class="literal">
AssignedPC
</code>
</td>
<td>
<code class="literal">
CHAR(10)
</code>
</td>
</tr>
<tr>
<th scope="row">
<code class="literal">
tt
</code>
</th>
<td>
<code class="literal">
ClientID
</code>
</td>
<td>
<code class="literal">
CHAR(10)
</code>
</td>
</tr>
<tr>
<th scope="row">
<code class="literal">
et
</code>
</th>
<td>
<code class="literal">
EMPLOYID
</code>
</td>
<td>
<code class="literal">
CHAR(15)
</code>
</td>
</tr>
<tr>
<th scope="row">
<code class="literal">
do
</code>
</th>
<td>
<code class="literal">
CUSTNMBR
</code>
</td>
<td>
<code class="literal">
CHAR(15)
</code>
</td>
</tr>
</tbody>
</table>
</div>
</li>
<li class="listitem">
<p>
The tables have the following indexes.
</p>
<div class="informaltable">
<table summary="Indexes for each of the tables that are part of the EXPLAIN example described in the preceding text.">
<colgroup>
<col style="width: 10%"/>
<col style="width: 40%"/>
</colgroup>
<thead>
<tr>
<th>
Table
</th>
<th>
Index
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<code class="literal">
tt
</code>
</td>
<td>
<code class="literal">
ActualPC
</code>
</td>
</tr>
<tr>
<td>
<code class="literal">
tt
</code>
</td>
<td>
<code class="literal">
AssignedPC
</code>
</td>
</tr>
<tr>
<td>
<code class="literal">
tt
</code>
</td>
<td>
<code class="literal">
ClientID
</code>
</td>
</tr>
<tr>
<td>
<code class="literal">
et
</code>
</td>
<td>
<code class="literal">
EMPLOYID
</code>
(primary key)
</td>
</tr>
<tr>
<td>
<code class="literal">
do
</code>
</td>
<td>
<code class="literal">
CUSTNMBR
</code>
(primary key)
</td>
</tr>
</tbody>
</table>
</div>
</li>
<li class="listitem">
<p>
The
<code class="literal">
tt.ActualPC
</code>
values are not evenly
distributed.
</p>
</li>
</ul>
</div>
<p>
Initially, before any optimizations have been performed, the
<a class="link" href="explain.html" title="15.8.2 EXPLAIN Statement">
<code class="literal">
EXPLAIN
</code>
</a>
statement produces the
following information:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-none"><div class="docs-select-all right" id="sa70481847"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-none">table type possible_keys key key_len ref rows Extra
et ALL PRIMARY NULL NULL NULL 74
do ALL PRIMARY NULL NULL NULL 2135
et_1 ALL PRIMARY NULL NULL NULL 74
tt ALL AssignedPC, NULL NULL NULL 3872
ClientID,
ActualPC
Range checked for each record (index map: 0x23)</code></pre>
</div>
<p>
Because
<code class="literal">
type
</code>
is
<a class="link" href="explain-output.html#jointype_all">
<code class="literal">
ALL
</code>
</a>
for each table, this
output indicates that MySQL is generating a Cartesian product
of all the tables; that is, every combination of rows. This
takes quite a long time, because the product of the number of
rows in each table must be examined. For the case at hand,
this product is 74 × 2135 × 74 × 3872 =
45,268,558,720 rows. If the tables were bigger, you can only
imagine how long it would take.
</p>
<p>
One problem here is that MySQL can use indexes on columns more
efficiently if they are declared as the same type and size. In
this context,
<a class="link" href="char.html" title="13.3.2 The CHAR and VARCHAR Types">
<code class="literal">
VARCHAR
</code>
</a>
and
<a class="link" href="char.html" title="13.3.2 The CHAR and VARCHAR Types">
<code class="literal">
CHAR
</code>
</a>
are considered the same if
they are declared as the same size.
<code class="literal">
tt.ActualPC
</code>
is declared as
<code class="literal">
CHAR(10)
</code>
and
<code class="literal">
et.EMPLOYID
</code>
is
<code class="literal">
CHAR(15)
</code>
, so there is a length mismatch.
</p>
<p>
To fix this disparity between column lengths, use
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER TABLE
</code>
</a>
to lengthen
<code class="literal">
ActualPC
</code>
from 10 characters to 15
characters:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa47696146"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">ALTER</span> <span class="token keyword">TABLE</span> tt <span class="token keyword">MODIFY</span> ActualPC <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">15</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Now
<code class="literal">
tt.ActualPC
</code>
and
<code class="literal">
et.EMPLOYID
</code>
are both
<code class="literal">
VARCHAR(15)
</code>
. Executing the
<a class="link" href="explain.html" title="15.8.2 EXPLAIN Statement">
<code class="literal">
EXPLAIN
</code>
</a>
statement again
produces this result:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-none"><div class="docs-select-all right" id="sa59432535"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-none">table type possible_keys key key_len ref rows Extra
tt ALL AssignedPC, NULL NULL NULL 3872 Using
ClientID, where
ActualPC
do ALL PRIMARY NULL NULL NULL 2135
Range checked for each record (index map: 0x1)
et_1 ALL PRIMARY NULL NULL NULL 74
Range checked for each record (index map: 0x1)
et eq_ref PRIMARY PRIMARY 15 tt.ActualPC 1</code></pre>
</div>
<p>
This is not perfect, but is much better: The product of the
<code class="literal">
rows
</code>
values is less by a factor of 74. This
version executes in a couple of seconds.
</p>
<p>
A second alteration can be made to eliminate the column length
mismatches for the
<code class="literal">
tt.AssignedPC =
et_1.EMPLOYID
</code>
and
<code class="literal">
tt.ClientID =
do.CUSTNMBR
</code>
comparisons:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa10146284"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">ALTER</span> <span class="token keyword">TABLE</span> tt <span class="token keyword">MODIFY</span> AssignedPC <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">15</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">MODIFY</span> ClientID <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">15</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
After that modification,
<a class="link" href="explain.html" title="15.8.2 EXPLAIN Statement">
<code class="literal">
EXPLAIN
</code>
</a>
produces the output
shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-none"><div class="docs-select-all right" id="sa39975523"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-none">table type possible_keys key key_len ref rows Extra
et ALL PRIMARY NULL NULL NULL 74
tt ref AssignedPC, ActualPC 15 et.EMPLOYID 52 Using
ClientID, where
ActualPC
et_1 eq_ref PRIMARY PRIMARY 15 tt.AssignedPC 1
do eq_ref PRIMARY PRIMARY 15 tt.ClientID 1</code></pre>
</div>
<p>
At this point, the query is optimized almost as well as
possible. The remaining problem is that, by default, MySQL
assumes that values in the
<code class="literal">
tt.ActualPC
</code>
column are evenly distributed, and that is not the case for
the
<code class="literal">
tt
</code>
table. Fortunately, it is easy to
tell MySQL to analyze the key distribution:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa29303613"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">ANALYZE</span> <span class="token keyword">TABLE</span> tt<span class="token punctuation">;</span></code></pre>
</div>
<p>
With the additional index information, the join is perfect and
<a class="link" href="explain.html" title="15.8.2 EXPLAIN Statement">
<code class="literal">
EXPLAIN
</code>
</a>
produces this result:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-none"><div class="docs-select-all right" id="sa27683717"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-none">table type possible_keys key key_len ref rows Extra
tt ALL AssignedPC NULL NULL NULL 3872 Using
ClientID, where
ActualPC
et eq_ref PRIMARY PRIMARY 15 tt.ActualPC 1
et_1 eq_ref PRIMARY PRIMARY 15 tt.AssignedPC 1
do eq_ref PRIMARY PRIMARY 15 tt.ClientID 1</code></pre>
</div>
<p>
<a class="indexterm" name="idm46045224698032">
</a>
The
<code class="literal">
rows
</code>
column in the output from
<a class="link" href="explain.html" title="15.8.2 EXPLAIN Statement">
<code class="literal">
EXPLAIN
</code>
</a>
is an educated guess
from the MySQL join optimizer. Check whether the numbers are
even close to the truth by comparing the
<code class="literal">
rows
</code>
product with the actual number of rows
that the query returns. If the numbers are quite different,
you might get better performance by using
<code class="literal">
STRAIGHT_JOIN
</code>
in your
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
statement and trying to
list the tables in a different order in the
<code class="literal">
FROM
</code>
clause. (However,
<code class="literal">
STRAIGHT_JOIN
</code>
may prevent indexes from
being used because it disables semijoin transformations. See
<a class="ulink" href="/doc/refman/8.0/en/semijoins.html" target="_top">
Optimizing IN and EXISTS Subquery Predicates with Semijoin Transformations
</a>
.)
</p>
<p>
It is possible in some cases to execute statements that modify
data when
<a class="link" href="explain.html" title="15.8.2 EXPLAIN Statement">
<code class="literal">
EXPLAIN
SELECT
</code>
</a>
is used with a subquery; for more
information, see
<a class="xref" href="derived-tables.html" title="15.2.15.8 Derived Tables">
Section 15.2.15.8, “Derived Tables”
</a>
.
</p>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/constant-folding-optimization.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="constant-folding-optimization">
</a>
10.2.1.14 Constant-Folding Optimization
</h4>
</div>
</div>
</div>
<p>
Comparisons between constants and column values in which the
constant value is out of range or of the wrong type with
respect to the column type are now handled once during query
optimization rather row-by-row than during execution. The
comparisons that can be treated in this manner are
<code class="literal">
>
</code>
,
<code class="literal">
>=
</code>
,
<code class="literal">
<
</code>
,
<code class="literal">
<=
</code>
,
<code class="literal">
<>
</code>
/
<code class="literal">
!=
</code>
,
<code class="literal">
=
</code>
, and
<code class="literal">
<=>
</code>
.
</p>
<p>
Consider the table created by the following statement:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa67899103"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> t <span class="token punctuation">(</span>c <span class="token datatype">TINYINT</span> <span class="token keyword">UNSIGNED</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
The
<code class="literal">
WHERE
</code>
condition in the query
<code class="literal">
SELECT * FROM t WHERE c < 256
</code>
contains
the integral constant 256 which is out of range for a
<code class="literal">
TINYINT UNSIGNED
</code>
column. Previously, this
was handled by treating both operands as the larger type, but
now, since any allowed value for
<code class="literal">
c
</code>
is less
than the constant, the
<code class="literal">
WHERE
</code>
expression can
instead be folded as
<code class="literal">
WHERE 1
</code>
, so that the
query is rewritten as
<code class="literal">
SELECT * FROM t WHERE
1
</code>
.
</p>
<p>
This makes it possible for the optimizer to remove the
<code class="literal">
WHERE
</code>
expression altogether. If the column
<code class="literal">
c
</code>
were nullable (that is, defined only as
<code class="literal">
TINYINT UNSIGNED
</code>
) the query would be
rewritten like this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa84729493"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> t <span class="token keyword">WHERE</span> ti <span class="token operator">IS</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span></code></pre>
</div>
<p>
Folding is performed for constants compared to supported MySQL
column types as follows:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<b>
Integer column type.
</b>
Integer types are compared with constants of the
following types as described here:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<b>
Integer value.
</b>
If the constant is out of range for the column type,
the comparison is folded to
<code class="literal">
1
</code>
or
<code class="literal">
IS NOT NULL
</code>
, as already shown.
</p>
<p>
If the constant is a range boundary, the comparison is
folded to
<code class="literal">
=
</code>
. For example (using the
same table as already defined):
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa71432695"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">EXPLAIN</span> <span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> t <span class="token keyword">WHERE</span> c <span class="token operator">>=</span> <span class="token number">255</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span> 1. row <span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span>
id<span class="token punctuation">:</span> 1
select_type<span class="token punctuation">:</span> SIMPLE
table<span class="token punctuation">:</span> t
partitions<span class="token punctuation">:</span> NULL
type<span class="token punctuation">:</span> ALL
possible_keys<span class="token punctuation">:</span> NULL
key<span class="token punctuation">:</span> NULL
key_len<span class="token punctuation">:</span> NULL
ref<span class="token punctuation">:</span> NULL
rows<span class="token punctuation">:</span> 5
filtered<span class="token punctuation">:</span> 20.00
Extra<span class="token punctuation">:</span> Using where
</span><span class="token output">1 row in set, 1 warning (0.00 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">SHOW</span> <span class="token keyword">WARNINGS</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span> 1. row <span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span>
Level<span class="token punctuation">:</span> Note
Code<span class="token punctuation">:</span> 1003
Message<span class="token punctuation">:</span> /<span class="token punctuation">*</span> select#1 <span class="token punctuation">*</span>/ select `test`.`t`.`ti` AS `ti` from `test`.`t` where (`test`.`t`.`ti` = 255)
</span><span class="token output">1 row in set (0.00 sec)</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
<b>
Floating- or fixed-point value.
</b>
If the constant is one of the decimal types (such as
<code class="literal">
DECIMAL
</code>
,
<code class="literal">
REAL
</code>
,
<code class="literal">
DOUBLE
</code>
, or
<code class="literal">
FLOAT
</code>
) and has a nonzero decimal
portion, it cannot be equal; fold accordingly. For
other comparisons, round up or down to an integer
value according to the sign, then perform a range
check and handle as already described for
integer-integer comparisons.
</p>
<p>
A
<code class="literal">
REAL
</code>
value that is too small to
be represented as
<code class="literal">
DECIMAL
</code>
is
rounded to .01 or -.01 depending on the sign, then
handled as a
<code class="literal">
DECIMAL
</code>
.
</p>
</li>
<li class="listitem">
<p>
<b>
String types.
</b>
Try to interpret the string value as an integer
type, then handle the comparison as between integer
values. If this fails, attempt to handle the value
as a
<code class="literal">
REAL
</code>
.
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
<b>
DECIMAL or REAL column.
</b>
Decimal types are compared with constants of the
following types as described here:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<b>
Integer value.
</b>
Perform a range check against the column
value's integer part. If no folding results,
convert the constant to
<code class="literal">
DECIMAL
</code>
with the same number of decimal places as the column
value, then check it as a
<code class="literal">
DECIMAL
</code>
(see next).
</p>
</li>
<li class="listitem">
<p>
<b>
DECIMAL or REAL value.
</b>
Check for overflow (that is, whether the constant
has more digits in its integer part than allowed for
the column's decimal type). If so, fold.
</p>
<p>
If the constant has more significant fractional digits
than column's type, truncate the constant. If the
comparison operator is
<code class="literal">
=
</code>
or
<code class="literal">
<>
</code>
, fold. If the operator is
<code class="literal">
>=
</code>
or
<code class="literal">
<=
</code>
,
adjust the operator due to truncation. For example, if
column's type is
<code class="literal">
DECIMAL(3,1)
</code>
,
<code class="literal">
SELECT * FROM t WHERE f >= 10.13
</code>
becomes
<code class="literal">
SELECT * FROM t WHERE f >
10.1
</code>
.
</p>
<p>
If the constant has fewer decimal digits than the
column's type, convert it to a constant with same
number of digits. For underflow of a
<code class="literal">
REAL
</code>
value (that is, too few
fractional digits to represent it), convert the
constant to decimal 0.
</p>
</li>
<li class="listitem">
<p>
<b>
String value.
</b>
If the value can be interpreted as an integer type,
handle it as such. Otherwise, try to handle it as
<code class="literal">
REAL
</code>
.
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
<b>
FLOAT or DOUBLE column.
</b>
<code class="literal">
FLOAT(
<em class="replaceable">
<code>
m
</code>
</em>
,
<em class="replaceable">
<code>
n
</code>
</em>
)
</code>
or
<code class="literal">
DOUBLE(
<em class="replaceable">
<code>
m
</code>
</em>
,
<em class="replaceable">
<code>
n
</code>
</em>
)
</code>
values compared with constants are handled as follows:
</p>
<p>
If the value overflows the range of the column, fold.
</p>
<p>
If the value has more than
<em class="replaceable">
<code>
n
</code>
</em>
decimals, truncate, compensating during folding. For
<code class="literal">
=
</code>
and
<code class="literal">
<>
</code>
comparisons, fold to
<code class="literal">
TRUE
</code>
,
<code class="literal">
FALSE
</code>
, or
<code class="literal">
IS [NOT]
NULL
</code>
as described previously; for other
operators, adjust the operator.
</p>
<p>
If the value has more than
<code class="literal">
m
</code>
integer
digits, fold.
</p>
</li>
</ul>
</div>
<p>
<b>
Limitations.
</b>
This optimization cannot be used in the following cases:
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
With comparisons using
<code class="literal">
BETWEEN
</code>
or
<code class="literal">
IN
</code>
.
</p>
</li>
<li class="listitem">
<p>
With
<code class="literal">
BIT
</code>
columns or columns using date
or time types.
</p>
</li>
<li class="listitem">
<p>
During the preparation phase for a prepared statement,
although it can be applied during the optimization phase
when the prepared statement is actually executed. This due
to the fact that, during statement preparation, the value
of the constant is not yet known.
</p>
</li>
</ol>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/declare-cursor.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="declare-cursor">
</a>
15.6.6.2 Cursor DECLARE Statement
</h4>
</div>
</div>
</div>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa17583476"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">DECLARE</span> <span class="token keyword"><em class="replaceable">cursor_name</em></span> <span class="token keyword">CURSOR</span> <span class="token keyword">FOR</span> <em class="replaceable">select_statement</em></code></pre>
</div>
<p>
This statement declares a cursor and associates it with a
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
statement that retrieves
the rows to be traversed by the cursor. To fetch the rows later,
use a
<a class="link" href="fetch.html" title="15.6.6.3 Cursor FETCH Statement">
<code class="literal">
FETCH
</code>
</a>
statement. The number
of columns retrieved by the
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
statement must match the
number of output variables specified in the
<a class="link" href="fetch.html" title="15.6.6.3 Cursor FETCH Statement">
<code class="literal">
FETCH
</code>
</a>
statement.
</p>
<p>
The
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
statement cannot have
an
<code class="literal">
INTO
</code>
clause.
</p>
<p>
Cursor declarations must appear before handler declarations and
after variable and condition declarations.
</p>
<p>
A stored program may contain multiple cursor declarations, but
each cursor declared in a given block must have a unique name.
For an example, see
<a class="xref" href="cursors.html" title="15.6.6 Cursors">
Section 15.6.6, “Cursors”
</a>
.
</p>
<p>
For information available through
<a class="link" href="show.html" title="15.7.7 SHOW Statements">
<code class="literal">
SHOW
</code>
</a>
statements, it is possible
in many cases to obtain equivalent information by using a cursor
with an
<code class="literal">
INFORMATION_SCHEMA
</code>
table.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/plugin-services.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="plugin-services">
</a>
7.6.9 MySQL Plugin Services
</h3>
</div>
</div>
</div>
<div class="toc">
<dl class="toc">
<dt>
<span class="section">
<a href="locking-service.html">
7.6.9.1 The Locking Service
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="keyring-service.html">
7.6.9.2 The Keyring Service
</a>
</span>
</dt>
</dl>
</div>
<a class="indexterm" name="idm46045254522208">
</a>
<a class="indexterm" name="idm46045254521136">
</a>
<p>
MySQL server plugins have access to server
<span class="quote">
“
<span class="quote">
plugin
services.
</span>
”
</span>
The plugin services interface complements the
plugin API by exposing server functionality that plugins can call.
For developer information about writing plugin services, see
<a class="ulink" href="/doc/extending-mysql/8.4/en/services-for-plugins.html" target="_top">
MySQL Services for Plugins
</a>
. The following sections
describe plugin services available at the SQL and C-language
levels.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/reproducible-test-case.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="reproducible-test-case">
</a>
7.9.1.7 Making a Test Case If You Experience Table Corruption
</h4>
</div>
</div>
</div>
<p>
The following procedure applies to
<a class="link" href="myisam-storage-engine.html" title="18.2 The MyISAM Storage Engine">
<code class="literal">
MyISAM
</code>
</a>
tables. For information
about steps to take when encountering
<code class="literal">
InnoDB
</code>
table corruption, see
<a class="xref" href="bug-reports.html" title="1.6 How to Report Bugs or Problems">
Section 1.6, “How to Report Bugs or Problems”
</a>
.
</p>
<p>
If you encounter corrupted
<a class="link" href="myisam-storage-engine.html" title="18.2 The MyISAM Storage Engine">
<code class="literal">
MyISAM
</code>
</a>
tables or if
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
always fails after some
update statements, you can test whether the issue is
reproducible by doing the following:
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
Stop the MySQL daemon with
<a class="link" href="mysqladmin.html" title="6.5.2 mysqladmin — A MySQL Server Administration Program">
<span class="command">
<strong>
mysqladmin
shutdown
</strong>
</span>
</a>
.
</p>
</li>
<li class="listitem">
<p>
Make a backup of the tables to guard against the very
unlikely case that the repair does something bad.
</p>
</li>
<li class="listitem">
<p>
Check all tables with
<a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
<span class="command">
<strong>
myisamchk -s
database/*.MYI
</strong>
</span>
</a>
. Repair any corrupted tables with
<a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
<span class="command">
<strong>
myisamchk -r
database/
<em class="replaceable">
<code>
table
</code>
</em>
.MYI
</strong>
</span>
</a>
.
</p>
</li>
<li class="listitem">
<p>
Make a second backup of the tables.
</p>
</li>
<li class="listitem">
<p>
Remove (or move away) any old log files from the MySQL data
directory if you need more space.
</p>
</li>
<li class="listitem">
<p>
Start
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
with the binary log enabled.
If you want to find a statement that crashes
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
, you should start the server with
the general query log enabled as well. See
<a class="xref" href="query-log.html" title="7.4.3 The General Query Log">
Section 7.4.3, “The General Query Log”
</a>
, and
<a class="xref" href="binary-log.html" title="7.4.4 The Binary Log">
Section 7.4.4, “The Binary Log”
</a>
.
</p>
</li>
<li class="listitem">
<p>
When you have gotten a crashed table, stop the
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
server.
</p>
</li>
<li class="listitem">
<p>
Restore the backup.
</p>
</li>
<li class="listitem">
<p>
Restart the
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
server
<span class="emphasis">
<em>
without
</em>
</span>
the binary log enabled.
</p>
</li>
<li class="listitem">
<p>
Re-execute the statements with
<a class="link" href="mysqlbinlog.html" title="6.6.9 mysqlbinlog — Utility for Processing Binary Log Files">
<span class="command">
<strong>
mysqlbinlog
binary-log-file | mysql
</strong>
</span>
</a>
. The binary log is saved
in the MySQL database directory with the name
<code class="literal">
hostname-bin.
<em class="replaceable">
<code>
NNNNNN
</code>
</em>
</code>
.
</p>
</li>
<li class="listitem">
<p>
If the tables are corrupted again or you can get
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
to die with the above command, you
have found a reproducible bug. FTP the tables and the binary
log to our bugs database using the instructions given in
<a class="xref" href="bug-reports.html" title="1.6 How to Report Bugs or Problems">
Section 1.6, “How to Report Bugs or Problems”
</a>
. If you are a support
customer, you can use the MySQL Customer Support Center
(
<a class="ulink" href="https://www.mysql.com/support/" target="_blank">
https://www.mysql.com/support/
</a>
) to alert the MySQL team
about the problem and have it fixed as soon as possible.
</p>
</li>
</ol>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/dynindex-statvar.html | <div id="docs-body">
<div class="index">
<div class="titlepage">
<div>
<div>
<h2 class="title">
<a name="dynindex-statvar">
</a>
Status Variable Index
</h2>
</div>
</div>
</div>
<p>
<a name="statvar-index-top">
</a>
<a class="link" href="dynindex-statvar.html#statvar-index-A" title="A">
A
</a>
|
<a class="link" href="dynindex-statvar.html#statvar-index-B" title="B">
B
</a>
|
<a class="link" href="dynindex-statvar.html#statvar-index-C" title="C">
C
</a>
|
<a class="link" href="dynindex-statvar.html#statvar-index-D" title="D">
D
</a>
|
<a class="link" href="dynindex-statvar.html#statvar-index-E" title="E">
E
</a>
|
<a class="link" href="dynindex-statvar.html#statvar-index-F" title="F">
F
</a>
|
<a class="link" href="dynindex-statvar.html#statvar-index-G" title="G">
G
</a>
|
<a class="link" href="dynindex-statvar.html#statvar-index-H" title="H">
H
</a>
|
<a class="link" href="dynindex-statvar.html#statvar-index-I" title="I">
I
</a>
|
<a class="link" href="dynindex-statvar.html#statvar-index-K" title="K">
K
</a>
|
<a class="link" href="dynindex-statvar.html#statvar-index-L" title="L">
L
</a>
|
<a class="link" href="dynindex-statvar.html#statvar-index-M" title="M">
M
</a>
|
<a class="link" href="dynindex-statvar.html#statvar-index-N" title="N">
N
</a>
|
<a class="link" href="dynindex-statvar.html#statvar-index-O" title="O">
O
</a>
|
<a class="link" href="dynindex-statvar.html#statvar-index-P" title="P">
P
</a>
|
<a class="link" href="dynindex-statvar.html#statvar-index-Q" title="Q">
Q
</a>
|
<a class="link" href="dynindex-statvar.html#statvar-index-R" title="R">
R
</a>
|
<a class="link" href="dynindex-statvar.html#statvar-index-S" title="S">
S
</a>
|
<a class="link" href="dynindex-statvar.html#statvar-index-T" title="T">
T
</a>
|
<a class="link" href="dynindex-statvar.html#statvar-index-U" title="U">
U
</a>
|
<a class="link" href="dynindex-statvar.html#statvar-index-V" title="V">
V
</a>
</p>
<div class="indexdiv">
<a name="statvar-index-A">
</a>
<h3 class="title">
A
</h3>
<p>
[
<a class="link" href="dynindex-statvar.html#statvar-index-top">
index top
</a>
]
</p>
<dl>
<dt>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Aborted_clients
</h3>
<dl>
<dt>
<a class="xref" href="communication-errors.html" title="B.3.2.9 Communication Errors and Aborted Connections">
Section B.3.2.9, “Communication Errors and Aborted Connections”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Aborted_connects
</h3>
<dl>
<dt>
<a class="xref" href="communication-errors.html" title="B.3.2.9 Communication Errors and Aborted Connections">
Section B.3.2.9, “Communication Errors and Aborted Connections”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Acl_cache_items_count
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Audit_log_current_size
</h3>
<dl>
<dt>
<a class="xref" href="audit-log-reference.html" title="8.4.5.11 Audit Log Reference">
Section 8.4.5.11, “Audit Log Reference”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Audit_log_direct_writes
</h3>
<dl>
<dt>
<a class="xref" href="audit-log-reference.html" title="8.4.5.11 Audit Log Reference">
Section 8.4.5.11, “Audit Log Reference”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="audit-log-logging-configuration.html" title="8.4.5.5 Configuring Audit Logging Characteristics">
Section 8.4.5.5, “Configuring Audit Logging Characteristics”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Audit_log_event_max_drop_size
</h3>
<dl>
<dt>
<a class="xref" href="audit-log-reference.html" title="8.4.5.11 Audit Log Reference">
Section 8.4.5.11, “Audit Log Reference”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Audit_log_events
</h3>
<dl>
<dt>
<a class="xref" href="audit-log-reference.html" title="8.4.5.11 Audit Log Reference">
Section 8.4.5.11, “Audit Log Reference”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Audit_log_events_filtered
</h3>
<dl>
<dt>
<a class="xref" href="audit-log-reference.html" title="8.4.5.11 Audit Log Reference">
Section 8.4.5.11, “Audit Log Reference”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Audit_log_events_lost
</h3>
<dl>
<dt>
<a class="xref" href="audit-log-reference.html" title="8.4.5.11 Audit Log Reference">
Section 8.4.5.11, “Audit Log Reference”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Audit_log_events_written
</h3>
<dl>
<dt>
<a class="xref" href="audit-log-reference.html" title="8.4.5.11 Audit Log Reference">
Section 8.4.5.11, “Audit Log Reference”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Audit_log_total_size
</h3>
<dl>
<dt>
<a class="xref" href="audit-log-reference.html" title="8.4.5.11 Audit Log Reference">
Section 8.4.5.11, “Audit Log Reference”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Audit_log_write_waits
</h3>
<dl>
<dt>
<a class="xref" href="audit-log-reference.html" title="8.4.5.11 Audit Log Reference">
Section 8.4.5.11, “Audit Log Reference”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Authentication_ldap_sasl_supported_methods
</h3>
<dl>
<dt>
<a class="xref" href="ldap-pluggable-authentication.html" title="8.4.1.7 LDAP Pluggable Authentication">
Section 8.4.1.7, “LDAP Pluggable Authentication”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<a name="statvar-index-B">
</a>
<h3 class="title">
B
</h3>
<p>
[
<a class="link" href="dynindex-statvar.html#statvar-index-top">
index top
</a>
]
</p>
<dl>
<dt>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Binlog_cache_disk_use
</h3>
<dl>
<dt>
<a class="xref" href="replication-options-binary-log.html" title="19.1.6.4 Binary Logging Options and Variables">
Section 19.1.6.4, “Binary Logging Options and Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="binary-log.html" title="7.4.4 The Binary Log">
Section 7.4.4, “The Binary Log”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Binlog_cache_use
</h3>
<dl>
<dt>
<a class="xref" href="replication-options-binary-log.html" title="19.1.6.4 Binary Logging Options and Variables">
Section 19.1.6.4, “Binary Logging Options and Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="binary-log.html" title="7.4.4 The Binary Log">
Section 7.4.4, “The Binary Log”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Binlog_stmt_cache_disk_use
</h3>
<dl>
<dt>
<a class="xref" href="replication-options-binary-log.html" title="19.1.6.4 Binary Logging Options and Variables">
Section 19.1.6.4, “Binary Logging Options and Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Binlog_stmt_cache_use
</h3>
<dl>
<dt>
<a class="xref" href="replication-options-binary-log.html" title="19.1.6.4 Binary Logging Options and Variables">
Section 19.1.6.4, “Binary Logging Options and Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Bytes_received
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="slow-query-log.html" title="7.4.5 The Slow Query Log">
Section 7.4.5, “The Slow Query Log”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Bytes_sent
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="slow-query-log.html" title="7.4.5 The Slow Query Log">
Section 7.4.5, “The Slow Query Log”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<a name="statvar-index-C">
</a>
<h3 class="title">
C
</h3>
<p>
[
<a class="link" href="dynindex-statvar.html#statvar-index-top">
index top
</a>
]
</p>
<dl>
<dt>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Caching_sha2_password_rsa_public_key
</h3>
<dl>
<dt>
<a class="xref" href="caching-sha2-pluggable-authentication.html" title="8.4.1.2 Caching SHA-2 Pluggable Authentication">
Section 8.4.1.2, “Caching SHA-2 Pluggable Authentication”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Com_flush
</h3>
<dl>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Com_restart
</h3>
<dl>
<dt>
<a class="xref" href="restart.html" title="15.7.8.8 RESTART Statement">
Section 15.7.8.8, “RESTART Statement”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Com_shutdown
</h3>
<dl>
<dt>
<a class="xref" href="shutdown.html" title="15.7.8.9 SHUTDOWN Statement">
Section 15.7.8.9, “SHUTDOWN Statement”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Com_stmt_reprepare
</h3>
<dl>
<dt>
<a class="xref" href="statement-caching.html" title="10.10.3 Caching of Prepared Statements and Stored Programs">
Section 10.10.3, “Caching of Prepared Statements and Stored Programs”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Compression
</h3>
<dl>
<dt>
<a class="xref" href="connection-compression-control.html" title="6.2.8 Connection Compression Control">
Section 6.2.8, “Connection Compression Control”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Compression_algorithm
</h3>
<dl>
<dt>
<a class="xref" href="connection-compression-control.html" title="6.2.8 Connection Compression Control">
Section 6.2.8, “Connection Compression Control”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Compression_level
</h3>
<dl>
<dt>
<a class="xref" href="connection-compression-control.html" title="6.2.8 Connection Compression Control">
Section 6.2.8, “Connection Compression Control”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Connection_control_delay_generated
</h3>
<dl>
<dt>
<a class="xref" href="connection-control-installation.html" title="8.4.2.1 Connection-Control Plugin Installation">
Section 8.4.2.1, “Connection-Control Plugin Installation”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="connection-control-variables.html" title="8.4.2.2 Connection-Control System and Status Variables">
Section 8.4.2.2, “Connection-Control System and Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Connection_errors_accept
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Connection_errors_internal
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Connection_errors_max_connections
</h3>
<dl>
<dt>
<a class="xref" href="connection-interfaces.html" title="7.1.12.1 Connection Interfaces">
Section 7.1.12.1, “Connection Interfaces”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Connection_errors_peer_address
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Connection_errors_select
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Connection_errors_tcpwrap
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Connection_errors_xxx
</h3>
<dl>
<dt>
<a class="xref" href="host-cache.html" title="7.1.12.3 DNS Lookups and the Host Cache">
Section 7.1.12.3, “DNS Lookups and the Host Cache”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Connections
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-system-variables.html" title="7.1.8 Server System Variables">
Section 7.1.8, “Server System Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Created_tmp_disk_tables
</h3>
<dl>
<dt>
<a class="xref" href="internal-temporary-tables.html" title="10.4.4 Internal Temporary Table Use in MySQL">
Section 10.4.4, “Internal Temporary Table Use in MySQL”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-system-variables.html" title="7.1.8 Server System Variables">
Section 7.1.8, “Server System Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="performance-schema-events-statements-current-table.html" title="29.12.6.1 The events_statements_current Table">
Section 29.12.6.1, “The events_statements_current Table”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="slow-query-log.html" title="7.4.5 The Slow Query Log">
Section 7.4.5, “The Slow Query Log”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Created_tmp_files
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Created_tmp_tables
</h3>
<dl>
<dt>
<a class="xref" href="internal-temporary-tables.html" title="10.4.4 Internal Temporary Table Use in MySQL">
Section 10.4.4, “Internal Temporary Table Use in MySQL”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-system-variables.html" title="7.1.8 Server System Variables">
Section 7.1.8, “Server System Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="show-status.html" title="15.7.7.37 SHOW STATUS Statement">
Section 15.7.7.37, “SHOW STATUS Statement”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="performance-schema-events-statements-current-table.html" title="29.12.6.1 The events_statements_current Table">
Section 29.12.6.1, “The events_statements_current Table”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="slow-query-log.html" title="7.4.5 The Slow Query Log">
Section 7.4.5, “The Slow Query Log”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Current_tls_ca
</h3>
<dl>
<dt>
<a class="xref" href="using-encrypted-connections.html" title="8.3.1 Configuring MySQL to Use Encrypted Connections">
Section 8.3.1, “Configuring MySQL to Use Encrypted Connections”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Current_tls_capath
</h3>
<dl>
<dt>
<a class="xref" href="using-encrypted-connections.html" title="8.3.1 Configuring MySQL to Use Encrypted Connections">
Section 8.3.1, “Configuring MySQL to Use Encrypted Connections”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Current_tls_cert
</h3>
<dl>
<dt>
<a class="xref" href="using-encrypted-connections.html" title="8.3.1 Configuring MySQL to Use Encrypted Connections">
Section 8.3.1, “Configuring MySQL to Use Encrypted Connections”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Current_tls_cipher
</h3>
<dl>
<dt>
<a class="xref" href="using-encrypted-connections.html" title="8.3.1 Configuring MySQL to Use Encrypted Connections">
Section 8.3.1, “Configuring MySQL to Use Encrypted Connections”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Current_tls_ciphersuites
</h3>
<dl>
<dt>
<a class="xref" href="using-encrypted-connections.html" title="8.3.1 Configuring MySQL to Use Encrypted Connections">
Section 8.3.1, “Configuring MySQL to Use Encrypted Connections”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Current_tls_crl
</h3>
<dl>
<dt>
<a class="xref" href="using-encrypted-connections.html" title="8.3.1 Configuring MySQL to Use Encrypted Connections">
Section 8.3.1, “Configuring MySQL to Use Encrypted Connections”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Current_tls_crlpath
</h3>
<dl>
<dt>
<a class="xref" href="using-encrypted-connections.html" title="8.3.1 Configuring MySQL to Use Encrypted Connections">
Section 8.3.1, “Configuring MySQL to Use Encrypted Connections”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Current_tls_key
</h3>
<dl>
<dt>
<a class="xref" href="using-encrypted-connections.html" title="8.3.1 Configuring MySQL to Use Encrypted Connections">
Section 8.3.1, “Configuring MySQL to Use Encrypted Connections”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Current_tls_version
</h3>
<dl>
<dt>
<a class="xref" href="using-encrypted-connections.html" title="8.3.1 Configuring MySQL to Use Encrypted Connections">
Section 8.3.1, “Configuring MySQL to Use Encrypted Connections”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<a name="statvar-index-D">
</a>
<h3 class="title">
D
</h3>
<p>
[
<a class="link" href="dynindex-statvar.html#statvar-index-top">
index top
</a>
]
</p>
<dl>
<dt>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Delayed_errors
</h3>
<dl>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Delayed_insert_threads
</h3>
<dl>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Delayed_writes
</h3>
<dl>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Deprecated_use_i_s_processlist_count
</h3>
<dl>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="information-schema-processlist-table.html" title="28.3.23 The INFORMATION_SCHEMA PROCESSLIST Table">
Section 28.3.23, “The INFORMATION_SCHEMA PROCESSLIST Table”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-nutshell.html" title="1.4 What Is New in MySQL 8.4 since MySQL 8.0">
Section 1.4, “What Is New in MySQL 8.4 since MySQL 8.0”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Deprecated_use_i_s_processlist_last_timestamp
</h3>
<dl>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="information-schema-processlist-table.html" title="28.3.23 The INFORMATION_SCHEMA PROCESSLIST Table">
Section 28.3.23, “The INFORMATION_SCHEMA PROCESSLIST Table”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-nutshell.html" title="1.4 What Is New in MySQL 8.4 since MySQL 8.0">
Section 1.4, “What Is New in MySQL 8.4 since MySQL 8.0”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
dragnet.Status
</h3>
<dl>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-system-variables.html" title="7.1.8 Server System Variables">
Section 7.1.8, “Server System Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<a name="statvar-index-E">
</a>
<h3 class="title">
E
</h3>
<p>
[
<a class="link" href="dynindex-statvar.html#statvar-index-top">
index top
</a>
]
</p>
<dl>
<dt>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Error_log_buffered_bytes
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="performance-schema-error-log-table.html" title="29.12.22.2 The error_log Table">
Section 29.12.22.2, “The error_log Table”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Error_log_buffered_events
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="performance-schema-error-log-table.html" title="29.12.22.2 The error_log Table">
Section 29.12.22.2, “The error_log Table”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Error_log_expired_events
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="performance-schema-error-log-table.html" title="29.12.22.2 The error_log Table">
Section 29.12.22.2, “The error_log Table”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Error_log_latest_write
</h3>
<dl>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="performance-schema-error-log-table.html" title="29.12.22.2 The error_log Table">
Section 29.12.22.2, “The error_log Table”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<a name="statvar-index-F">
</a>
<h3 class="title">
F
</h3>
<p>
[
<a class="link" href="dynindex-statvar.html#statvar-index-top">
index top
</a>
]
</p>
<dl>
<dt>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Firewall_access_denied
</h3>
<dl>
<dt>
<a class="xref" href="firewall-reference.html" title="8.4.7.4 MySQL Enterprise Firewall Reference">
Section 8.4.7.4, “MySQL Enterprise Firewall Reference”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Firewall_access_granted
</h3>
<dl>
<dt>
<a class="xref" href="firewall-reference.html" title="8.4.7.4 MySQL Enterprise Firewall Reference">
Section 8.4.7.4, “MySQL Enterprise Firewall Reference”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="firewall-usage.html" title="8.4.7.3 Using MySQL Enterprise Firewall">
Section 8.4.7.3, “Using MySQL Enterprise Firewall”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Firewall_access_suspicious
</h3>
<dl>
<dt>
<a class="xref" href="firewall-reference.html" title="8.4.7.4 MySQL Enterprise Firewall Reference">
Section 8.4.7.4, “MySQL Enterprise Firewall Reference”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Firewall_cached_entries
</h3>
<dl>
<dt>
<a class="xref" href="firewall-reference.html" title="8.4.7.4 MySQL Enterprise Firewall Reference">
Section 8.4.7.4, “MySQL Enterprise Firewall Reference”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Flush_commands
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<a name="statvar-index-G">
</a>
<h3 class="title">
G
</h3>
<p>
[
<a class="link" href="dynindex-statvar.html#statvar-index-top">
index top
</a>
]
</p>
<dl>
<dt>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Global_connection_memory
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-system-variables.html" title="7.1.8 Server System Variables">
Section 7.1.8, “Server System Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Gr_all_consensus_proposals_count
</h3>
<dl>
<dt>
<a class="xref" href="group-replication-status-variables.html" title="20.9.2 Group Replication Status Variables">
Section 20.9.2, “Group Replication Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Gr_all_consensus_time_sum
</h3>
<dl>
<dt>
<a class="xref" href="group-replication-status-variables.html" title="20.9.2 Group Replication Status Variables">
Section 20.9.2, “Group Replication Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Gr_certification_garbage_collector_count
</h3>
<dl>
<dt>
<a class="xref" href="group-replication-status-variables.html" title="20.9.2 Group Replication Status Variables">
Section 20.9.2, “Group Replication Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Gr_certification_garbage_collector_time_sum
</h3>
<dl>
<dt>
<a class="xref" href="group-replication-status-variables.html" title="20.9.2 Group Replication Status Variables">
Section 20.9.2, “Group Replication Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Gr_consensus_bytes_received_sum
</h3>
<dl>
<dt>
<a class="xref" href="group-replication-status-variables.html" title="20.9.2 Group Replication Status Variables">
Section 20.9.2, “Group Replication Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Gr_consensus_bytes_sent_sum
</h3>
<dl>
<dt>
<a class="xref" href="group-replication-status-variables.html" title="20.9.2 Group Replication Status Variables">
Section 20.9.2, “Group Replication Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Gr_control_messages_sent_bytes_sum
</h3>
<dl>
<dt>
<a class="xref" href="group-replication-status-variables.html" title="20.9.2 Group Replication Status Variables">
Section 20.9.2, “Group Replication Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Gr_control_messages_sent_count
</h3>
<dl>
<dt>
<a class="xref" href="group-replication-status-variables.html" title="20.9.2 Group Replication Status Variables">
Section 20.9.2, “Group Replication Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Gr_control_messages_sent_roundtrip_time_sum
</h3>
<dl>
<dt>
<a class="xref" href="group-replication-status-variables.html" title="20.9.2 Group Replication Status Variables">
Section 20.9.2, “Group Replication Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Gr_data_messages_sent_bytes_sum
</h3>
<dl>
<dt>
<a class="xref" href="group-replication-status-variables.html" title="20.9.2 Group Replication Status Variables">
Section 20.9.2, “Group Replication Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Gr_data_messages_sent_count
</h3>
<dl>
<dt>
<a class="xref" href="group-replication-status-variables.html" title="20.9.2 Group Replication Status Variables">
Section 20.9.2, “Group Replication Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Gr_data_messages_sent_roundtrip_time_sum
</h3>
<dl>
<dt>
<a class="xref" href="group-replication-status-variables.html" title="20.9.2 Group Replication Status Variables">
Section 20.9.2, “Group Replication Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Gr_empty_consensus_proposals_count
</h3>
<dl>
<dt>
<a class="xref" href="group-replication-status-variables.html" title="20.9.2 Group Replication Status Variables">
Section 20.9.2, “Group Replication Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Gr_extended_consensus_count
</h3>
<dl>
<dt>
<a class="xref" href="group-replication-status-variables.html" title="20.9.2 Group Replication Status Variables">
Section 20.9.2, “Group Replication Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Gr_last_consensus_end_timestamp
</h3>
<dl>
<dt>
<a class="xref" href="group-replication-status-variables.html" title="20.9.2 Group Replication Status Variables">
Section 20.9.2, “Group Replication Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Gr_total_messages_sent_count
</h3>
<dl>
<dt>
<a class="xref" href="group-replication-status-variables.html" title="20.9.2 Group Replication Status Variables">
Section 20.9.2, “Group Replication Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Gr_transactions_consistency_after_sync_count
</h3>
<dl>
<dt>
<a class="xref" href="group-replication-status-variables.html" title="20.9.2 Group Replication Status Variables">
Section 20.9.2, “Group Replication Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Gr_transactions_consistency_after_sync_time_sum
</h3>
<dl>
<dt>
<a class="xref" href="group-replication-status-variables.html" title="20.9.2 Group Replication Status Variables">
Section 20.9.2, “Group Replication Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Gr_transactions_consistency_after_termination_count
</h3>
<dl>
<dt>
<a class="xref" href="group-replication-status-variables.html" title="20.9.2 Group Replication Status Variables">
Section 20.9.2, “Group Replication Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Gr_transactions_consistency_after_termination_time_sum
</h3>
<dl>
<dt>
<a class="xref" href="group-replication-status-variables.html" title="20.9.2 Group Replication Status Variables">
Section 20.9.2, “Group Replication Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Gr_transactions_consistency_before_begin_count
</h3>
<dl>
<dt>
<a class="xref" href="group-replication-status-variables.html" title="20.9.2 Group Replication Status Variables">
Section 20.9.2, “Group Replication Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Gr_transactions_consistency_before_begin_time_sum
</h3>
<dl>
<dt>
<a class="xref" href="group-replication-status-variables.html" title="20.9.2 Group Replication Status Variables">
Section 20.9.2, “Group Replication Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<a name="statvar-index-H">
</a>
<h3 class="title">
H
</h3>
<p>
[
<a class="link" href="dynindex-statvar.html#statvar-index-top">
index top
</a>
]
</p>
<dl>
<dt>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Handler_commit
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Handler_delete
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Handler_discover
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Handler_external_lock
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Handler_mrr_init
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Handler_prepare
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Handler_read_first
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="slow-query-log.html" title="7.4.5 The Slow Query Log">
Section 7.4.5, “The Slow Query Log”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Handler_read_key
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="slow-query-log.html" title="7.4.5 The Slow Query Log">
Section 7.4.5, “The Slow Query Log”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Handler_read_last
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="slow-query-log.html" title="7.4.5 The Slow Query Log">
Section 7.4.5, “The Slow Query Log”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Handler_read_next
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="slow-query-log.html" title="7.4.5 The Slow Query Log">
Section 7.4.5, “The Slow Query Log”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="index-extensions.html" title="10.3.10 Use of Index Extensions">
Section 10.3.10, “Use of Index Extensions”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Handler_read_prev
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="slow-query-log.html" title="7.4.5 The Slow Query Log">
Section 7.4.5, “The Slow Query Log”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Handler_read_rnd
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="slow-query-log.html" title="7.4.5 The Slow Query Log">
Section 7.4.5, “The Slow Query Log”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Handler_read_rnd_next
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="slow-query-log.html" title="7.4.5 The Slow Query Log">
Section 7.4.5, “The Slow Query Log”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Handler_rollback
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Handler_savepoint
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Handler_savepoint_rollback
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Handler_update
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Handler_write
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<a name="statvar-index-I">
</a>
<h3 class="title">
I
</h3>
<p>
[
<a class="link" href="dynindex-statvar.html#statvar-index-top">
index top
</a>
]
</p>
<dl>
<dt>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Innodb_buffer_pool_bytes_data
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Innodb_buffer_pool_bytes_dirty
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Innodb_buffer_pool_dump_status
</h3>
<dl>
<dt>
<a class="xref" href="innodb-parameters.html" title="17.14 InnoDB Startup Options and System Variables">
Section 17.14, “InnoDB Startup Options and System Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Innodb_buffer_pool_load_status
</h3>
<dl>
<dt>
<a class="xref" href="innodb-parameters.html" title="17.14 InnoDB Startup Options and System Variables">
Section 17.14, “InnoDB Startup Options and System Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Innodb_buffer_pool_pages_data
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Innodb_buffer_pool_pages_dirty
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Innodb_buffer_pool_pages_flushed
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Innodb_buffer_pool_pages_free
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Innodb_buffer_pool_pages_latched
</h3>
<dl>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Innodb_buffer_pool_pages_misc
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Innodb_buffer_pool_pages_total
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Innodb_buffer_pool_read_ahead
</h3>
<dl>
<dt>
<a class="xref" href="innodb-performance-read_ahead.html" title="17.8.3.4 Configuring InnoDB Buffer Pool Prefetching (Read-Ahead)">
Section 17.8.3.4, “Configuring InnoDB Buffer Pool Prefetching (Read-Ahead)”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="innodb-parameters.html" title="17.14 InnoDB Startup Options and System Variables">
Section 17.14, “InnoDB Startup Options and System Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Innodb_buffer_pool_read_ahead_evicted
</h3>
<dl>
<dt>
<a class="xref" href="innodb-performance-read_ahead.html" title="17.8.3.4 Configuring InnoDB Buffer Pool Prefetching (Read-Ahead)">
Section 17.8.3.4, “Configuring InnoDB Buffer Pool Prefetching (Read-Ahead)”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="innodb-parameters.html" title="17.14 InnoDB Startup Options and System Variables">
Section 17.14, “InnoDB Startup Options and System Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Innodb_buffer_pool_read_ahead_rnd
</h3>
<dl>
<dt>
<a class="xref" href="innodb-performance-read_ahead.html" title="17.8.3.4 Configuring InnoDB Buffer Pool Prefetching (Read-Ahead)">
Section 17.8.3.4, “Configuring InnoDB Buffer Pool Prefetching (Read-Ahead)”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Innodb_buffer_pool_read_requests
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Innodb_buffer_pool_reads
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Innodb_buffer_pool_resize_status
</h3>
<dl>
<dt>
<a class="xref" href="innodb-buffer-pool-resize.html" title="17.8.3.1 Configuring InnoDB Buffer Pool Size">
Section 17.8.3.1, “Configuring InnoDB Buffer Pool Size”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="innodb-parameters.html" title="17.14 InnoDB Startup Options and System Variables">
Section 17.14, “InnoDB Startup Options and System Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Innodb_buffer_pool_resize_status_code
</h3>
<dl>
<dt>
<a class="xref" href="innodb-buffer-pool-resize.html" title="17.8.3.1 Configuring InnoDB Buffer Pool Size">
Section 17.8.3.1, “Configuring InnoDB Buffer Pool Size”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Innodb_buffer_pool_resize_status_progress
</h3>
<dl>
<dt>
<a class="xref" href="innodb-buffer-pool-resize.html" title="17.8.3.1 Configuring InnoDB Buffer Pool Size">
Section 17.8.3.1, “Configuring InnoDB Buffer Pool Size”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Innodb_buffer_pool_wait_free
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Innodb_buffer_pool_write_requests
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Innodb_data_fsyncs
</h3>
<dl>
<dt>
<a class="xref" href="innodb-parameters.html" title="17.14 InnoDB Startup Options and System Variables">
Section 17.14, “InnoDB Startup Options and System Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Innodb_data_pending_fsyncs
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Innodb_data_pending_reads
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Innodb_data_pending_writes
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Innodb_data_read
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Innodb_data_reads
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Innodb_data_writes
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Innodb_data_written
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Innodb_dblwr_pages_written
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Innodb_dblwr_writes
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Innodb_have_atomic_builtins
</h3>
<dl>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Innodb_log_waits
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Innodb_log_write_requests
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Innodb_log_writes
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Innodb_num_open_files
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Innodb_os_log_fsyncs
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Innodb_os_log_pending_fsyncs
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Innodb_os_log_pending_writes
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Innodb_os_log_written
</h3>
<dl>
<dt>
<a class="xref" href="innodb-parameters.html" title="17.14 InnoDB Startup Options and System Variables">
Section 17.14, “InnoDB Startup Options and System Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Innodb_page_size
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Innodb_pages_created
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Innodb_pages_read
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Innodb_pages_written
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Innodb_redo_log_capacity_resized
</h3>
<dl>
<dt>
<a class="xref" href="innodb-init-startup-configuration.html" title="17.8.1 InnoDB Startup Configuration">
Section 17.8.1, “InnoDB Startup Configuration”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="innodb-parameters.html" title="17.14 InnoDB Startup Options and System Variables">
Section 17.14, “InnoDB Startup Options and System Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="innodb-redo-log.html" title="17.6.5 Redo Log">
Section 17.6.5, “Redo Log”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Innodb_redo_log_checkpoint_lsn
</h3>
<dl>
<dt>
<a class="xref" href="innodb-redo-log.html" title="17.6.5 Redo Log">
Section 17.6.5, “Redo Log”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Innodb_redo_log_current_lsn
</h3>
<dl>
<dt>
<a class="xref" href="innodb-redo-log.html" title="17.6.5 Redo Log">
Section 17.6.5, “Redo Log”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Innodb_redo_log_enabled
</h3>
<dl>
<dt>
<a class="xref" href="innodb-redo-log.html" title="17.6.5 Redo Log">
Section 17.6.5, “Redo Log”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Innodb_redo_log_flushed_to_disk_lsn
</h3>
<dl>
<dt>
<a class="xref" href="innodb-redo-log.html" title="17.6.5 Redo Log">
Section 17.6.5, “Redo Log”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Innodb_redo_log_logical_size
</h3>
<dl>
<dt>
<a class="xref" href="innodb-redo-log.html" title="17.6.5 Redo Log">
Section 17.6.5, “Redo Log”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Innodb_redo_log_physical_size
</h3>
<dl>
<dt>
<a class="xref" href="innodb-redo-log.html" title="17.6.5 Redo Log">
Section 17.6.5, “Redo Log”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Innodb_redo_log_read_only
</h3>
<dl>
<dt>
<a class="xref" href="innodb-redo-log.html" title="17.6.5 Redo Log">
Section 17.6.5, “Redo Log”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Innodb_redo_log_resize_status
</h3>
<dl>
<dt>
<a class="xref" href="innodb-redo-log.html" title="17.6.5 Redo Log">
Section 17.6.5, “Redo Log”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Innodb_redo_log_uuid
</h3>
<dl>
<dt>
<a class="xref" href="innodb-redo-log.html" title="17.6.5 Redo Log">
Section 17.6.5, “Redo Log”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Innodb_row_lock_current_waits
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Innodb_row_lock_time
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Innodb_row_lock_time_avg
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Innodb_row_lock_time_max
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Innodb_row_lock_waits
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Innodb_rows_deleted
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Innodb_rows_inserted
</h3>
<dl>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Innodb_rows_read
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Innodb_rows_updated
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Innodb_system_rows_deleted
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Innodb_system_rows_inserted
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Innodb_system_rows_read
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Innodb_system_rows_updated
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Innodb_truncated_status_writes
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Innodb_undo_tablespaces_active
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Innodb_undo_tablespaces_explicit
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Innodb_undo_tablespaces_implicit
</h3>
<dl>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Innodb_undo_tablespaces_total
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<a name="statvar-index-K">
</a>
<h3 class="title">
K
</h3>
<p>
[
<a class="link" href="dynindex-statvar.html#statvar-index-top">
index top
</a>
]
</p>
<dl>
<dt>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Key_blocks_not_flushed
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Key_blocks_unused
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-system-variables.html" title="7.1.8 Server System Variables">
Section 7.1.8, “Server System Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Key_blocks_used
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Key_read_requests
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-system-variables.html" title="7.1.8 Server System Variables">
Section 7.1.8, “Server System Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Key_reads
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-system-variables.html" title="7.1.8 Server System Variables">
Section 7.1.8, “Server System Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Key_write_requests
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-system-variables.html" title="7.1.8 Server System Variables">
Section 7.1.8, “Server System Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Key_writes
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-system-variables.html" title="7.1.8 Server System Variables">
Section 7.1.8, “Server System Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<a name="statvar-index-L">
</a>
<h3 class="title">
L
</h3>
<p>
[
<a class="link" href="dynindex-statvar.html#statvar-index-top">
index top
</a>
]
</p>
<dl>
<dt>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Last_query_cost
</h3>
<dl>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Last_query_partial_plans
</h3>
<dl>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Locked_connects
</h3>
<dl>
<dt>
<a class="xref" href="account-locking.html" title="8.2.20 Account Locking">
Section 8.2.20, “Account Locking”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<a name="statvar-index-M">
</a>
<h3 class="title">
M
</h3>
<p>
[
<a class="link" href="dynindex-statvar.html#statvar-index-top">
index top
</a>
]
</p>
<dl>
<dt>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Max_execution_time_exceeded
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Max_execution_time_set
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Max_execution_time_set_failed
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Max_used_connections
</h3>
<dl>
<dt>
<a class="xref" href="flush.html" title="15.7.8.3 FLUSH Statement">
Section 15.7.8.3, “FLUSH Statement”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="thread-pool-tuning.html" title="7.6.3.4 Thread Pool Tuning">
Section 7.6.3.4, “Thread Pool Tuning”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Max_used_connections_time
</h3>
<dl>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
mecab_charset
</h3>
<dl>
<dt>
<a class="xref" href="fulltext-search-mecab.html" title="14.9.9 MeCab Full-Text Parser Plugin">
Section 14.9.9, “MeCab Full-Text Parser Plugin”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Mysqlx_aborted_clients
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="x-plugin-status-variables.html" title="22.5.6.3 X Plugin Status Variables">
Section 22.5.6.3, “X Plugin Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Mysqlx_address
</h3>
<dl>
<dt>
<a class="xref" href="x-plugin-options-system-variables.html" title="22.5.6.2 X Plugin Options and System Variables">
Section 22.5.6.2, “X Plugin Options and System Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="x-plugin-status-variables.html" title="22.5.6.3 X Plugin Status Variables">
Section 22.5.6.3, “X Plugin Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Mysqlx_bytes_received
</h3>
<dl>
<dt>
<a class="xref" href="x-plugin-connection-compression.html" title="22.5.5 Connection Compression with X Plugin">
Section 22.5.5, “Connection Compression with X Plugin”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="x-plugin-status-variables.html" title="22.5.6.3 X Plugin Status Variables">
Section 22.5.6.3, “X Plugin Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Mysqlx_bytes_received_compressed_payload
</h3>
<dl>
<dt>
<a class="xref" href="x-plugin-connection-compression.html" title="22.5.5 Connection Compression with X Plugin">
Section 22.5.5, “Connection Compression with X Plugin”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="x-plugin-status-variables.html" title="22.5.6.3 X Plugin Status Variables">
Section 22.5.6.3, “X Plugin Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Mysqlx_bytes_received_uncompressed_frame
</h3>
<dl>
<dt>
<a class="xref" href="x-plugin-connection-compression.html" title="22.5.5 Connection Compression with X Plugin">
Section 22.5.5, “Connection Compression with X Plugin”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="x-plugin-status-variables.html" title="22.5.6.3 X Plugin Status Variables">
Section 22.5.6.3, “X Plugin Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Mysqlx_bytes_sent
</h3>
<dl>
<dt>
<a class="xref" href="x-plugin-connection-compression.html" title="22.5.5 Connection Compression with X Plugin">
Section 22.5.5, “Connection Compression with X Plugin”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="x-plugin-status-variables.html" title="22.5.6.3 X Plugin Status Variables">
Section 22.5.6.3, “X Plugin Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Mysqlx_bytes_sent_compressed_payload
</h3>
<dl>
<dt>
<a class="xref" href="x-plugin-connection-compression.html" title="22.5.5 Connection Compression with X Plugin">
Section 22.5.5, “Connection Compression with X Plugin”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="x-plugin-status-variables.html" title="22.5.6.3 X Plugin Status Variables">
Section 22.5.6.3, “X Plugin Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Mysqlx_bytes_sent_uncompressed_frame
</h3>
<dl>
<dt>
<a class="xref" href="x-plugin-connection-compression.html" title="22.5.5 Connection Compression with X Plugin">
Section 22.5.5, “Connection Compression with X Plugin”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="x-plugin-status-variables.html" title="22.5.6.3 X Plugin Status Variables">
Section 22.5.6.3, “X Plugin Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Mysqlx_compression_algorithm
</h3>
<dl>
<dt>
<a class="xref" href="x-plugin-connection-compression.html" title="22.5.5 Connection Compression with X Plugin">
Section 22.5.5, “Connection Compression with X Plugin”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="x-plugin-status-variables.html" title="22.5.6.3 X Plugin Status Variables">
Section 22.5.6.3, “X Plugin Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Mysqlx_compression_level
</h3>
<dl>
<dt>
<a class="xref" href="x-plugin-connection-compression.html" title="22.5.5 Connection Compression with X Plugin">
Section 22.5.5, “Connection Compression with X Plugin”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="x-plugin-status-variables.html" title="22.5.6.3 X Plugin Status Variables">
Section 22.5.6.3, “X Plugin Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Mysqlx_connection_accept_errors
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="x-plugin-status-variables.html" title="22.5.6.3 X Plugin Status Variables">
Section 22.5.6.3, “X Plugin Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Mysqlx_connection_errors
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="x-plugin-status-variables.html" title="22.5.6.3 X Plugin Status Variables">
Section 22.5.6.3, “X Plugin Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Mysqlx_connections_accepted
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="x-plugin-status-variables.html" title="22.5.6.3 X Plugin Status Variables">
Section 22.5.6.3, “X Plugin Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Mysqlx_connections_closed
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="x-plugin-status-variables.html" title="22.5.6.3 X Plugin Status Variables">
Section 22.5.6.3, “X Plugin Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Mysqlx_connections_rejected
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="x-plugin-status-variables.html" title="22.5.6.3 X Plugin Status Variables">
Section 22.5.6.3, “X Plugin Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Mysqlx_crud_create_view
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="x-plugin-status-variables.html" title="22.5.6.3 X Plugin Status Variables">
Section 22.5.6.3, “X Plugin Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Mysqlx_crud_delete
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="x-plugin-status-variables.html" title="22.5.6.3 X Plugin Status Variables">
Section 22.5.6.3, “X Plugin Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Mysqlx_crud_drop_view
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="x-plugin-status-variables.html" title="22.5.6.3 X Plugin Status Variables">
Section 22.5.6.3, “X Plugin Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Mysqlx_crud_find
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="x-plugin-status-variables.html" title="22.5.6.3 X Plugin Status Variables">
Section 22.5.6.3, “X Plugin Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Mysqlx_crud_insert
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="x-plugin-status-variables.html" title="22.5.6.3 X Plugin Status Variables">
Section 22.5.6.3, “X Plugin Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Mysqlx_crud_modify_view
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="x-plugin-status-variables.html" title="22.5.6.3 X Plugin Status Variables">
Section 22.5.6.3, “X Plugin Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Mysqlx_crud_update
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="x-plugin-status-variables.html" title="22.5.6.3 X Plugin Status Variables">
Section 22.5.6.3, “X Plugin Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Mysqlx_cursor_close
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="x-plugin-status-variables.html" title="22.5.6.3 X Plugin Status Variables">
Section 22.5.6.3, “X Plugin Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Mysqlx_cursor_fetch
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="x-plugin-status-variables.html" title="22.5.6.3 X Plugin Status Variables">
Section 22.5.6.3, “X Plugin Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Mysqlx_cursor_open
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="x-plugin-status-variables.html" title="22.5.6.3 X Plugin Status Variables">
Section 22.5.6.3, “X Plugin Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Mysqlx_errors_sent
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="x-plugin-status-variables.html" title="22.5.6.3 X Plugin Status Variables">
Section 22.5.6.3, “X Plugin Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Mysqlx_errors_unknown_message_type
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="x-plugin-status-variables.html" title="22.5.6.3 X Plugin Status Variables">
Section 22.5.6.3, “X Plugin Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Mysqlx_expect_close
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="x-plugin-status-variables.html" title="22.5.6.3 X Plugin Status Variables">
Section 22.5.6.3, “X Plugin Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Mysqlx_expect_open
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="x-plugin-status-variables.html" title="22.5.6.3 X Plugin Status Variables">
Section 22.5.6.3, “X Plugin Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Mysqlx_init_error
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="x-plugin-status-variables.html" title="22.5.6.3 X Plugin Status Variables">
Section 22.5.6.3, “X Plugin Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Mysqlx_messages_sent
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="x-plugin-status-variables.html" title="22.5.6.3 X Plugin Status Variables">
Section 22.5.6.3, “X Plugin Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Mysqlx_notice_global_sent
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="x-plugin-status-variables.html" title="22.5.6.3 X Plugin Status Variables">
Section 22.5.6.3, “X Plugin Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Mysqlx_notice_other_sent
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="x-plugin-status-variables.html" title="22.5.6.3 X Plugin Status Variables">
Section 22.5.6.3, “X Plugin Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Mysqlx_notice_warning_sent
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="x-plugin-status-variables.html" title="22.5.6.3 X Plugin Status Variables">
Section 22.5.6.3, “X Plugin Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Mysqlx_notified_by_group_replication
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="x-plugin-status-variables.html" title="22.5.6.3 X Plugin Status Variables">
Section 22.5.6.3, “X Plugin Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Mysqlx_port
</h3>
<dl>
<dt>
<a class="xref" href="x-plugin-status-variables.html" title="22.5.6.3 X Plugin Status Variables">
Section 22.5.6.3, “X Plugin Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Mysqlx_prep_deallocate
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="x-plugin-status-variables.html" title="22.5.6.3 X Plugin Status Variables">
Section 22.5.6.3, “X Plugin Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Mysqlx_prep_execute
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="x-plugin-status-variables.html" title="22.5.6.3 X Plugin Status Variables">
Section 22.5.6.3, “X Plugin Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Mysqlx_prep_prepare
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="x-plugin-status-variables.html" title="22.5.6.3 X Plugin Status Variables">
Section 22.5.6.3, “X Plugin Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Mysqlx_rows_sent
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="x-plugin-status-variables.html" title="22.5.6.3 X Plugin Status Variables">
Section 22.5.6.3, “X Plugin Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Mysqlx_sessions
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="x-plugin-status-variables.html" title="22.5.6.3 X Plugin Status Variables">
Section 22.5.6.3, “X Plugin Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Mysqlx_sessions_accepted
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="x-plugin-status-variables.html" title="22.5.6.3 X Plugin Status Variables">
Section 22.5.6.3, “X Plugin Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Mysqlx_sessions_closed
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="x-plugin-status-variables.html" title="22.5.6.3 X Plugin Status Variables">
Section 22.5.6.3, “X Plugin Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Mysqlx_sessions_fatal_error
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="x-plugin-status-variables.html" title="22.5.6.3 X Plugin Status Variables">
Section 22.5.6.3, “X Plugin Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Mysqlx_sessions_killed
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="x-plugin-status-variables.html" title="22.5.6.3 X Plugin Status Variables">
Section 22.5.6.3, “X Plugin Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Mysqlx_sessions_rejected
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="x-plugin-status-variables.html" title="22.5.6.3 X Plugin Status Variables">
Section 22.5.6.3, “X Plugin Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Mysqlx_socket
</h3>
<dl>
<dt>
<a class="xref" href="x-plugin-status-variables.html" title="22.5.6.3 X Plugin Status Variables">
Section 22.5.6.3, “X Plugin Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Mysqlx_ssl_accept_renegotiates
</h3>
<dl>
<dt>
<a class="xref" href="x-plugin-status-variables.html" title="22.5.6.3 X Plugin Status Variables">
Section 22.5.6.3, “X Plugin Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Mysqlx_ssl_accepts
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="x-plugin-status-variables.html" title="22.5.6.3 X Plugin Status Variables">
Section 22.5.6.3, “X Plugin Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Mysqlx_ssl_active
</h3>
<dl>
<dt>
<a class="xref" href="x-plugin-status-variables.html" title="22.5.6.3 X Plugin Status Variables">
Section 22.5.6.3, “X Plugin Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Mysqlx_ssl_cipher
</h3>
<dl>
<dt>
<a class="xref" href="x-plugin-status-variables.html" title="22.5.6.3 X Plugin Status Variables">
Section 22.5.6.3, “X Plugin Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Mysqlx_ssl_cipher_list
</h3>
<dl>
<dt>
<a class="xref" href="x-plugin-status-variables.html" title="22.5.6.3 X Plugin Status Variables">
Section 22.5.6.3, “X Plugin Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Mysqlx_ssl_ctx_verify_depth
</h3>
<dl>
<dt>
<a class="xref" href="x-plugin-status-variables.html" title="22.5.6.3 X Plugin Status Variables">
Section 22.5.6.3, “X Plugin Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Mysqlx_ssl_ctx_verify_mode
</h3>
<dl>
<dt>
<a class="xref" href="x-plugin-status-variables.html" title="22.5.6.3 X Plugin Status Variables">
Section 22.5.6.3, “X Plugin Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Mysqlx_ssl_finished_accepts
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="x-plugin-status-variables.html" title="22.5.6.3 X Plugin Status Variables">
Section 22.5.6.3, “X Plugin Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Mysqlx_ssl_server_not_after
</h3>
<dl>
<dt>
<a class="xref" href="x-plugin-status-variables.html" title="22.5.6.3 X Plugin Status Variables">
Section 22.5.6.3, “X Plugin Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Mysqlx_ssl_server_not_before
</h3>
<dl>
<dt>
<a class="xref" href="x-plugin-status-variables.html" title="22.5.6.3 X Plugin Status Variables">
Section 22.5.6.3, “X Plugin Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Mysqlx_ssl_verify_depth
</h3>
<dl>
<dt>
<a class="xref" href="x-plugin-status-variables.html" title="22.5.6.3 X Plugin Status Variables">
Section 22.5.6.3, “X Plugin Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Mysqlx_ssl_verify_mode
</h3>
<dl>
<dt>
<a class="xref" href="x-plugin-status-variables.html" title="22.5.6.3 X Plugin Status Variables">
Section 22.5.6.3, “X Plugin Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Mysqlx_ssl_version
</h3>
<dl>
<dt>
<a class="xref" href="x-plugin-status-variables.html" title="22.5.6.3 X Plugin Status Variables">
Section 22.5.6.3, “X Plugin Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Mysqlx_stmt_create_collection
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="x-plugin-status-variables.html" title="22.5.6.3 X Plugin Status Variables">
Section 22.5.6.3, “X Plugin Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Mysqlx_stmt_create_collection_index
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="x-plugin-status-variables.html" title="22.5.6.3 X Plugin Status Variables">
Section 22.5.6.3, “X Plugin Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Mysqlx_stmt_disable_notices
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="x-plugin-status-variables.html" title="22.5.6.3 X Plugin Status Variables">
Section 22.5.6.3, “X Plugin Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Mysqlx_stmt_drop_collection
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="x-plugin-status-variables.html" title="22.5.6.3 X Plugin Status Variables">
Section 22.5.6.3, “X Plugin Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Mysqlx_stmt_drop_collection_index
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="x-plugin-status-variables.html" title="22.5.6.3 X Plugin Status Variables">
Section 22.5.6.3, “X Plugin Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Mysqlx_stmt_enable_notices
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="x-plugin-status-variables.html" title="22.5.6.3 X Plugin Status Variables">
Section 22.5.6.3, “X Plugin Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Mysqlx_stmt_ensure_collection
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="x-plugin-status-variables.html" title="22.5.6.3 X Plugin Status Variables">
Section 22.5.6.3, “X Plugin Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Mysqlx_stmt_execute_mysqlx
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="x-plugin-status-variables.html" title="22.5.6.3 X Plugin Status Variables">
Section 22.5.6.3, “X Plugin Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Mysqlx_stmt_execute_sql
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="x-plugin-status-variables.html" title="22.5.6.3 X Plugin Status Variables">
Section 22.5.6.3, “X Plugin Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Mysqlx_stmt_execute_xplugin
</h3>
<dl>
<dt>
<a class="xref" href="x-plugin-status-variables.html" title="22.5.6.3 X Plugin Status Variables">
Section 22.5.6.3, “X Plugin Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Mysqlx_stmt_get_collection_options
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="x-plugin-status-variables.html" title="22.5.6.3 X Plugin Status Variables">
Section 22.5.6.3, “X Plugin Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Mysqlx_stmt_kill_client
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="x-plugin-status-variables.html" title="22.5.6.3 X Plugin Status Variables">
Section 22.5.6.3, “X Plugin Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Mysqlx_stmt_list_clients
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="x-plugin-status-variables.html" title="22.5.6.3 X Plugin Status Variables">
Section 22.5.6.3, “X Plugin Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Mysqlx_stmt_list_notices
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="x-plugin-status-variables.html" title="22.5.6.3 X Plugin Status Variables">
Section 22.5.6.3, “X Plugin Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Mysqlx_stmt_list_objects
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="x-plugin-status-variables.html" title="22.5.6.3 X Plugin Status Variables">
Section 22.5.6.3, “X Plugin Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Mysqlx_stmt_modify_collection_options
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="x-plugin-status-variables.html" title="22.5.6.3 X Plugin Status Variables">
Section 22.5.6.3, “X Plugin Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Mysqlx_stmt_ping
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="x-plugin-status-variables.html" title="22.5.6.3 X Plugin Status Variables">
Section 22.5.6.3, “X Plugin Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Mysqlx_worker_threads
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="x-plugin-status-variables.html" title="22.5.6.3 X Plugin Status Variables">
Section 22.5.6.3, “X Plugin Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Mysqlx_worker_threads_active
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="x-plugin-status-variables.html" title="22.5.6.3 X Plugin Status Variables">
Section 22.5.6.3, “X Plugin Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<a name="statvar-index-N">
</a>
<h3 class="title">
N
</h3>
<p>
[
<a class="link" href="dynindex-statvar.html#statvar-index-top">
index top
</a>
]
</p>
<dl>
<dt>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_api_adaptive_send_deferred_count
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_api_adaptive_send_deferred_count_replica
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_api_adaptive_send_deferred_count_session
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_api_adaptive_send_deferred_count_slave
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_api_adaptive_send_forced_count
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_api_adaptive_send_forced_count_replica
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_api_adaptive_send_forced_count_session
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_api_adaptive_send_forced_count_slave
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_api_adaptive_send_unforced_count
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_api_adaptive_send_unforced_count_replica
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_api_adaptive_send_unforced_count_session
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_api_adaptive_send_unforced_count_slave
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_api_bytes_received_count
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-ndb-api-statistics.html" title="25.6.16 NDB API Statistics Counters and Variables">
Section 25.6.16, “NDB API Statistics Counters and Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_api_bytes_received_count_replica
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_api_bytes_received_count_session
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-ndb-api-statistics.html" title="25.6.16 NDB API Statistics Counters and Variables">
Section 25.6.16, “NDB API Statistics Counters and Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_api_bytes_received_count_slave
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-ndb-api-statistics.html" title="25.6.16 NDB API Statistics Counters and Variables">
Section 25.6.16, “NDB API Statistics Counters and Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_api_bytes_sent_count
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-ndb-api-statistics.html" title="25.6.16 NDB API Statistics Counters and Variables">
Section 25.6.16, “NDB API Statistics Counters and Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_api_bytes_sent_count_replica
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-ndb-api-statistics.html" title="25.6.16 NDB API Statistics Counters and Variables">
Section 25.6.16, “NDB API Statistics Counters and Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_api_bytes_sent_count_session
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-ndb-api-statistics.html" title="25.6.16 NDB API Statistics Counters and Variables">
Section 25.6.16, “NDB API Statistics Counters and Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_api_bytes_sent_count_slave
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_api_event_bytes_count
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-ndb-api-statistics.html" title="25.6.16 NDB API Statistics Counters and Variables">
Section 25.6.16, “NDB API Statistics Counters and Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_api_event_bytes_count_injector
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-ndb-api-statistics.html" title="25.6.16 NDB API Statistics Counters and Variables">
Section 25.6.16, “NDB API Statistics Counters and Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_api_event_data_count
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-ndb-api-statistics.html" title="25.6.16 NDB API Statistics Counters and Variables">
Section 25.6.16, “NDB API Statistics Counters and Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_api_event_data_count_injector
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-ndb-api-statistics.html" title="25.6.16 NDB API Statistics Counters and Variables">
Section 25.6.16, “NDB API Statistics Counters and Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_api_event_nondata_count
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-ndb-api-statistics.html" title="25.6.16 NDB API Statistics Counters and Variables">
Section 25.6.16, “NDB API Statistics Counters and Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_api_event_nondata_count_injector
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-ndb-api-statistics.html" title="25.6.16 NDB API Statistics Counters and Variables">
Section 25.6.16, “NDB API Statistics Counters and Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_api_pk_op_count
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-ndb-api-statistics.html" title="25.6.16 NDB API Statistics Counters and Variables">
Section 25.6.16, “NDB API Statistics Counters and Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_api_pk_op_count_replica
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-ndb-api-statistics.html" title="25.6.16 NDB API Statistics Counters and Variables">
Section 25.6.16, “NDB API Statistics Counters and Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_api_pk_op_count_session
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-ndb-api-statistics.html" title="25.6.16 NDB API Statistics Counters and Variables">
Section 25.6.16, “NDB API Statistics Counters and Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_api_pk_op_count_slave
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_api_pruned_scan_count
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-ndb-api-statistics.html" title="25.6.16 NDB API Statistics Counters and Variables">
Section 25.6.16, “NDB API Statistics Counters and Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_api_pruned_scan_count_replica
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-ndb-api-statistics.html" title="25.6.16 NDB API Statistics Counters and Variables">
Section 25.6.16, “NDB API Statistics Counters and Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_api_pruned_scan_count_session
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-ndb-api-statistics.html" title="25.6.16 NDB API Statistics Counters and Variables">
Section 25.6.16, “NDB API Statistics Counters and Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_api_pruned_scan_count_slave
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_api_range_scan_count
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-ndb-api-statistics.html" title="25.6.16 NDB API Statistics Counters and Variables">
Section 25.6.16, “NDB API Statistics Counters and Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_api_range_scan_count_replica
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-ndb-api-statistics.html" title="25.6.16 NDB API Statistics Counters and Variables">
Section 25.6.16, “NDB API Statistics Counters and Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_api_range_scan_count_session
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-ndb-api-statistics.html" title="25.6.16 NDB API Statistics Counters and Variables">
Section 25.6.16, “NDB API Statistics Counters and Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_api_range_scan_count_slave
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_api_read_row_count
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-ndb-api-statistics.html" title="25.6.16 NDB API Statistics Counters and Variables">
Section 25.6.16, “NDB API Statistics Counters and Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_api_read_row_count_replica
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-ndb-api-statistics.html" title="25.6.16 NDB API Statistics Counters and Variables">
Section 25.6.16, “NDB API Statistics Counters and Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_api_read_row_count_session
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-ndb-api-statistics.html" title="25.6.16 NDB API Statistics Counters and Variables">
Section 25.6.16, “NDB API Statistics Counters and Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_api_read_row_count_slave
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_api_scan_batch_count
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-ndb-api-statistics.html" title="25.6.16 NDB API Statistics Counters and Variables">
Section 25.6.16, “NDB API Statistics Counters and Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_api_scan_batch_count_replica
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-ndb-api-statistics.html" title="25.6.16 NDB API Statistics Counters and Variables">
Section 25.6.16, “NDB API Statistics Counters and Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_api_scan_batch_count_session
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-ndb-api-statistics.html" title="25.6.16 NDB API Statistics Counters and Variables">
Section 25.6.16, “NDB API Statistics Counters and Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_api_scan_batch_count_slave
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_api_table_scan_count
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-ndb-api-statistics.html" title="25.6.16 NDB API Statistics Counters and Variables">
Section 25.6.16, “NDB API Statistics Counters and Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_api_table_scan_count_replica
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-ndb-api-statistics.html" title="25.6.16 NDB API Statistics Counters and Variables">
Section 25.6.16, “NDB API Statistics Counters and Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_api_table_scan_count_session
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-ndb-api-statistics.html" title="25.6.16 NDB API Statistics Counters and Variables">
Section 25.6.16, “NDB API Statistics Counters and Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_api_table_scan_count_slave
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_api_trans_abort_count
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-ndb-api-statistics.html" title="25.6.16 NDB API Statistics Counters and Variables">
Section 25.6.16, “NDB API Statistics Counters and Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_api_trans_abort_count_replica
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-ndb-api-statistics.html" title="25.6.16 NDB API Statistics Counters and Variables">
Section 25.6.16, “NDB API Statistics Counters and Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_api_trans_abort_count_session
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-ndb-api-statistics.html" title="25.6.16 NDB API Statistics Counters and Variables">
Section 25.6.16, “NDB API Statistics Counters and Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_api_trans_abort_count_slave
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_api_trans_close_count
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-ndb-api-statistics.html" title="25.6.16 NDB API Statistics Counters and Variables">
Section 25.6.16, “NDB API Statistics Counters and Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_api_trans_close_count_replica
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-ndb-api-statistics.html" title="25.6.16 NDB API Statistics Counters and Variables">
Section 25.6.16, “NDB API Statistics Counters and Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_api_trans_close_count_session
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-ndb-api-statistics.html" title="25.6.16 NDB API Statistics Counters and Variables">
Section 25.6.16, “NDB API Statistics Counters and Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_api_trans_close_count_slave
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_api_trans_commit_count
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-ndb-api-statistics.html" title="25.6.16 NDB API Statistics Counters and Variables">
Section 25.6.16, “NDB API Statistics Counters and Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_api_trans_commit_count_replica
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-ndb-api-statistics.html" title="25.6.16 NDB API Statistics Counters and Variables">
Section 25.6.16, “NDB API Statistics Counters and Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_api_trans_commit_count_session
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-ndb-api-statistics.html" title="25.6.16 NDB API Statistics Counters and Variables">
Section 25.6.16, “NDB API Statistics Counters and Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_api_trans_commit_count_slave
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_api_trans_local_read_row_count
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-ndb-api-statistics.html" title="25.6.16 NDB API Statistics Counters and Variables">
Section 25.6.16, “NDB API Statistics Counters and Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_api_trans_local_read_row_count_replica
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-ndb-api-statistics.html" title="25.6.16 NDB API Statistics Counters and Variables">
Section 25.6.16, “NDB API Statistics Counters and Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_api_trans_local_read_row_count_session
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-ndb-api-statistics.html" title="25.6.16 NDB API Statistics Counters and Variables">
Section 25.6.16, “NDB API Statistics Counters and Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_api_trans_local_read_row_count_slave
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_api_trans_start_count
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-ndb-api-statistics.html" title="25.6.16 NDB API Statistics Counters and Variables">
Section 25.6.16, “NDB API Statistics Counters and Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_api_trans_start_count_replica
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-ndb-api-statistics.html" title="25.6.16 NDB API Statistics Counters and Variables">
Section 25.6.16, “NDB API Statistics Counters and Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_api_trans_start_count_session
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-ndb-api-statistics.html" title="25.6.16 NDB API Statistics Counters and Variables">
Section 25.6.16, “NDB API Statistics Counters and Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_api_trans_start_count_slave
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_api_uk_op_count
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-ndb-api-statistics.html" title="25.6.16 NDB API Statistics Counters and Variables">
Section 25.6.16, “NDB API Statistics Counters and Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_api_uk_op_count_replica
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-ndb-api-statistics.html" title="25.6.16 NDB API Statistics Counters and Variables">
Section 25.6.16, “NDB API Statistics Counters and Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_api_uk_op_count_session
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-ndb-api-statistics.html" title="25.6.16 NDB API Statistics Counters and Variables">
Section 25.6.16, “NDB API Statistics Counters and Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_api_uk_op_count_slave
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_api_wait_exec_complete_count
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-ndb-api-statistics.html" title="25.6.16 NDB API Statistics Counters and Variables">
Section 25.6.16, “NDB API Statistics Counters and Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_api_wait_exec_complete_count_replica
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-ndb-api-statistics.html" title="25.6.16 NDB API Statistics Counters and Variables">
Section 25.6.16, “NDB API Statistics Counters and Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_api_wait_exec_complete_count_session
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-ndb-api-statistics.html" title="25.6.16 NDB API Statistics Counters and Variables">
Section 25.6.16, “NDB API Statistics Counters and Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_api_wait_exec_complete_count_slave
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_api_wait_meta_request_count
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-ndb-api-statistics.html" title="25.6.16 NDB API Statistics Counters and Variables">
Section 25.6.16, “NDB API Statistics Counters and Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_api_wait_meta_request_count_replica
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-ndb-api-statistics.html" title="25.6.16 NDB API Statistics Counters and Variables">
Section 25.6.16, “NDB API Statistics Counters and Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_api_wait_meta_request_count_session
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-ndb-api-statistics.html" title="25.6.16 NDB API Statistics Counters and Variables">
Section 25.6.16, “NDB API Statistics Counters and Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_api_wait_meta_request_count_slave
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_api_wait_nanos_count
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-ndb-api-statistics.html" title="25.6.16 NDB API Statistics Counters and Variables">
Section 25.6.16, “NDB API Statistics Counters and Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_api_wait_nanos_count_replica
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-ndb-api-statistics.html" title="25.6.16 NDB API Statistics Counters and Variables">
Section 25.6.16, “NDB API Statistics Counters and Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_api_wait_nanos_count_session
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-ndb-api-statistics.html" title="25.6.16 NDB API Statistics Counters and Variables">
Section 25.6.16, “NDB API Statistics Counters and Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_api_wait_nanos_count_slave
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_api_wait_scan_result_count
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-ndb-api-statistics.html" title="25.6.16 NDB API Statistics Counters and Variables">
Section 25.6.16, “NDB API Statistics Counters and Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_api_wait_scan_result_count_replica
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-ndb-api-statistics.html" title="25.6.16 NDB API Statistics Counters and Variables">
Section 25.6.16, “NDB API Statistics Counters and Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_api_wait_scan_result_count_session
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-ndb-api-statistics.html" title="25.6.16 NDB API Statistics Counters and Variables">
Section 25.6.16, “NDB API Statistics Counters and Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_api_wait_scan_result_count_slave
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_cluster_node_id
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_config_from_host
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_config_from_port
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_config_generation
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_conflict_fn_epoch
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-replication-conflict-resolution.html" title="25.7.12 NDB Cluster Replication Conflict Resolution">
Section 25.7.12, “NDB Cluster Replication Conflict Resolution”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_conflict_fn_epoch2
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-replication-conflict-resolution.html" title="25.7.12 NDB Cluster Replication Conflict Resolution">
Section 25.7.12, “NDB Cluster Replication Conflict Resolution”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_conflict_fn_epoch2_trans
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-replication-conflict-resolution.html" title="25.7.12 NDB Cluster Replication Conflict Resolution">
Section 25.7.12, “NDB Cluster Replication Conflict Resolution”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_conflict_fn_epoch_trans
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-replication-conflict-resolution.html" title="25.7.12 NDB Cluster Replication Conflict Resolution">
Section 25.7.12, “NDB Cluster Replication Conflict Resolution”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_conflict_fn_max
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-replication-conflict-resolution.html" title="25.7.12 NDB Cluster Replication Conflict Resolution">
Section 25.7.12, “NDB Cluster Replication Conflict Resolution”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_conflict_fn_max_del_win
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-replication-conflict-resolution.html" title="25.7.12 NDB Cluster Replication Conflict Resolution">
Section 25.7.12, “NDB Cluster Replication Conflict Resolution”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_conflict_fn_max_del_win_ins
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-replication-conflict-resolution.html" title="25.7.12 NDB Cluster Replication Conflict Resolution">
Section 25.7.12, “NDB Cluster Replication Conflict Resolution”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_conflict_fn_max_ins
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-replication-conflict-resolution.html" title="25.7.12 NDB Cluster Replication Conflict Resolution">
Section 25.7.12, “NDB Cluster Replication Conflict Resolution”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_conflict_fn_old
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-replication-conflict-resolution.html" title="25.7.12 NDB Cluster Replication Conflict Resolution">
Section 25.7.12, “NDB Cluster Replication Conflict Resolution”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_conflict_last_conflict_epoch
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_conflict_last_stable_epoch
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_conflict_reflected_op_discard_count
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-replication-conflict-resolution.html" title="25.7.12 NDB Cluster Replication Conflict Resolution">
Section 25.7.12, “NDB Cluster Replication Conflict Resolution”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_conflict_reflected_op_prepare_count
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-replication-conflict-resolution.html" title="25.7.12 NDB Cluster Replication Conflict Resolution">
Section 25.7.12, “NDB Cluster Replication Conflict Resolution”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_conflict_refresh_op_count
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_conflict_trans_conflict_commit_count
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_conflict_trans_detect_iter_count
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_conflict_trans_reject_count
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_conflict_trans_row_conflict_count
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_conflict_trans_row_reject_count
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-replication-conflict-resolution.html" title="25.7.12 NDB Cluster Replication Conflict Resolution">
Section 25.7.12, “NDB Cluster Replication Conflict Resolution”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_epoch_delete_delete_count
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_execute_count
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_last_commit_epoch_server
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_last_commit_epoch_session
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_metadata_detected_count
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_metadata_excluded_count
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_metadata_synced_count
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_number_of_data_nodes
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_pruned_scan_count
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_pushed_queries_defined
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-system-variables" title="25.4.3.9.2 NDB Cluster System Variables">
Section 25.4.3.9.2, “NDB Cluster System Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_pushed_queries_dropped
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-system-variables" title="25.4.3.9.2 NDB Cluster System Variables">
Section 25.4.3.9.2, “NDB Cluster System Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_pushed_queries_executed
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-system-variables" title="25.4.3.9.2 NDB Cluster System Variables">
Section 25.4.3.9.2, “NDB Cluster System Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_pushed_reads
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-system-variables" title="25.4.3.9.2 NDB Cluster System Variables">
Section 25.4.3.9.2, “NDB Cluster System Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_replica_max_replicated_epoch
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_scan_count
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_slave_max_replicated_epoch
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_system_name
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-system-definition.html" title="25.4.3.8 Defining the System">
Section 25.4.3.8, “Defining the System”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ndb_trans_hint_count_session
</h3>
<dl>
<dt>
<a class="xref" href="mysql-cluster-options-variables.html#mysql-cluster-status-variables" title="25.4.3.9.3 NDB Cluster Status Variables">
Section 25.4.3.9.3, “NDB Cluster Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Not_flushed_delayed_rows
</h3>
<dl>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<a name="statvar-index-O">
</a>
<h3 class="title">
O
</h3>
<p>
[
<a class="link" href="dynindex-statvar.html#statvar-index-top">
index top
</a>
]
</p>
<dl>
<dt>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ongoing_anonymous_gtid_violating_transaction_count
</h3>
<dl>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ongoing_anonymous_transaction_count
</h3>
<dl>
<dt>
<a class="xref" href="replication-mode-change-online-enable-gtids.html" title="19.1.4.2 Enabling GTID Transactions Online">
Section 19.1.4.2, “Enabling GTID Transactions Online”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ongoing_automatic_gtid_violating_transaction_count
</h3>
<dl>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Open_files
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Open_streams
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Open_table_definitions
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Open_tables
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Opened_files
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Opened_table_definitions
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Opened_tables
</h3>
<dl>
<dt>
<a class="xref" href="table-cache.html" title="10.4.3.1 How MySQL Opens and Closes Tables">
Section 10.4.3.1, “How MySQL Opens and Closes Tables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-system-variables.html" title="7.1.8 Server System Variables">
Section 7.1.8, “Server System Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<a name="statvar-index-P">
</a>
<h3 class="title">
P
</h3>
<p>
[
<a class="link" href="dynindex-statvar.html#statvar-index-top">
index top
</a>
]
</p>
<dl>
<dt>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Performance_schema_accounts_lost
</h3>
<dl>
<dt>
<a class="xref" href="performance-schema-status-variables.html" title="29.16 Performance Schema Status Variables">
Section 29.16, “Performance Schema Status Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Performance_schema_cond_classes_lost
</h3>
<dl>
<dt>
<a class="xref" href="performance-schema-status-variables.html" title="29.16 Performance Schema Status Variables">
Section 29.16, “Performance Schema Status Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Performance_schema_cond_instances_lost
</h3>
<dl>
<dt>
<a class="xref" href="performance-schema-status-variables.html" title="29.16 Performance Schema Status Variables">
Section 29.16, “Performance Schema Status Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Performance_schema_digest_lost
</h3>
<dl>
<dt>
<a class="xref" href="performance-schema-status-variables.html" title="29.16 Performance Schema Status Variables">
Section 29.16, “Performance Schema Status Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="performance-schema-system-variables.html" title="29.15 Performance Schema System Variables">
Section 29.15, “Performance Schema System Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Performance_schema_file_classes_lost
</h3>
<dl>
<dt>
<a class="xref" href="performance-schema-status-variables.html" title="29.16 Performance Schema Status Variables">
Section 29.16, “Performance Schema Status Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Performance_schema_file_handles_lost
</h3>
<dl>
<dt>
<a class="xref" href="performance-schema-status-variables.html" title="29.16 Performance Schema Status Variables">
Section 29.16, “Performance Schema Status Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Performance_schema_file_instances_lost
</h3>
<dl>
<dt>
<a class="xref" href="performance-schema-status-variables.html" title="29.16 Performance Schema Status Variables">
Section 29.16, “Performance Schema Status Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Performance_schema_hosts_lost
</h3>
<dl>
<dt>
<a class="xref" href="performance-schema-status-variables.html" title="29.16 Performance Schema Status Variables">
Section 29.16, “Performance Schema Status Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Performance_schema_index_stat_lost
</h3>
<dl>
<dt>
<a class="xref" href="performance-schema-status-variables.html" title="29.16 Performance Schema Status Variables">
Section 29.16, “Performance Schema Status Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="performance-schema-system-variables.html" title="29.15 Performance Schema System Variables">
Section 29.15, “Performance Schema System Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Performance_schema_locker_lost
</h3>
<dl>
<dt>
<a class="xref" href="performance-schema-status-variables.html" title="29.16 Performance Schema Status Variables">
Section 29.16, “Performance Schema Status Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Performance_schema_memory_classes_lost
</h3>
<dl>
<dt>
<a class="xref" href="performance-schema-status-variables.html" title="29.16 Performance Schema Status Variables">
Section 29.16, “Performance Schema Status Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Performance_schema_metadata_lock_lost
</h3>
<dl>
<dt>
<a class="xref" href="performance-schema-status-variables.html" title="29.16 Performance Schema Status Variables">
Section 29.16, “Performance Schema Status Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="performance-schema-system-variables.html" title="29.15 Performance Schema System Variables">
Section 29.15, “Performance Schema System Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Performance_schema_meter_lost
</h3>
<dl>
<dt>
<a class="xref" href="performance-schema-status-variables.html" title="29.16 Performance Schema Status Variables">
Section 29.16, “Performance Schema Status Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Performance_schema_metric_lost
</h3>
<dl>
<dt>
<a class="xref" href="performance-schema-status-variables.html" title="29.16 Performance Schema Status Variables">
Section 29.16, “Performance Schema Status Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Performance_schema_mutex_classes_lost
</h3>
<dl>
<dt>
<a class="xref" href="performance-schema-status-monitoring.html" title="29.7 Performance Schema Status Monitoring">
Section 29.7, “Performance Schema Status Monitoring”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="performance-schema-status-variables.html" title="29.16 Performance Schema Status Variables">
Section 29.16, “Performance Schema Status Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Performance_schema_mutex_instances_lost
</h3>
<dl>
<dt>
<a class="xref" href="performance-schema-status-monitoring.html" title="29.7 Performance Schema Status Monitoring">
Section 29.7, “Performance Schema Status Monitoring”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="performance-schema-status-variables.html" title="29.16 Performance Schema Status Variables">
Section 29.16, “Performance Schema Status Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Performance_schema_nested_statement_lost
</h3>
<dl>
<dt>
<a class="xref" href="performance-schema-status-variables.html" title="29.16 Performance Schema Status Variables">
Section 29.16, “Performance Schema Status Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="performance-schema-system-variables.html" title="29.15 Performance Schema System Variables">
Section 29.15, “Performance Schema System Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Performance_schema_prepared_statements_lost
</h3>
<dl>
<dt>
<a class="xref" href="performance-schema-status-variables.html" title="29.16 Performance Schema Status Variables">
Section 29.16, “Performance Schema Status Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="performance-schema-system-variables.html" title="29.15 Performance Schema System Variables">
Section 29.15, “Performance Schema System Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="performance-schema-prepared-statements-instances-table.html" title="29.12.6.4 The prepared_statements_instances Table">
Section 29.12.6.4, “The prepared_statements_instances Table”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Performance_schema_program_lost
</h3>
<dl>
<dt>
<a class="xref" href="performance-schema-status-variables.html" title="29.16 Performance Schema Status Variables">
Section 29.16, “Performance Schema Status Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="performance-schema-system-variables.html" title="29.15 Performance Schema System Variables">
Section 29.15, “Performance Schema System Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Performance_schema_rwlock_classes_lost
</h3>
<dl>
<dt>
<a class="xref" href="performance-schema-status-variables.html" title="29.16 Performance Schema Status Variables">
Section 29.16, “Performance Schema Status Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Performance_schema_rwlock_instances_lost
</h3>
<dl>
<dt>
<a class="xref" href="performance-schema-status-variables.html" title="29.16 Performance Schema Status Variables">
Section 29.16, “Performance Schema Status Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Performance_schema_session_connect_attrs_longest_seen
</h3>
<dl>
<dt>
<a class="xref" href="performance-schema-connection-attribute-tables.html" title="29.12.9 Performance Schema Connection Attribute Tables">
Section 29.12.9, “Performance Schema Connection Attribute Tables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="performance-schema-status-variables.html" title="29.16 Performance Schema Status Variables">
Section 29.16, “Performance Schema Status Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Performance_schema_session_connect_attrs_lost
</h3>
<dl>
<dt>
<a class="xref" href="performance-schema-connection-attribute-tables.html" title="29.12.9 Performance Schema Connection Attribute Tables">
Section 29.12.9, “Performance Schema Connection Attribute Tables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="performance-schema-status-variables.html" title="29.16 Performance Schema Status Variables">
Section 29.16, “Performance Schema Status Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="performance-schema-system-variables.html" title="29.15 Performance Schema System Variables">
Section 29.15, “Performance Schema System Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Performance_schema_socket_classes_lost
</h3>
<dl>
<dt>
<a class="xref" href="performance-schema-status-variables.html" title="29.16 Performance Schema Status Variables">
Section 29.16, “Performance Schema Status Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Performance_schema_socket_instances_lost
</h3>
<dl>
<dt>
<a class="xref" href="performance-schema-status-variables.html" title="29.16 Performance Schema Status Variables">
Section 29.16, “Performance Schema Status Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Performance_schema_stage_classes_lost
</h3>
<dl>
<dt>
<a class="xref" href="performance-schema-status-variables.html" title="29.16 Performance Schema Status Variables">
Section 29.16, “Performance Schema Status Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Performance_schema_statement_classes_lost
</h3>
<dl>
<dt>
<a class="xref" href="performance-schema-status-variables.html" title="29.16 Performance Schema Status Variables">
Section 29.16, “Performance Schema Status Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Performance_schema_table_handles_lost
</h3>
<dl>
<dt>
<a class="xref" href="performance-schema-status-variables.html" title="29.16 Performance Schema Status Variables">
Section 29.16, “Performance Schema Status Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="performance-schema-system-variables.html" title="29.15 Performance Schema System Variables">
Section 29.15, “Performance Schema System Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Performance_schema_table_instances_lost
</h3>
<dl>
<dt>
<a class="xref" href="performance-schema-status-variables.html" title="29.16 Performance Schema Status Variables">
Section 29.16, “Performance Schema Status Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Performance_schema_table_lock_stat_lost
</h3>
<dl>
<dt>
<a class="xref" href="performance-schema-status-variables.html" title="29.16 Performance Schema Status Variables">
Section 29.16, “Performance Schema Status Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="performance-schema-system-variables.html" title="29.15 Performance Schema System Variables">
Section 29.15, “Performance Schema System Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Performance_schema_thread_classes_lost
</h3>
<dl>
<dt>
<a class="xref" href="performance-schema-status-variables.html" title="29.16 Performance Schema Status Variables">
Section 29.16, “Performance Schema Status Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Performance_schema_thread_instances_lost
</h3>
<dl>
<dt>
<a class="xref" href="performance-schema-functions.html" title="14.21 Performance Schema Functions">
Section 14.21, “Performance Schema Functions”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="performance-schema-status-variables.html" title="29.16 Performance Schema Status Variables">
Section 29.16, “Performance Schema Status Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="performance-schema-system-variable-tables.html" title="29.12.14 Performance Schema System Variable Tables">
Section 29.12.14, “Performance Schema System Variable Tables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="performance-schema-system-variables.html" title="29.15 Performance Schema System Variables">
Section 29.15, “Performance Schema System Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Performance_schema_users_lost
</h3>
<dl>
<dt>
<a class="xref" href="performance-schema-status-variables.html" title="29.16 Performance Schema Status Variables">
Section 29.16, “Performance Schema Status Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Prepared_stmt_count
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<a name="statvar-index-Q">
</a>
<h3 class="title">
Q
</h3>
<p>
[
<a class="link" href="dynindex-statvar.html#statvar-index-top">
index top
</a>
]
</p>
<dl>
<dt>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Queries
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Questions
</h3>
<dl>
<dt>
<a class="xref" href="mysqladmin.html" title="6.5.2 mysqladmin — A MySQL Server Administration Program">
Section 6.5.2, “mysqladmin — A MySQL Server Administration Program”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<a name="statvar-index-R">
</a>
<h3 class="title">
R
</h3>
<p>
[
<a class="link" href="dynindex-statvar.html#statvar-index-top">
index top
</a>
]
</p>
<dl>
<dt>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Replica_open_temp_tables
</h3>
<dl>
<dt>
<a class="xref" href="change-replication-source-to.html" title="15.4.2.2 CHANGE REPLICATION SOURCE TO Statement">
Section 15.4.2.2, “CHANGE REPLICATION SOURCE TO Statement”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="replication-features-temptables.html" title="19.5.1.31 Replication and Temporary Tables">
Section 19.5.1.31, “Replication and Temporary Tables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="stop-replica.html" title="15.4.2.5 STOP REPLICA Statement">
Section 15.4.2.5, “STOP REPLICA Statement”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Replica_rows_last_search_algorithm_used
</h3>
<dl>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Resource_group_supported
</h3>
<dl>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Rewriter_number_loaded_rules
</h3>
<dl>
<dt>
<a class="xref" href="rewriter-query-rewrite-plugin-reference.html#rewriter-query-rewrite-plugin-status-variables" title="7.6.4.3.4 Rewriter Query Rewrite Plugin Status Variables">
Section 7.6.4.3.4, “Rewriter Query Rewrite Plugin Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Rewriter_number_reloads
</h3>
<dl>
<dt>
<a class="xref" href="rewriter-query-rewrite-plugin-reference.html#rewriter-query-rewrite-plugin-status-variables" title="7.6.4.3.4 Rewriter Query Rewrite Plugin Status Variables">
Section 7.6.4.3.4, “Rewriter Query Rewrite Plugin Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Rewriter_number_rewritten_queries
</h3>
<dl>
<dt>
<a class="xref" href="rewriter-query-rewrite-plugin-reference.html#rewriter-query-rewrite-plugin-status-variables" title="7.6.4.3.4 Rewriter Query Rewrite Plugin Status Variables">
Section 7.6.4.3.4, “Rewriter Query Rewrite Plugin Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Rewriter_reload_error
</h3>
<dl>
<dt>
<a class="xref" href="rewriter-query-rewrite-plugin-reference.html#rewriter-query-rewrite-plugin-routines" title="7.6.4.3.2 Rewriter Query Rewrite Plugin Procedures and Functions">
Section 7.6.4.3.2, “Rewriter Query Rewrite Plugin Procedures and Functions”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="rewriter-query-rewrite-plugin-reference.html#rewriter-query-rewrite-plugin-table" title="7.6.4.3.1 Rewriter Query Rewrite Plugin Rules Table">
Section 7.6.4.3.1, “Rewriter Query Rewrite Plugin Rules Table”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="rewriter-query-rewrite-plugin-reference.html#rewriter-query-rewrite-plugin-status-variables" title="7.6.4.3.4 Rewriter Query Rewrite Plugin Status Variables">
Section 7.6.4.3.4, “Rewriter Query Rewrite Plugin Status Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="rewriter-query-rewrite-plugin-usage.html" title="7.6.4.2 Using the Rewriter Query Rewrite Plugin">
Section 7.6.4.2, “Using the Rewriter Query Rewrite Plugin”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Rpl_semi_sync_master_clients
</h3>
<dl>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Rpl_semi_sync_master_net_avg_wait_time
</h3>
<dl>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Rpl_semi_sync_master_net_wait_time
</h3>
<dl>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Rpl_semi_sync_master_net_waits
</h3>
<dl>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Rpl_semi_sync_master_no_times
</h3>
<dl>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Rpl_semi_sync_master_no_tx
</h3>
<dl>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Rpl_semi_sync_master_status
</h3>
<dl>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Rpl_semi_sync_master_timefunc_failures
</h3>
<dl>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Rpl_semi_sync_master_tx_avg_wait_time
</h3>
<dl>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Rpl_semi_sync_master_tx_wait_time
</h3>
<dl>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Rpl_semi_sync_master_tx_waits
</h3>
<dl>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Rpl_semi_sync_master_wait_pos_backtraverse
</h3>
<dl>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Rpl_semi_sync_master_wait_sessions
</h3>
<dl>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Rpl_semi_sync_master_yes_tx
</h3>
<dl>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Rpl_semi_sync_replica_status
</h3>
<dl>
<dt>
<a class="xref" href="replication-semisync-monitoring.html" title="19.4.10.3 Semisynchronous Replication Monitoring">
Section 19.4.10.3, “Semisynchronous Replication Monitoring”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Rpl_semi_sync_slave_status
</h3>
<dl>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Rpl_semi_sync_source_clients
</h3>
<dl>
<dt>
<a class="xref" href="replication-semisync-monitoring.html" title="19.4.10.3 Semisynchronous Replication Monitoring">
Section 19.4.10.3, “Semisynchronous Replication Monitoring”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Rpl_semi_sync_source_net_avg_wait_time
</h3>
<dl>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Rpl_semi_sync_source_net_wait_time
</h3>
<dl>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Rpl_semi_sync_source_net_waits
</h3>
<dl>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Rpl_semi_sync_source_no_times
</h3>
<dl>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Rpl_semi_sync_source_no_tx
</h3>
<dl>
<dt>
<a class="xref" href="replication-semisync-monitoring.html" title="19.4.10.3 Semisynchronous Replication Monitoring">
Section 19.4.10.3, “Semisynchronous Replication Monitoring”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Rpl_semi_sync_source_status
</h3>
<dl>
<dt>
<a class="xref" href="replication-semisync-monitoring.html" title="19.4.10.3 Semisynchronous Replication Monitoring">
Section 19.4.10.3, “Semisynchronous Replication Monitoring”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Rpl_semi_sync_source_timefunc_failures
</h3>
<dl>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Rpl_semi_sync_source_tx_avg_wait_time
</h3>
<dl>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Rpl_semi_sync_source_tx_wait_time
</h3>
<dl>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Rpl_semi_sync_source_tx_waits
</h3>
<dl>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Rpl_semi_sync_source_wait_pos_backtraverse
</h3>
<dl>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Rpl_semi_sync_source_wait_sessions
</h3>
<dl>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Rpl_semi_sync_source_yes_tx
</h3>
<dl>
<dt>
<a class="xref" href="replication-semisync-monitoring.html" title="19.4.10.3 Semisynchronous Replication Monitoring">
Section 19.4.10.3, “Semisynchronous Replication Monitoring”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Rsa_public_key
</h3>
<dl>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="sha256-pluggable-authentication.html" title="8.4.1.3 SHA-256 Pluggable Authentication">
Section 8.4.1.3, “SHA-256 Pluggable Authentication”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<a name="statvar-index-S">
</a>
<h3 class="title">
S
</h3>
<p>
[
<a class="link" href="dynindex-statvar.html#statvar-index-top">
index top
</a>
]
</p>
<dl>
<dt>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Secondary_engine_execution_count
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Select_full_join
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="performance-schema-events-statements-current-table.html" title="29.12.6.1 The events_statements_current Table">
Section 29.12.6.1, “The events_statements_current Table”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Select_full_range_join
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="performance-schema-events-statements-current-table.html" title="29.12.6.1 The events_statements_current Table">
Section 29.12.6.1, “The events_statements_current Table”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Select_range
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="performance-schema-events-statements-current-table.html" title="29.12.6.1 The events_statements_current Table">
Section 29.12.6.1, “The events_statements_current Table”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Select_range_check
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="performance-schema-events-statements-current-table.html" title="29.12.6.1 The events_statements_current Table">
Section 29.12.6.1, “The events_statements_current Table”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Select_scan
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="performance-schema-events-statements-current-table.html" title="29.12.6.1 The events_statements_current Table">
Section 29.12.6.1, “The events_statements_current Table”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Slave_open_temp_tables
</h3>
<dl>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Slave_rows_last_search_algorithm_used
</h3>
<dl>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Slow_launch_threads
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-system-variables.html" title="7.1.8 Server System Variables">
Section 7.1.8, “Server System Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Slow_queries
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-system-variables.html" title="7.1.8 Server System Variables">
Section 7.1.8, “Server System Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Sort_merge_passes
</h3>
<dl>
<dt>
<a class="xref" href="order-by-optimization.html" title="10.2.1.16 ORDER BY Optimization">
Section 10.2.1.16, “ORDER BY Optimization”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-system-variables.html" title="7.1.8 Server System Variables">
Section 7.1.8, “Server System Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="performance-schema-events-statements-current-table.html" title="29.12.6.1 The events_statements_current Table">
Section 29.12.6.1, “The events_statements_current Table”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="slow-query-log.html" title="7.4.5 The Slow Query Log">
Section 7.4.5, “The Slow Query Log”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Sort_range
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="performance-schema-events-statements-current-table.html" title="29.12.6.1 The events_statements_current Table">
Section 29.12.6.1, “The events_statements_current Table”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="slow-query-log.html" title="7.4.5 The Slow Query Log">
Section 7.4.5, “The Slow Query Log”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Sort_rows
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="performance-schema-events-statements-current-table.html" title="29.12.6.1 The events_statements_current Table">
Section 29.12.6.1, “The events_statements_current Table”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="slow-query-log.html" title="7.4.5 The Slow Query Log">
Section 7.4.5, “The Slow Query Log”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Sort_scan
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="performance-schema-events-statements-current-table.html" title="29.12.6.1 The events_statements_current Table">
Section 29.12.6.1, “The events_statements_current Table”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="slow-query-log.html" title="7.4.5 The Slow Query Log">
Section 7.4.5, “The Slow Query Log”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ssl_accept_renegotiates
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ssl_accepts
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ssl_callback_cache_hits
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ssl_cipher
</h3>
<dl>
<dt>
<a class="xref" href="using-encrypted-connections.html" title="8.3.1 Configuring MySQL to Use Encrypted Connections">
Section 8.3.1, “Configuring MySQL to Use Encrypted Connections”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="encrypted-connection-protocols-ciphers.html" title="8.3.2 Encrypted Connection TLS Protocols and Ciphers">
Section 8.3.2, “Encrypted Connection TLS Protocols and Ciphers”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ssl_cipher_list
</h3>
<dl>
<dt>
<a class="xref" href="encrypted-connection-protocols-ciphers.html" title="8.3.2 Encrypted Connection TLS Protocols and Ciphers">
Section 8.3.2, “Encrypted Connection TLS Protocols and Ciphers”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ssl_client_connects
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ssl_connect_renegotiates
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ssl_ctx_verify_depth
</h3>
<dl>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ssl_ctx_verify_mode
</h3>
<dl>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ssl_default_timeout
</h3>
<dl>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ssl_finished_accepts
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ssl_finished_connects
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ssl_server_not_after
</h3>
<dl>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ssl_server_not_before
</h3>
<dl>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ssl_session_cache_hits
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ssl_session_cache_misses
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ssl_session_cache_mode
</h3>
<dl>
<dt>
<a class="xref" href="reusing-ssl-sessions.html" title="8.3.5 Reusing SSL Sessions">
Section 8.3.5, “Reusing SSL Sessions”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-system-variables.html" title="7.1.8 Server System Variables">
Section 7.1.8, “Server System Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ssl_session_cache_overflows
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ssl_session_cache_size
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ssl_session_cache_timeout
</h3>
<dl>
<dt>
<a class="xref" href="reusing-ssl-sessions.html" title="8.3.5 Reusing SSL Sessions">
Section 8.3.5, “Reusing SSL Sessions”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-system-variables.html" title="7.1.8 Server System Variables">
Section 7.1.8, “Server System Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ssl_session_cache_timeouts
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ssl_sessions_reused
</h3>
<dl>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ssl_used_session_cache_entries
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ssl_verify_depth
</h3>
<dl>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ssl_verify_mode
</h3>
<dl>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Ssl_version
</h3>
<dl>
<dt>
<a class="xref" href="encrypted-connection-protocols-ciphers.html" title="8.3.2 Encrypted Connection TLS Protocols and Ciphers">
Section 8.3.2, “Encrypted Connection TLS Protocols and Ciphers”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<a name="statvar-index-T">
</a>
<h3 class="title">
T
</h3>
<p>
[
<a class="link" href="dynindex-statvar.html#statvar-index-top">
index top
</a>
]
</p>
<dl>
<dt>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Table_locks_immediate
</h3>
<dl>
<dt>
<a class="xref" href="internal-locking.html" title="10.11.1 Internal Locking Methods">
Section 10.11.1, “Internal Locking Methods”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Table_locks_waited
</h3>
<dl>
<dt>
<a class="xref" href="internal-locking.html" title="10.11.1 Internal Locking Methods">
Section 10.11.1, “Internal Locking Methods”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Table_open_cache_hits
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Table_open_cache_misses
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Table_open_cache_overflows
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Tc_log_max_pages_used
</h3>
<dl>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Tc_log_page_size
</h3>
<dl>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Tc_log_page_waits
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
telemetry.live_sessions
</h3>
<dl>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Telemetry_metrics_supported
</h3>
<dl>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Telemetry_traces_supported
</h3>
<dl>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Threads_cached
</h3>
<dl>
<dt>
<a class="xref" href="connection-interfaces.html" title="7.1.12.1 Connection Interfaces">
Section 7.1.12.1, “Connection Interfaces”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Threads_connected
</h3>
<dl>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Threads_created
</h3>
<dl>
<dt>
<a class="xref" href="connection-interfaces.html" title="7.1.12.1 Connection Interfaces">
Section 7.1.12.1, “Connection Interfaces”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-system-variables.html" title="7.1.8 Server System Variables">
Section 7.1.8, “Server System Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Threads_running
</h3>
<dl>
<dt>
<a class="xref" href="faqs-thread-pool.html" title="A.15 MySQL 8.4 FAQ: MySQL Enterprise Thread Pool">
Section A.15, “MySQL 8.4 FAQ: MySQL Enterprise Thread Pool”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Tls_library_version
</h3>
<dl>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="encrypted-connections.html" title="8.3 Using Encrypted Connections">
Section 8.3, “Using Encrypted Connections”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Tls_sni_server_name
</h3>
<dl>
<dt>
<a class="xref" href="mysql-command-options.html" title="6.5.1.1 mysql Client Options">
Section 6.5.1.1, “mysql Client Options”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-migrate-keyring.html" title="6.6.8 mysql_migrate_keyring — Keyring Key Migration Utility">
Section 6.6.8, “mysql_migrate_keyring — Keyring Key Migration Utility”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysql-secure-installation.html" title="6.4.2 mysql_secure_installation — Improve MySQL Installation Security">
Section 6.4.2, “mysql_secure_installation — Improve MySQL Installation Security”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysqladmin.html" title="6.5.2 mysqladmin — A MySQL Server Administration Program">
Section 6.5.2, “mysqladmin — A MySQL Server Administration Program”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysqlbinlog.html" title="6.6.9 mysqlbinlog — Utility for Processing Binary Log Files">
Section 6.6.9, “mysqlbinlog — Utility for Processing Binary Log Files”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysqlcheck.html" title="6.5.3 mysqlcheck — A Table Maintenance Program">
Section 6.5.3, “mysqlcheck — A Table Maintenance Program”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysqldump.html" title="6.5.4 mysqldump — A Database Backup Program">
Section 6.5.4, “mysqldump — A Database Backup Program”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysqlimport.html" title="6.5.5 mysqlimport — A Data Import Program">
Section 6.5.5, “mysqlimport — A Data Import Program”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysqlshow.html" title="6.5.6 mysqlshow — Display Database, Table, and Column Information">
Section 6.5.6, “mysqlshow — Display Database, Table, and Column Information”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="mysqlslap.html" title="6.5.7 mysqlslap — A Load Emulation Client">
Section 6.5.7, “mysqlslap — A Load Emulation Client”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<a name="statvar-index-U">
</a>
<h3 class="title">
U
</h3>
<p>
[
<a class="link" href="dynindex-statvar.html#statvar-index-top">
index top
</a>
]
</p>
<dl>
<dt>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Uptime
</h3>
<dl>
<dt>
<a class="xref" href="mysqladmin.html" title="6.5.2 mysqladmin — A MySQL Server Administration Program">
Section 6.5.2, “mysqladmin — A MySQL Server Administration Program”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="telemetry-metrics-meter-metrics.html" title="35.4.3 Server Metrics">
Section 35.4.3, “Server Metrics”
</a>
</dt>
<dd>
</dd>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
Uptime_since_flush_status
</h3>
<dl>
<dt>
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<a name="statvar-index-V">
</a>
<h3 class="title">
V
</h3>
<p>
[
<a class="link" href="dynindex-statvar.html#statvar-index-top">
index top
</a>
]
</p>
<dl>
<dt>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
validate_password.dictionary_file_last_parsed
</h3>
<dl>
<dt>
<a class="xref" href="validate-password-options-variables.html" title="8.4.3.2 Password Validation Options and Variables">
Section 8.4.3.2, “Password Validation Options and Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
validate_password.dictionary_file_words_count
</h3>
<dl>
<dt>
<a class="xref" href="validate-password-options-variables.html" title="8.4.3.2 Password Validation Options and Variables">
Section 8.4.3.2, “Password Validation Options and Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
validate_password_dictionary_file_last_parsed
</h3>
<dl>
<dt>
<a class="xref" href="validate-password-options-variables.html" title="8.4.3.2 Password Validation Options and Variables">
Section 8.4.3.2, “Password Validation Options and Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
<div class="indexdiv">
<h3 class="title">
validate_password_dictionary_file_words_count
</h3>
<dl>
<dt>
<a class="xref" href="validate-password-options-variables.html" title="8.4.3.2 Password Validation Options and Variables">
Section 8.4.3.2, “Password Validation Options and Variables”
</a>
</dt>
<dd>
</dd>
</dl>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/enterprise-encryption-usage.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="enterprise-encryption-usage">
</a>
8.6.3 MySQL Enterprise Encryption Usage and Examples
</h3>
</div>
</div>
</div>
<p>
To use MySQL Enterprise Encryption in applications, invoke the functions that are
appropriate for the operations you wish to perform. This section
demonstrates how to carry out some representative tasks.
</p>
<p>
MySQL Enterprise Encryption functions are provided by a MySQL component
<code class="literal">
component_enterprise_encryption
</code>
. For
information about these functions, see
<a class="xref" href="enterprise-encryption-function-reference.html" title="8.6.4 MySQL Enterprise Encryption Function Reference">
Section 8.6.4, “MySQL Enterprise Encryption Function Reference”
</a>
.
</p>
<p>
The following general considerations apply when choosing key
lengths and encryption algorithms:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
The strength of encryption for private and public keys
increases with the key size, but the time for key generation
increases as well.
</p>
</li>
<li class="listitem">
<p>
Component functions support RSA keys only.
</p>
</li>
<li class="listitem">
<p>
Asymmetric encryption functions consume more resources
compared to symmetric functions. They are good for encrypting
small amounts of data and creating and verifying signatures.
For encrypting large amounts of data, symmetric encryption
functions are faster. MySQL Server provides the
<a class="link" href="encryption-functions.html#function_aes-encrypt">
<code class="literal">
AES_ENCRYPT()
</code>
</a>
and
<a class="link" href="encryption-functions.html#function_aes-decrypt">
<code class="literal">
AES_DECRYPT()
</code>
</a>
functions for
symmetric encryption.
</p>
</li>
</ul>
</div>
<p>
Key string values can be created at runtime and stored into a
variable or table using
<a class="link" href="set-variable.html" title="15.7.6.1 SET Syntax for Variable Assignment">
<code class="literal">
SET
</code>
</a>
,
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
, or
<a class="link" href="insert.html" title="15.2.7 INSERT Statement">
<code class="literal">
INSERT
</code>
</a>
, as shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa62148874"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SET</span> <span class="token variable">@priv1</span> <span class="token operator">=</span> <span class="token function">create_asymmetric_priv_key</span><span class="token punctuation">(</span><span class="token string">'RSA'</span><span class="token punctuation">,</span> <span class="token number">2048</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">SELECT</span> <span class="token function">create_asymmetric_priv_key</span><span class="token punctuation">(</span><span class="token string">'RSA'</span><span class="token punctuation">,</span> <span class="token number">2048</span><span class="token punctuation">)</span> <span class="token keyword">INTO</span> <span class="token variable">@priv2</span><span class="token punctuation">;</span>
<span class="token keyword">INSERT</span> <span class="token keyword">INTO</span> t <span class="token punctuation">(</span>key_col<span class="token punctuation">)</span> <span class="token keyword">VALUES</span><span class="token punctuation">(</span><span class="token function">create_asymmetric_priv_key</span><span class="token punctuation">(</span><span class="token string">'RSA'</span><span class="token punctuation">,</span> <span class="token number">1024</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Key string values stored in files can be read using the
<a class="link" href="string-functions.html#function_load-file">
<code class="literal">
LOAD_FILE()
</code>
</a>
function by users who
have the
<a class="link" href="privileges-provided.html#priv_file">
<code class="literal">
FILE
</code>
</a>
privilege. Digest and
signature strings can be handled similarly.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="xref" href="enterprise-encryption-usage.html#enterprise-encryption-usage-create-key-pair" title="Create a private/public key pair">
Create a private/public key pair
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="enterprise-encryption-usage.html#enterprise-encryption-usage-encrypt-decrypt" title="Use the public key to encrypt data and the private key to decrypt it">
Use the public key to encrypt data and the private key to decrypt it
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="enterprise-encryption-usage.html#enterprise-encryption-usage-create-digest" title="Generate a digest from a string">
Generate a digest from a string
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="enterprise-encryption-usage.html#enterprise-encryption-usage-digital-signing" title="Use the digest with a key pair">
Use the digest with a key pair
</a>
</p>
</li>
</ul>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="enterprise-encryption-usage-create-key-pair">
</a>
Create a private/public key pair
</h4>
</div>
</div>
</div>
<p>
This example works with both the component functions and the
legacy functions:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa23396150"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token comment" spellcheck="true">-- Encryption algorithm</span>
<span class="token keyword">SET</span> <span class="token variable">@algo</span> <span class="token operator">=</span> <span class="token string">'RSA'</span><span class="token punctuation">;</span>
<span class="token comment" spellcheck="true">-- Key length in bits; make larger for stronger keys</span>
<span class="token keyword">SET</span> <span class="token variable">@key_len</span> <span class="token operator">=</span> <span class="token number">2048</span><span class="token punctuation">;</span>
<span class="token comment" spellcheck="true">-- Create private key</span>
<span class="token keyword">SET</span> <span class="token variable">@priv</span> <span class="token operator">=</span> <span class="token function">create_asymmetric_priv_key</span><span class="token punctuation">(</span><span class="token variable">@algo</span><span class="token punctuation">,</span> <span class="token variable">@key_len</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment" spellcheck="true">-- Derive corresponding public key from private key, using same algorithm</span>
<span class="token keyword">SET</span> <span class="token variable">@pub</span> <span class="token operator">=</span> <span class="token function">create_asymmetric_pub_key</span><span class="token punctuation">(</span><span class="token variable">@algo</span><span class="token punctuation">,</span> <span class="token variable">@priv</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
You can use the key pair to encrypt and decrypt data or to sign
and verify data.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="enterprise-encryption-usage-encrypt-decrypt">
</a>
Use the public key to encrypt data and the private key to decrypt it
</h4>
</div>
</div>
</div>
<p>
This example works with both the component functions and the
legacy functions. In both cases, the members of the key pair
must be RSA keys:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa29571998"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SET</span> <span class="token variable">@ciphertext</span> <span class="token operator">=</span> <span class="token function">asymmetric_encrypt</span><span class="token punctuation">(</span><span class="token variable">@algo</span><span class="token punctuation">,</span> <span class="token string">'My secret text'</span><span class="token punctuation">,</span> <span class="token variable">@pub</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">SET</span> <span class="token variable">@plaintext</span> <span class="token operator">=</span> <span class="token function">asymmetric_decrypt</span><span class="token punctuation">(</span><span class="token variable">@algo</span><span class="token punctuation">,</span> <span class="token variable">@ciphertext</span><span class="token punctuation">,</span> <span class="token variable">@priv</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="enterprise-encryption-usage-create-digest">
</a>
Generate a digest from a string
</h4>
</div>
</div>
</div>
<p>
This example works with both the component functions and the
legacy functions:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa15033726"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token comment" spellcheck="true">-- Digest type</span>
<span class="token keyword">SET</span> <span class="token variable">@dig_type</span> <span class="token operator">=</span> <span class="token string">'SHA512'</span><span class="token punctuation">;</span>
<span class="token comment" spellcheck="true">-- Generate digest string</span>
<span class="token keyword">SET</span> <span class="token variable">@dig</span> <span class="token operator">=</span> <span class="token function">create_digest</span><span class="token punctuation">(</span><span class="token variable">@dig_type</span><span class="token punctuation">,</span> <span class="token string">'My text to digest'</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="enterprise-encryption-usage-digital-signing">
</a>
Use the digest with a key pair
</h4>
</div>
</div>
</div>
<p>
The key pair can be used to sign data, then verify that the
signature matches the digest. This example works with both the
component functions and the legacy functions:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa40540720"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token comment" spellcheck="true">-- Encryption algorithm; keys must</span>
<span class="token comment" spellcheck="true">-- have been created using same algorithm</span>
<span class="token keyword">SET</span> <span class="token variable">@algo</span> <span class="token operator">=</span> <span class="token string">'RSA'</span><span class="token punctuation">;</span>
–<span class="token operator">-</span> Digest <span class="token keyword">algorithm</span> <span class="token keyword">to</span> sign the <span class="token keyword">data</span>
<span class="token keyword">SET</span> <span class="token variable">@dig_type</span> <span class="token operator">=</span> <span class="token string">'SHA512'</span><span class="token punctuation">;</span>
<span class="token comment" spellcheck="true">-- Generate signature for digest and verify signature against digest</span>
<span class="token keyword">SET</span> <span class="token variable">@sig</span> <span class="token operator">=</span> <span class="token function">asymmetric_sign</span><span class="token punctuation">(</span><span class="token variable">@algo</span><span class="token punctuation">,</span> <span class="token variable">@dig</span><span class="token punctuation">,</span> <span class="token variable">@priv</span><span class="token punctuation">,</span> <span class="token variable">@dig_type</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment" spellcheck="true">-- Verify signature against digest</span>
<span class="token keyword">SET</span> <span class="token variable">@verf</span> <span class="token operator">=</span> <span class="token function">asymmetric_verify</span><span class="token punctuation">(</span><span class="token variable">@algo</span><span class="token punctuation">,</span> <span class="token variable">@dig</span><span class="token punctuation">,</span> <span class="token variable">@sig</span><span class="token punctuation">,</span> <span class="token variable">@pub</span><span class="token punctuation">,</span> <span class="token variable">@dig_type</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
For the legacy functions, signatures require a digest. For the
component functions, signatures do not require a digest, and can
use any data string. The digest type in these functions refers
to the algorithm that is used to sign the data, not the
algorithm that was used to create the original input for the
signature. This example is for the component functions:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa42100611"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token comment" spellcheck="true">-- Encryption algorithm; keys must</span>
<span class="token comment" spellcheck="true">-- have been created using same algorithm</span>
<span class="token keyword">SET</span> <span class="token variable">@algo</span> <span class="token operator">=</span> <span class="token string">'RSA'</span><span class="token punctuation">;</span>
–<span class="token operator">-</span> Arbitrary <span class="token datatype">text</span> <span class="token keyword">string</span> <span class="token keyword">for</span> signature
<span class="token keyword">SET</span> <span class="token variable">@text</span> <span class="token operator">=</span> <span class="token function">repeat</span><span class="token punctuation">(</span><span class="token string">'j'</span><span class="token punctuation">,</span> <span class="token number">256</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
–<span class="token operator">-</span> Digest <span class="token keyword">algorithm</span> <span class="token keyword">to</span> sign the <span class="token keyword">data</span>
<span class="token keyword">SET</span> <span class="token variable">@dig_type</span> <span class="token operator">=</span> <span class="token string">'SHA512'</span><span class="token punctuation">;</span>
<span class="token comment" spellcheck="true">-- Generate signature for digest and verify signature against digest</span>
<span class="token keyword">SET</span> <span class="token variable">@sig</span> <span class="token operator">=</span> <span class="token function">asymmetric_sign</span><span class="token punctuation">(</span><span class="token variable">@algo</span><span class="token punctuation">,</span> <span class="token variable">@text</span><span class="token punctuation">,</span> <span class="token variable">@priv</span><span class="token punctuation">,</span> <span class="token variable">@dig_type</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment" spellcheck="true">-- Verify signature against digest</span>
<span class="token keyword">SET</span> <span class="token variable">@verf</span> <span class="token operator">=</span> <span class="token function">asymmetric_verify</span><span class="token punctuation">(</span><span class="token variable">@algo</span><span class="token punctuation">,</span> <span class="token variable">@text</span><span class="token punctuation">,</span> <span class="token variable">@sig</span><span class="token punctuation">,</span> <span class="token variable">@pub</span><span class="token punctuation">,</span> <span class="token variable">@dig_type</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/group-replication-communication-protocol.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="group-replication-communication-protocol">
</a>
20.5.1.4 Setting a Group's Communication Protocol Version
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045133510496">
</a>
<p>
Group Replication in MySQL 8.4 uses the concept of
a group communication protocol whose version can be managed
explicitly, and set to accommodate the oldest MySQL Server
version that you want the group to support. This enables groups
to be formed from members using different MySQL Server versions
while ensuring backward compatibility.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
MySQL 5.7.14 and later allows compression of messages (see
<a class="xref" href="group-replication-message-compression.html" title="20.7.4 Message Compression">
Section 20.7.4, “Message Compression”
</a>
).
</p>
</li>
<li class="listitem">
<p>
MySQL 8.0.16 and later also allows fragmentation of messages
(see
<a class="xref" href="group-replication-performance-message-fragmentation.html" title="20.7.5 Message Fragmentation">
Section 20.7.5, “Message Fragmentation”
</a>
).
</p>
</li>
<li class="listitem">
<p>
MySQL 8.0.27 and later also allow the group communication
engine to operate with a single consensus leader when the
group is in single-primary mode and
<a class="link" href="group-replication-system-variables.html#sysvar_group_replication_paxos_single_leader">
<code class="literal">
group_replication_paxos_single_leader
</code>
</a>
is set to true (see
<a class="xref" href="group-replication-single-consensus-leader.html" title="20.7.3 Single Consensus Leader">
Section 20.7.3, “Single Consensus Leader”
</a>
).
</p>
</li>
</ul>
</div>
<p>
All members of the group must use the same communication
protocol version, so that group members can be at different
MySQL Server releases but only send messages that can be
understood by all group members.
</p>
<p>
A MySQL server at version X can only join and reach
<code class="literal">
ONLINE
</code>
status in a replication group if the
group's communication protocol version is less than or
equal to X. When a new member joins a replication group, it
checks the communication protocol version that is announced by
the existing members of the group. If the joining member
supports that version, it joins the group and uses the
communication protocol that the group has announced, even if the
member supports additional communication capabilities. If the
joining member does not support the communication protocol
version, it is expelled from the group.
</p>
<p>
If two members attempt to join in the same membership change
event, they can only join if the communication protocol version
for both members is already compatible with the group's
communication protocol version. Members with different
communication protocol versions from the group must join in
isolation. For example:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
One MySQL Server 8.0.16 instance can successfully join a
group that uses the communication protocol version 5.7.24.
</p>
</li>
<li class="listitem">
<p>
One MySQL Server 5.7.24 instance cannot successfully join a
group that uses the communication protocol version 8.0.16.
</p>
</li>
<li class="listitem">
<p>
Two MySQL Server 8.0.16 instances cannot simultaneously join
a group that uses the communication protocol version 5.7.24.
</p>
</li>
<li class="listitem">
<p>
Two MySQL Server 8.0.16 instances can simultaneously join a
group that uses the communication protocol version 8.0.16.
</p>
</li>
</ul>
</div>
<p>
You can inspect the communication protocol in use by a group by
using the
<a class="link" href="group-replication-functions-for-communication-protocol.html#function_group-replication-get-communication-protocol">
<code class="literal">
group_replication_get_communication_protocol()
</code>
</a>
function, which returns the oldest MySQL Server version that the
group supports. All existing members of the group return the
same communication protocol version. For example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa79507320"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SELECT</span> group_replication_get_communication_protocol<span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> group_replication_get_communication_protocol() <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 8.0.16 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
<p>
Note that the
<a class="link" href="group-replication-functions-for-communication-protocol.html#function_group-replication-get-communication-protocol">
<code class="literal">
group_replication_get_communication_protocol()
</code>
</a>
function returns the minimum MySQL version that the group
supports, which might differ from the version number that was
passed to the
<a class="link" href="group-replication-functions-for-communication-protocol.html#function_group-replication-set-communication-protocol">
<code class="literal">
group_replication_set_communication_protocol()
</code>
</a>
function, and from the MySQL Server version that is installed on
the member where you use the function.
</p>
<p>
If you need to change the communication protocol version of a
group so that members at earlier releases can join, use the
<a class="link" href="group-replication-functions-for-communication-protocol.html#function_group-replication-set-communication-protocol">
<code class="literal">
group_replication_set_communication_protocol()
</code>
</a>
function to specify the MySQL Server version of the oldest
member that you want to allow. This makes the group fall back to
a compatible communication protocol version if possible. The
<a class="link" href="privileges-provided.html#priv_group-replication-admin">
<code class="literal">
GROUP_REPLICATION_ADMIN
</code>
</a>
privilege
is required to use this function, and all existing group members
must be online when you issue the statement, with no loss of
majority. For example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa9513984"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SELECT</span> group_replication_set_communication_protocol<span class="token punctuation">(</span><span class="token string">"5.7.25"</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
If you upgrade all the members of a replication group to a new
MySQL Server release, the group's communication protocol version
is not automatically upgraded to match. If you no longer need to
support members at earlier releases, you can use the
<a class="link" href="group-replication-functions-for-communication-protocol.html#function_group-replication-set-communication-protocol">
<code class="literal">
group_replication_set_communication_protocol()
</code>
</a>
function to set the communication protocol version to the new
MySQL Server version to which you have upgraded the members. For
example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa50197999"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SELECT</span> group_replication_set_communication_protocol<span class="token punctuation">(</span><span class="token string">"8.0.16"</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
The
<a class="link" href="group-replication-functions-for-communication-protocol.html#function_group-replication-set-communication-protocol">
<code class="literal">
group_replication_set_communication_protocol()
</code>
</a>
function is implemented as a group action, so it is executed at
the same time on all members of the group. The group action
starts buffering messages and waits for delivery of any outgoing
messages that were already in progress to complete, then changes
the communication protocol version and sends the buffered
messages. If a member attempts to join the group at any time
after you change the communication protocol version, the group
members announce the new protocol version.
</p>
<p>
MySQL InnoDB cluster automatically and transparently manages the
communication protocol versions of its members, whenever the
cluster topology is changed using AdminAPI operations. An InnoDB
cluster always uses the most recent communication protocol
version that is supported by all the instances that are
currently part of the cluster or joining it. For details, see
<a class="ulink" href="/doc/mysql-shell/8.4/en/monitoring-innodb-cluster.html#innodb-cluster-group-replication-protocol" target="_top">
InnoDB Cluster and Group Replication Protocol
</a>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/merge-table-advantages.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="merge-table-advantages">
</a>
18.7.1 MERGE Table Advantages and Disadvantages
</h3>
</div>
</div>
</div>
<p>
<code class="literal">
MERGE
</code>
tables can help you solve the following
problems:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Easily manage a set of log tables. For example, you can put
data from different months into separate tables, compress some
of them with
<a class="link" href="myisampack.html" title="6.6.6 myisampack — Generate Compressed, Read-Only MyISAM Tables">
<span class="command">
<strong>
myisampack
</strong>
</span>
</a>
, and then create a
<code class="literal">
MERGE
</code>
table to use them as one.
</p>
</li>
<li class="listitem">
<p>
Obtain more speed. You can split a large read-only table based
on some criteria, and then put individual tables on different
disks. A
<code class="literal">
MERGE
</code>
table structured this way
could be much faster than using a single large table.
</p>
</li>
<li class="listitem">
<p>
Perform more efficient searches. If you know exactly what you
are looking for, you can search in just one of the underlying
tables for some queries and use a
<code class="literal">
MERGE
</code>
table for others. You can even have many different
<code class="literal">
MERGE
</code>
tables that use overlapping sets of
tables.
</p>
</li>
<li class="listitem">
<p>
Perform more efficient repairs. It is easier to repair
individual smaller tables that are mapped to a
<code class="literal">
MERGE
</code>
table than to repair a single large
table.
</p>
</li>
<li class="listitem">
<p>
Instantly map many tables as one. A
<code class="literal">
MERGE
</code>
table need not maintain an index of its own because it uses
the indexes of the individual tables. As a result,
<code class="literal">
MERGE
</code>
table collections are
<span class="emphasis">
<em>
very
</em>
</span>
fast to create or remap. (You must
still specify the index definitions when you create a
<code class="literal">
MERGE
</code>
table, even though no indexes are
created.)
</p>
</li>
<li class="listitem">
<p>
If you have a set of tables from which you create a large
table on demand, you can instead create a
<code class="literal">
MERGE
</code>
table from them on demand. This is
much faster and saves a lot of disk space.
</p>
</li>
<li class="listitem">
<p>
Exceed the file size limit for the operating system. Each
<code class="literal">
MyISAM
</code>
table is bound by this limit, but a
collection of
<code class="literal">
MyISAM
</code>
tables is not.
</p>
</li>
<li class="listitem">
<p>
You can create an alias or synonym for a
<code class="literal">
MyISAM
</code>
table by defining a
<code class="literal">
MERGE
</code>
table that maps to that single table.
There should be no really notable performance impact from
doing this (only a couple of indirect calls and
<code class="literal">
memcpy()
</code>
calls for each read).
</p>
</li>
</ul>
</div>
<p>
The disadvantages of
<code class="literal">
MERGE
</code>
tables are:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
You can use only identical
<code class="literal">
MyISAM
</code>
tables
for a
<code class="literal">
MERGE
</code>
table.
</p>
</li>
<li class="listitem">
<p>
Some
<code class="literal">
MyISAM
</code>
features are unavailable in
<code class="literal">
MERGE
</code>
tables. For example, you cannot
create
<code class="literal">
FULLTEXT
</code>
indexes on
<code class="literal">
MERGE
</code>
tables. (You can create
<code class="literal">
FULLTEXT
</code>
indexes on the underlying
<code class="literal">
MyISAM
</code>
tables, but you cannot search the
<code class="literal">
MERGE
</code>
table with a full-text search.)
</p>
</li>
<li class="listitem">
<p>
If the
<code class="literal">
MERGE
</code>
table is nontemporary, all
underlying
<code class="literal">
MyISAM
</code>
tables must be
nontemporary. If the
<code class="literal">
MERGE
</code>
table is
temporary, the
<code class="literal">
MyISAM
</code>
tables can be any mix
of temporary and nontemporary.
</p>
</li>
<li class="listitem">
<p>
<a class="indexterm" name="idm46045147331840">
</a>
<code class="literal">
MERGE
</code>
tables use more file descriptors than
<code class="literal">
MyISAM
</code>
tables. If 10 clients are using a
<code class="literal">
MERGE
</code>
table that maps to 10 tables, the
server uses (10 × 10) + 10 file descriptors. (10 data
file descriptors for each of the 10 clients, and 10 index file
descriptors shared among the clients.)
</p>
</li>
<li class="listitem">
<p>
Index reads are slower. When you read an index, the
<code class="literal">
MERGE
</code>
storage engine needs to issue a read
on all underlying tables to check which one most closely
matches a given index value. To read the next index value, the
<code class="literal">
MERGE
</code>
storage engine needs to search the
read buffers to find the next value. Only when one index
buffer is used up does the storage engine need to read the
next index block. This makes
<code class="literal">
MERGE
</code>
indexes
much slower on
<a class="link" href="explain-output.html#jointype_eq_ref">
<code class="literal">
eq_ref
</code>
</a>
searches, but not much slower on
<a class="link" href="explain-output.html#jointype_ref">
<code class="literal">
ref
</code>
</a>
searches. For more
information about
<a class="link" href="explain-output.html#jointype_eq_ref">
<code class="literal">
eq_ref
</code>
</a>
and
<a class="link" href="explain-output.html#jointype_ref">
<code class="literal">
ref
</code>
</a>
, see
<a class="xref" href="explain.html" title="15.8.2 EXPLAIN Statement">
Section 15.8.2, “EXPLAIN Statement”
</a>
.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/optimizer-trace-system-variable.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="optimizer-trace-system-variable">
</a>
10.15.8 The optimizer_trace System Variable
</h3>
</div>
</div>
</div>
<p>
The optimizer_trace system variable has these on/off switches:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
enabled
</code>
: Enables (
<code class="literal">
ON
</code>
) or
disables (
<code class="literal">
OFF
</code>
) tracing
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
one_line
</code>
: If set to
<code class="literal">
ON
</code>
,
the trace contains no whitespace, thus conserving space. This
renders the trace difficult to read for humans, still usable
by JSON parsers, since they ignore whitespace.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/truncate-table.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="truncate-table">
</a>
15.1.37 TRUNCATE TABLE Statement
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045183132608">
</a>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa85013474"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">TRUNCATE</span> <span class="token punctuation">[</span><span class="token keyword">TABLE</span><span class="token punctuation">]</span> <em class="replaceable">tbl_name</em></code></pre>
</div>
<p>
<a class="link" href="truncate-table.html" title="15.1.37 TRUNCATE TABLE Statement">
<code class="literal">
TRUNCATE TABLE
</code>
</a>
empties a table
completely. It requires the
<a class="link" href="privileges-provided.html#priv_drop">
<code class="literal">
DROP
</code>
</a>
privilege. Logically,
<a class="link" href="truncate-table.html" title="15.1.37 TRUNCATE TABLE Statement">
<code class="literal">
TRUNCATE
TABLE
</code>
</a>
is similar to a
<a class="link" href="delete.html" title="15.2.2 DELETE Statement">
<code class="literal">
DELETE
</code>
</a>
statement that deletes all
rows, or a sequence of
<a class="link" href="drop-table.html" title="15.1.32 DROP TABLE Statement">
<code class="literal">
DROP TABLE
</code>
</a>
and
<a class="link" href="create-table.html" title="15.1.20 CREATE TABLE Statement">
<code class="literal">
CREATE TABLE
</code>
</a>
statements.
</p>
<p>
To achieve high performance,
<a class="link" href="truncate-table.html" title="15.1.37 TRUNCATE TABLE Statement">
<code class="literal">
TRUNCATE
TABLE
</code>
</a>
bypasses the DML method of deleting data. Thus, it
does not cause
<code class="literal">
ON DELETE
</code>
triggers to fire, it
cannot be performed for
<code class="literal">
InnoDB
</code>
tables with
parent-child foreign key relationships, and it cannot be rolled
back like a DML operation. However,
<code class="literal">
TRUNCATE
TABLE
</code>
operations on tables that use a storage engine
which supports atomic DDL are either fully committed or rolled
back if the server halts during their operation. For more
information, see
<a class="xref" href="atomic-ddl.html" title="15.1.1 Atomic Data Definition Statement Support">
Section 15.1.1, “Atomic Data Definition Statement Support”
</a>
.
</p>
<p>
Although
<a class="link" href="truncate-table.html" title="15.1.37 TRUNCATE TABLE Statement">
<code class="literal">
TRUNCATE TABLE
</code>
</a>
is similar
to
<a class="link" href="delete.html" title="15.2.2 DELETE Statement">
<code class="literal">
DELETE
</code>
</a>
, it is classified as a
DDL statement rather than a DML statement. It differs from
<a class="link" href="delete.html" title="15.2.2 DELETE Statement">
<code class="literal">
DELETE
</code>
</a>
in the following ways:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Truncate operations drop and re-create the table, which is
much faster than deleting rows one by one, particularly for
large tables.
</p>
</li>
<li class="listitem">
<p>
Truncate operations cause an implicit commit, and so cannot be
rolled back. See
<a class="xref" href="implicit-commit.html" title="15.3.3 Statements That Cause an Implicit Commit">
Section 15.3.3, “Statements That Cause an Implicit Commit”
</a>
.
</p>
</li>
<li class="listitem">
<p>
Truncation operations cannot be performed if the session holds
an active table lock.
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="truncate-table.html" title="15.1.37 TRUNCATE TABLE Statement">
<code class="literal">
TRUNCATE TABLE
</code>
</a>
fails for an
<code class="literal">
InnoDB
</code>
table or
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
table if there are any
<code class="literal">
FOREIGN KEY
</code>
constraints from other tables
that reference the table. Foreign key constraints between
columns of the same table are permitted.
</p>
</li>
<li class="listitem">
<p>
Truncation operations do not return a meaningful value for the
number of deleted rows. The usual result is
<span class="quote">
“
<span class="quote">
0 rows
affected,
</span>
”
</span>
which should be interpreted as
<span class="quote">
“
<span class="quote">
no
information.
</span>
”
</span>
</p>
</li>
<li class="listitem">
<p>
As long as the table definition is valid, the table can be
re-created as an empty table with
<a class="link" href="truncate-table.html" title="15.1.37 TRUNCATE TABLE Statement">
<code class="literal">
TRUNCATE TABLE
</code>
</a>
, even if the
data or index files have become corrupted.
</p>
</li>
<li class="listitem">
<p>
Any
<code class="literal">
AUTO_INCREMENT
</code>
value is reset to its
start value. This is true even for
<code class="literal">
MyISAM
</code>
and
<code class="literal">
InnoDB
</code>
, which normally do not reuse
sequence values.
</p>
</li>
<li class="listitem">
<p>
When used with partitioned tables,
<a class="link" href="truncate-table.html" title="15.1.37 TRUNCATE TABLE Statement">
<code class="literal">
TRUNCATE TABLE
</code>
</a>
preserves the
partitioning; that is, the data and index files are dropped
and re-created, while the partition definitions are
unaffected.
</p>
</li>
<li class="listitem">
<p>
The
<a class="link" href="truncate-table.html" title="15.1.37 TRUNCATE TABLE Statement">
<code class="literal">
TRUNCATE TABLE
</code>
</a>
statement
does not invoke
<code class="literal">
ON DELETE
</code>
triggers.
</p>
</li>
<li class="listitem">
<p>
Truncating a corrupted
<code class="literal">
InnoDB
</code>
table is
supported.
</p>
</li>
</ul>
</div>
<p>
<a class="link" href="truncate-table.html" title="15.1.37 TRUNCATE TABLE Statement">
<code class="literal">
TRUNCATE TABLE
</code>
</a>
is treated for
purposes of binary logging and replication as DDL rather than DML,
and is always logged as a statement.
</p>
<p>
<a class="link" href="truncate-table.html" title="15.1.37 TRUNCATE TABLE Statement">
<code class="literal">
TRUNCATE TABLE
</code>
</a>
for a table closes
all handlers for the table that were opened with
<a class="link" href="handler.html" title="15.2.5 HANDLER Statement">
<code class="literal">
HANDLER OPEN
</code>
</a>
.
</p>
<p>
<a class="link" href="truncate-table.html" title="15.1.37 TRUNCATE TABLE Statement">
<code class="literal">
TRUNCATE TABLE
</code>
</a>
can be used with
Performance Schema summary tables, but the effect is to reset the
summary columns to 0 or
<code class="literal">
NULL
</code>
, not to remove
rows. See
<a class="xref" href="performance-schema-summary-tables.html" title="29.12.20 Performance Schema Summary Tables">
Section 29.12.20, “Performance Schema Summary Tables”
</a>
.
</p>
<p>
Truncating an
<code class="literal">
InnoDB
</code>
table that resides in a
file-per-table tablespace drops the existing tablespace and
creates a new one. If the tablespace was created with an earlier
version and resides in an unknown directory,
<code class="literal">
InnoDB
</code>
creates the new tablespace in the
default location and writes the following warning to the error
log:
<span class="errortext">
The DATA DIRECTORY location must be in a known
directory. The DATA DIRECTORY location will be ignored and the
file will be put into the default datadir location
</span>
.
Known directories are those defined by the
<a class="link" href="server-system-variables.html#sysvar_datadir">
<code class="literal">
datadir
</code>
</a>
,
<a class="link" href="innodb-parameters.html#sysvar_innodb_data_home_dir">
<code class="literal">
innodb_data_home_dir
</code>
</a>
, and
<a class="link" href="innodb-parameters.html#sysvar_innodb_directories">
<code class="literal">
innodb_directories
</code>
</a>
variables. To
have
<a class="link" href="truncate-table.html" title="15.1.37 TRUNCATE TABLE Statement">
<code class="literal">
TRUNCATE TABLE
</code>
</a>
create the
tablespace in its current location, add the directory to the
<a class="link" href="innodb-parameters.html#sysvar_innodb_directories">
<code class="literal">
innodb_directories
</code>
</a>
setting before
running
<a class="link" href="truncate-table.html" title="15.1.37 TRUNCATE TABLE Statement">
<code class="literal">
TRUNCATE TABLE
</code>
</a>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/innodb-indexes.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="innodb-indexes">
</a>
17.6.2 Indexes
</h3>
</div>
</div>
</div>
<div class="toc">
<dl class="toc">
<dt>
<span class="section">
<a href="innodb-index-types.html">
17.6.2.1 Clustered and Secondary Indexes
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-physical-structure.html">
17.6.2.2 The Physical Structure of an InnoDB Index
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="sorted-index-builds.html">
17.6.2.3 Sorted Index Builds
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-fulltext-index.html">
17.6.2.4 InnoDB Full-Text Indexes
</a>
</span>
</dt>
</dl>
</div>
<p>
This section covers topics related to
<code class="literal">
InnoDB
</code>
indexes.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/linux-installation-sles-repo.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="linux-installation-sles-repo">
</a>
2.5.3 Using the MySQL SLES Repository
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045330980560">
</a>
<p>
The MySQL SLES repository provides RPM packages for installing and
managing the MySQL server, client, and other components on SUSE
Enterprise Linux Server. This section contains information on
obtaining and installing these packages.
</p>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="linux-installation-sles-repo-setup">
</a>
Adding the MySQL SLES Repository
</h4>
</div>
</div>
</div>
<p>
Add or update the official MySQL SLES repository for your system's
repository list:
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
The beginning part of the configuration file name, such as
<code class="literal">
mysql84
</code>
, describes
the default MySQL series that is enabled for installation. In
this case, the subrepository for MySQL 8.4 LTS
is enabled by default. It also contains other subrepository
versions, such as MySQL 8.0 and the MySQL
Innovation Series.
</p>
</div>
<h5>
<a name="idm46045330974528">
</a>
New MySQL Repository Installation
</h5>
<p>
If the MySQL repository is not yet present on the system then:
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
Go to the download page for MySQL SLES repository at
<a class="ulink" href="https://dev.mysql.com/downloads/repo/suse/" target="_top">
https://dev.mysql.com/downloads/repo/suse/
</a>
.
</p>
</li>
<li class="listitem">
<p>
Select and download the release package for your SLES version.
</p>
</li>
<li class="listitem">
<p>
Install the downloaded release package with the following
command, replacing
<em class="replaceable">
<code>
package-name
</code>
</em>
with the name of the downloaded package:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa22509215"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">sudo</span> rpm <span class="token property">-Uvh</span> <em class="replaceable">package-name</em><span class="token punctuation">.</span>rpm</code></pre>
</div>
<p>
</p>
<p>
For example, to install the SLES 15 package where
<em class="replaceable">
<code>
#
</code>
</em>
indicates the release number
within a version such as
<code class="literal">
15-1
</code>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa76802564"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">sudo</span> rpm <span class="token property">-Uvh</span> mysql84-community-release-sl15-<span class="token comment" spellcheck="true"><em class="replaceable">#</em>.noarch.rpm</span></code></pre>
</div>
</li>
</ol>
</div>
<h5>
<a name="idm46045330962880">
</a>
Update an Existing MySQL Repository Installation
</h5>
<p>
If an older version is already present then update it:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa65276604"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">sudo</span> zypper update mysql84-community-release</code></pre>
</div>
</li>
<li class="listitem">
<p>
Although this is not required for each MySQL release, it does
update MySQL repository information to include the current
information. For example,
<code class="filename">
mysql84-community-release-sl15-
<em class="replaceable">
<code>
7
</code>
</em>
.noarch.rpm
</code>
is the first SUSE 15 repository configuration file that adds
the innovation release track that begins with MySQL 8.1.
series.
</p>
</li>
</ul>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="linux-installation-sles-repo-select-series">
</a>
Selecting a Release Series
</h4>
</div>
</div>
</div>
<p>
Within the MySQL SLES repository, different release series of the
MySQL Community Server are hosted in different subrepositories.
The subrepository for the latest bugfix series (currently MySQL
8.4) is enabled by default, and the
subrepositories for all other series are disabled. Use this
command to see all of the subrepositories in the MySQL SLES
repository, and to see which of them are enabled or disabled:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa21149437"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">zypper</span> repos | grep mysql<span class="token punctuation">.</span>*community</code></pre>
</div>
<p>
The innovation track is available for SLES 15 with entries such as
<code class="literal">
mysql-innovation-community
</code>
.
</p>
<p>
To install the latest release from a specific series, before
running the installation command, make sure that the subrepository
for the series you want is enabled and the subrepositories for
other series are disabled. For example, on SLES 15, to disable the
subrepositories for MySQL 8.4 server and tools,
which are enabled by default, use the following:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa66538456"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">sudo</span> zypper modifyrepo <span class="token property">-d</span> mysql-8<span class="token punctuation">.</span>4-lts-community
<span class="token prompt">$> </span><span class="token command">sudo</span> zypper modifyrepo <span class="token property">-d</span> mysql-tools-community</code></pre>
</div>
<p>
</p>
<p>
Then, enable the subrepositories for the release series you want.
For example, to enable the Innovation track on SLES 15:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa2699645"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">sudo</span> zypper modifyrepo <span class="token property">-e</span> mysql-innovation-community
<span class="token prompt">$> </span><span class="token command">sudo</span> zypper modifyrepo <span class="token property">-e</span> mysql-tools-innovation-community</code></pre>
</div>
<p>
</p>
<p>
You should only enable a subrepository for one release series at
any time.
</p>
<p>
Verify that the correct subrepositories have been enabled by
running the following command and checking its output:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa77494007"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">zypper</span> repos <span class="token property">-E</span> | grep mysql<span class="token punctuation">.</span>*community
7 | mysql-connectors-community | MySQL Connectors Community | Yes | <span class="token punctuation">(</span>r <span class="token punctuation">)</span> Yes | No
10 | mysql-innovation-community | MySQL Innovation Release Community Server | Yes | <span class="token punctuation">(</span>r <span class="token punctuation">)</span> Yes | No
16 | mysql-tools-innovation-community | MySQL Tools Innovation Community | Yes | <span class="token punctuation">(</span> p<span class="token punctuation">)</span> Yes | No</code></pre>
</div>
<p>
</p>
<p>
After that, use the following command to refresh the repository
information for the enabled subrepository:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa5811415"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">sudo</span> zypper refresh</code></pre>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="linux-installation-sles-repo-install-zypper">
</a>
Installing MySQL with Zypper
</h4>
</div>
</div>
</div>
<p>
With the official MySQL repository enabled, install MySQL Server:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa77726926"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">sudo</span> zypper install mysql-community-server</code></pre>
</div>
<p>
This installs the package for the MySQL server, as well as other
required packages.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="linux-installation-sles-repo-start">
</a>
Starting the MySQL Server
</h4>
</div>
</div>
</div>
<p>
Start the MySQL server with the following command:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa95925525"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">systemctl</span> start mysql</code></pre>
</div>
<p>
You can check the status of the MySQL server with the following
command:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa34070568"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">systemctl</span> status mysql</code></pre>
</div>
<p>
If the operating system is systemd enabled, standard
<span class="command">
<strong>
systemctl
</strong>
</span>
(or alternatively,
<span class="command">
<strong>
service
</strong>
</span>
with the arguments reversed) commands
such as
<span class="command">
<strong>
stop
</strong>
</span>
,
<span class="command">
<strong>
start
</strong>
</span>
,
<span class="command">
<strong>
status
</strong>
</span>
, and
<a class="link" href="restart.html" title="15.7.8.8 RESTART Statement">
<span class="command">
<strong>
restart
</strong>
</span>
</a>
should
be used to manage the MySQL server service. The
<code class="literal">
mysql
</code>
service is enabled by default, and it
starts at system reboot. See
<a class="xref" href="using-systemd.html" title="2.5.9 Managing MySQL Server with systemd">
Section 2.5.9, “Managing MySQL Server with systemd”
</a>
for
additional information.
</p>
<p>
<span class="emphasis">
<em>
MySQL Server Initialization:
</em>
</span>
When the server
is started for the first time, the server is initialized, and the
following happens (if the data directory of the server is empty
when the initialization process begins):
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
The SSL certificate and key files are generated in the data
directory.
</p>
</li>
<li class="listitem">
<p>
The
<a class="link" href="validate-password.html" title="8.4.3 The Password Validation Component">
validate_password
plugin
</a>
is installed and enabled.
</p>
</li>
<li class="listitem">
<p>
A superuser account
<code class="literal">
'root'@'localhost'
</code>
is
created. A password for the superuser is set and stored in the
error log file. To reveal it, use the following command:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa71192636"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">sudo</span> grep <span class="token atrule">'temporary password'</span> /var/log/mysql/mysqld<span class="token punctuation">.</span>log</code></pre>
</div>
<p>
Change the root password as soon as possible by logging in
with the generated, temporary password and set a custom
password for the superuser account:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa33371922"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">mysql</span> <span class="token property">-uroot</span> <span class="token property">-p</span></code></pre>
</div>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa38735563"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">ALTER</span> <span class="token keyword">USER</span> <span class="token string">'root'</span>@<span class="token string">'localhost'</span> <span class="token keyword">IDENTIFIED</span> <span class="token keyword">BY</span> <span class="token string">'MyNewPass4!'</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
</ul>
</div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
MySQL's
<a class="link" href="validate-password.html" title="8.4.3 The Password Validation Component">
validate_password
</a>
plugin is installed by default. This will require that passwords
contain at least one uppercase letter, one lowercase letter, one
digit, and one special character, and that the total password
length is at least 8 characters.
</p>
</div>
<p>
You can stop the MySQL Server with the following command:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa30026025"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">sudo</span> systemctl stop mysql</code></pre>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="linux-installation-sles-repo-components">
</a>
Installing Additional MySQL Products and Components
</h4>
</div>
</div>
</div>
<p>
You can install more components of MySQL. List subrepositories in
the MySQL SLES repository with the following command:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa23022760"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">zypper</span> repos | grep mysql<span class="token punctuation">.</span>*community</code></pre>
</div>
<p>
Use the following command to list the packages for the MySQL
components available for a certain subrepository, changing
<em class="replaceable">
<code>
subrepo-name
</code>
</em>
to the name of the
subrepository you are interested in :
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa57059132"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">zypper</span> packages <em class="replaceable">subrepo-name</em></code></pre>
</div>
<p>
Install any packages of your choice with the following command,
replacing
<em class="replaceable">
<code>
package-name
</code>
</em>
with name of the
package (you might need to enable first the subrepository for the
package, using the same method for selecting a subrepository for a
specific release series outlined in
<a class="xref" href="linux-installation-sles-repo.html#linux-installation-sles-repo-select-series" title="Selecting a Release Series">
Selecting a Release Series
</a>
):
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa81002157"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">sudo</span> zypper install <em class="replaceable">package-name</em></code></pre>
</div>
<p>
For example, to install the MySQL benchmark suite from the
subrepository for the release series you have already enabled:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa40070394"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">sudo</span> zypper install mysql-community-bench</code></pre>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="linux-installation-sles-repo-upgrading">
</a>
Upgrading MySQL with the MySQL SLES Repository
</h4>
</div>
</div>
</div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Before performing any update to MySQL, follow carefully the
instructions in
<a class="xref" href="upgrading.html" title="Chapter 3 Upgrading MySQL">
Chapter 3,
<i>
Upgrading MySQL
</i>
</a>
. Among other
instructions discussed there, it is especially important to
back up your database before the update.
</p>
</li>
</ul>
</div>
</div>
<p>
Use the MySQL SLES repository to perform an in-place update (that
is, replacing the old version of the server and then running the
new version using the old data files) for your MySQL installation
by following these steps (they assume you have installed MySQL
with the MySQL SLES repository; if that is not the case, following
the instructions in
<a class="xref" href="linux-installation-sles-repo.html#linux-installation-sles-repo-replacing" title="Replacing MySQL Installed by an RPM from Other Sources">
Replacing MySQL Installed by an RPM from Other Sources
</a>
instead):
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<h5>
<a name="idm46045330889824">
</a>
Selecting a Target Series
</h5>
<p>
During an update operation, by default, the MySQL SLES
repository updates MySQL to the latest version in the
release series you have chosen during installation (see
<a class="xref" href="linux-installation-sles-repo.html#linux-installation-sles-repo-select-series" title="Selecting a Release Series">
Selecting a Release Series
</a>
for details), which means. For example, a bugfix series
installation, such as 8.4, will
<span class="emphasis">
<em>
not
</em>
</span>
update to an innovation series,
such as 9.1. To update to another
release series, you need to first disable the subrepository
for the series that has been selected (by default, or by
yourself) and enable the subrepository for your target
series. To do that, follow the general instructions given in
<a class="xref" href="linux-installation-sles-repo.html#linux-installation-sles-repo-select-series" title="Selecting a Release Series">
Selecting a Release Series
</a>
.
</p>
<p>
As a general rule, to upgrade from one release series to
another, go to the next series rather than skipping a
series.
</p>
<div class="important" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Important
</div>
<p>
In-place downgrading of MySQL is not supported by the
MySQL SLES repository. Follow the instructions in
<a class="xref" href="downgrading.html" title="Chapter 4 Downgrading MySQL">
Chapter 4,
<i>
Downgrading MySQL
</i>
</a>
.
</p>
</div>
</li>
<li class="listitem">
<h5>
<a name="idm46045330883584">
</a>
Upgrading MySQL
</h5>
<p>
Upgrade MySQL and its components by the following command:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa98107235"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">sudo</span> zypper update mysql-community-server</code></pre>
</div>
<p>
Alternatively, you can update MySQL by telling Zypper to
update everything on your system (this might take
considerably more time):
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa31242405"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">sudo</span> zypper update</code></pre>
</div>
<p>
</p>
</li>
</ol>
</div>
<p>
</p>
<p>
You can also update a specific component only. Use the following
command to list all the installed packages from the MySQL SLES
repository:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa37915487"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">zypper</span> packages <span class="token property">-i</span> | grep mysql-<span class="token punctuation">.</span>*community</code></pre>
</div>
<p>
After identifying the package name of the component of your
choice, update the package with the following command, replacing
<em class="replaceable">
<code>
package-name
</code>
</em>
with the name of the
package:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa33586225"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">sudo</span> zypper update <em class="replaceable">package-name</em></code></pre>
</div>
<p>
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="linux-installation-sles-repo-replacing">
</a>
Replacing MySQL Installed by an RPM from Other Sources
</h4>
</div>
</div>
</div>
<p>
RPMs for installing the MySQL Community Server and its components
can be downloaded from MySQL either from the
<a class="ulink" href="https://dev.mysql.com/downloads/" target="_top">
MySQL Developer Zone
</a>
,
from the native software repository of SLES, or from the MySQL
SLES repository. The RPMs from the those sources might be
different, and they might install and configure MySQL in different
ways.
</p>
<p>
If you have installed MySQL with RPMs from the MySQL Developer
Zone or the native software repository of SLES and want to replace
the installation using the RPM from the MySQL SLES repository,
follow these steps:
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
Back up your database to avoid data loss. See
<a class="xref" href="backup-and-recovery.html" title="Chapter 9 Backup and Recovery">
Chapter 9,
<i>
Backup and Recovery
</i>
</a>
on how to do that.
</p>
</li>
<li class="listitem">
<p>
Stop your MySQL Server, if it is running. If the server is
running as a service, you can stop it with the following
command:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa23313619"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">systemctl</span> stop mysql</code></pre>
</div>
<p>
</p>
</li>
<li class="listitem">
<p>
Follow the steps given for
<a class="xref" href="linux-installation-sles-repo.html#linux-installation-sles-repo-setup" title="Adding the MySQL SLES Repository">
Adding the MySQL SLES Repository
</a>
.
</p>
</li>
<li class="listitem">
<p>
Follow the steps given for
<a class="xref" href="linux-installation-sles-repo.html#linux-installation-sles-repo-select-series" title="Selecting a Release Series">
Selecting a Release Series
</a>
.
</p>
</li>
<li class="listitem">
<p>
Follow the steps given for
<a class="xref" href="linux-installation-sles-repo.html#linux-installation-sles-repo-install-zypper" title="Installing MySQL with Zypper">
Installing MySQL with Zypper
</a>
.
You will be asked if you want to replace the old packages
with the new ones; for example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa68289778"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal">Problem<span class="token punctuation">:</span> mysql-community-server-5<span class="token punctuation">.</span>6<span class="token punctuation">.</span>22-2<span class="token punctuation">.</span>sles11<span class="token punctuation">.</span>x86_64 requires mysql<span class="token constant">-community-client</span> = 5<span class="token punctuation">.</span>6<span class="token punctuation">.</span>22-2<span class="token punctuation">.</span>sles11<span class="token punctuation">,</span>
but this requirement cannot be provided uninstallable providers<span class="token punctuation">:</span>
mysql-community-client-5<span class="token punctuation">.</span>6<span class="token punctuation">.</span>22-2<span class="token punctuation">.</span>sles11<span class="token punctuation">.</span>x86_64<span class="token punctuation">[</span>mysql56-community<span class="token punctuation">]</span>
Solution 1<span class="token punctuation">:</span> replacement of mysql-client-5<span class="token punctuation">.</span>5<span class="token punctuation">.</span>31-0<span class="token punctuation">.</span>7<span class="token punctuation">.</span>10<span class="token punctuation">.</span>x86_64 with mysql-community-client-5<span class="token punctuation">.</span>6<span class="token punctuation">.</span>22-2<span class="token punctuation">.</span>sles11<span class="token punctuation">.</span>x86_64
Solution 2<span class="token punctuation">:</span> do not install mysql-community-server-5<span class="token punctuation">.</span>6<span class="token punctuation">.</span>22-2<span class="token punctuation">.</span>sles11<span class="token punctuation">.</span>x86_64
Solution 3<span class="token punctuation">:</span> break mysql-community-server-5<span class="token punctuation">.</span>6<span class="token punctuation">.</span>22-2<span class="token punctuation">.</span>sles11<span class="token punctuation">.</span>x86_64 by ignoring some of its dependencies
Choose from above solutions by number or cancel <span class="token punctuation">[</span>1/2/3/c<span class="token punctuation">]</span> <span class="token punctuation">(</span>c<span class="token punctuation">)</span></code></pre>
</div>
<p>
Choose the
<span class="quote">
“
<span class="quote">
replacement
</span>
”
</span>
option
(
<span class="quote">
“
<span class="quote">
Solution 1
</span>
”
</span>
in the example) to finish your
installation from the MySQL SLES repository.
</p>
</li>
</ol>
</div>
<p>
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="linux-installation-sles-repo-ndb-cluster">
</a>
Installing MySQL NDB Cluster Using the SLES Repository
</h4>
</div>
</div>
</div>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
The following instructions assume that neither the MySQL
Server nor MySQL NDB Cluster has already been installed on
your system; if that is not the case, remove the MySQL Server
or MySQL NDB Cluster, including all its executables,
libraries, configuration files, log files, and data
directories, before you continue. However there is no need to
remove the release package you might have used to enable the
MySQL SLES repository on your system.
</p>
</li>
<li class="listitem">
<p>
The NDB Cluster Auto-Installer package has a dependency on the
<code class="literal">
python2-crypto
</code>
and
<code class="literal">
python-paramiko
</code>
packages. Zypper can take
care of this dependency if the Python repository has been
enabled on your system.
</p>
</li>
</ul>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="linux-installation-sles-repo-ndb">
</a>
Selecting the MySQL NDB Cluster Subrepository
</h4>
</div>
</div>
</div>
<p>
Within the MySQL SLES repository, the MySQL Community Server and
MySQL NDB Cluster are hosted in different subrepositories. By
default, the subrepository for the latest bugfix series of the
MySQL Server is enabled and the subrepository for MySQL NDB
Cluster is disabled. To install NDB Cluster, disable the
subrepository for the MySQL Server and enable the subrepository
for NDB Cluster. For example, disable the subrepository for MySQL
8.4, which is enabled by default, with the
following command:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa50117029"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">sudo</span> zypper modifyrepo <span class="token property">-d</span> mysql-8<span class="token punctuation">.</span>4-lts-community</code></pre>
</div>
<p>
Then, enable the subrepository for MySQL NDB Cluster:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa87628172"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">sudo</span> zypper modifyrepo <span class="token property">-e</span> mysql-cluster-8<span class="token punctuation">.</span>4-community</code></pre>
</div>
<p>
Verify that the correct subrepositories have been enabled by
running the following command and checking its output:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa43410207"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">zypper</span> repos <span class="token property">-E</span> | grep mysql<span class="token punctuation">.</span>*community
10 | mysql-cluster-8<span class="token punctuation">.</span>4-community | MySQL Cluster 8<span class="token punctuation">.</span>4 Community | Yes | No</code></pre>
</div>
<p>
After that, use the following command to refresh the repository
information for the enabled subrepository:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa83839600"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">sudo</span> zypper refresh</code></pre>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="linux-installation-sles-repo-cluster-install">
</a>
Installing MySQL NDB Cluster
</h4>
</div>
</div>
</div>
<p>
For a minimal installation of MySQL NDB Cluster, follow these
steps:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Install the components for SQL nodes:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa96759395"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">sudo</span> zypper install mysql-cluster-community-server</code></pre>
</div>
<p>
After the installation is completed, start and initialize the
SQL node by following the steps given in
<a class="xref" href="linux-installation-sles-repo.html#linux-installation-sles-repo-start" title="Starting the MySQL Server">
Starting the MySQL Server
</a>
.
</p>
<p>
If you choose to initialize the data directory manually using
the
<code class="literal">
mysqld --initialize
</code>
command (see
<a class="xref" href="data-directory-initialization.html" title="2.9.1 Initializing the Data Directory">
Section 2.9.1, “Initializing the Data Directory”
</a>
for details),
a
<code class="literal">
root
</code>
password is going to be generated
and stored in the SQL node's error log; see
<a class="xref" href="linux-installation-sles-repo.html#linux-installation-sles-repo-start" title="Starting the MySQL Server">
Starting the MySQL Server
</a>
for how
to find the password, and for a few things you need to know
about it.
</p>
</li>
</ul>
</div>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Install the executables for management nodes:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa59581825"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">sudo</span> zypper install mysql-cluster-community-management-server</code></pre>
</div>
</li>
<li class="listitem">
<p>
Install the executables for data nodes:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa44551386"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">sudo</span> zypper install mysql-cluster-community-data-node</code></pre>
</div>
</li>
</ul>
</div>
<p>
To install more NDB Cluster components, see
<a class="xref" href="linux-installation-sles-repo.html#linux-installation-sles-repo-components" title="Installing Additional MySQL Products and Components">
Installing Additional MySQL Products and Components
</a>
.
</p>
<p>
See
<a class="xref" href="mysql-cluster-install-configuration.html" title="25.3.3 Initial Configuration of NDB Cluster">
Section 25.3.3, “Initial Configuration of NDB Cluster”
</a>
on how
to configure MySQL NDB Cluster and
<a class="xref" href="mysql-cluster-install-first-start.html" title="25.3.4 Initial Startup of NDB Cluster">
Section 25.3.4, “Initial Startup of NDB Cluster”
</a>
on how to
start it for the first time.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="linux-installation-sles-repo-cluster-components">
</a>
Installing Additional MySQL NDB Cluster Products and Components
</h4>
</div>
</div>
</div>
<p>
You can use Zypper to install individual components and additional
products of MySQL NDB Cluster from the MySQL SLES repository. To do that,
assuming you already have the MySQL SLES repository on your
system's repository list (if not, follow Step 1 and 2 of
<a class="xref" href="linux-installation-sles-repo.html#linux-installation-sles-repo-ndb-cluster" title="Installing MySQL NDB Cluster Using the SLES Repository">
Installing MySQL NDB Cluster Using the SLES Repository
</a>
),
follow the same steps given in
<a class="xref" href="linux-installation-sles-repo.html#linux-installation-sles-repo-cluster-components" title="Installing Additional MySQL NDB Cluster Products and Components">
Installing Additional MySQL NDB Cluster Products and Components
</a>
.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
<span class="emphasis">
<em>
Known issue:
</em>
</span>
Currently, not all
components required for running the MySQL NDB Cluster test suite are
installed automatically when you install the test suite
package (
<code class="literal">
mysql-cluster-community-test
</code>
).
Install the following packages with
<span class="command">
<strong>
zypper
install
</strong>
</span>
before you run the test suite:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
mysql-cluster-community-auto-installer
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
mysql-cluster-community-management-server
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
mysql-cluster-community-data-node
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
mysql-cluster-community-memcached
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
mysql-cluster-community-java
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
mysql-cluster-community-ndbclient-devel
</code>
</p>
</li>
</ul>
</div>
</div>
<p>
</p>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/stored-objects-security.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title">
<a name="stored-objects-security">
</a>
27.6 Stored Object Access Control
</h2>
</div>
</div>
</div>
<a class="indexterm" name="idm46045081663328">
</a>
<a class="indexterm" name="idm46045081661872">
</a>
<a class="indexterm" name="idm46045081660784">
</a>
<a class="indexterm" name="idm46045081659296">
</a>
<a class="indexterm" name="idm46045081657808">
</a>
<a class="indexterm" name="idm46045081656320">
</a>
<a class="indexterm" name="idm46045081655248">
</a>
<a class="indexterm" name="idm46045081653760">
</a>
<p>
Stored programs (procedures, functions, triggers, and events) and
views are defined prior to use and, when referenced, execute
within a security context that determines their privileges. The
privileges applicable to execution of a stored object are
controlled by its
<code class="literal">
DEFINER
</code>
attribute and
<code class="literal">
SQL SECURITY
</code>
characteristic.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="xref" href="stored-objects-security.html#stored-objects-security-definer" title="The DEFINER Attribute">
The DEFINER Attribute
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="stored-objects-security.html#stored-objects-security-sql-security" title="The SQL SECURITY Characteristic">
The SQL SECURITY Characteristic
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="stored-objects-security.html#stored-objects-security-examples" title="Examples">
Examples
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="stored-objects-security.html#stored-objects-security-orphan-objects" title="Orphan Stored Objects">
Orphan Stored Objects
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="stored-objects-security.html#stored-objects-security-guidelines" title="Risk-Minimization Guidelines">
Risk-Minimization Guidelines
</a>
</p>
</li>
</ul>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h3 class="title">
<a name="stored-objects-security-definer">
</a>
The DEFINER Attribute
</h3>
</div>
</div>
</div>
<p>
A stored object definition can include a
<code class="literal">
DEFINER
</code>
attribute that names a MySQL account.
If a definition omits the
<code class="literal">
DEFINER
</code>
attribute,
the default object definer is the user who creates it.
</p>
<p>
The following rules determine which accounts you can specify as
the
<code class="literal">
DEFINER
</code>
attribute for a stored object:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
If you have the
<a class="link" href="privileges-provided.html#priv_set-any-definer">
<code class="literal">
SET_ANY_DEFINER
</code>
</a>
privilege,
you can specify any account as the
<code class="literal">
DEFINER
</code>
attribute. If the account does
not exist, a warning is generated. Additionally, to set a
stored object
<code class="literal">
DEFINER
</code>
attribute to an
account that has the
<a class="link" href="privileges-provided.html#priv_system-user">
<code class="literal">
SYSTEM_USER
</code>
</a>
privilege, you
must have the
<a class="link" href="privileges-provided.html#priv_system-user">
<code class="literal">
SYSTEM_USER
</code>
</a>
privilege.
</p>
</li>
<li class="listitem">
<p>
Otherwise, the only permitted account is your own, specified
either literally or as
<a class="link" href="information-functions.html#function_current-user">
<code class="literal">
CURRENT_USER
</code>
</a>
or
<a class="link" href="information-functions.html#function_current-user">
<code class="literal">
CURRENT_USER()
</code>
</a>
. You cannot
set the definer to any other account.
</p>
</li>
</ul>
</div>
<p>
Creating a stored object with a nonexistent
<code class="literal">
DEFINER
</code>
account creates an orphan object,
which may have negative consequences; see
<a class="xref" href="stored-objects-security.html#stored-objects-security-orphan-objects" title="Orphan Stored Objects">
Orphan Stored Objects
</a>
.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h3 class="title">
<a name="stored-objects-security-sql-security">
</a>
The SQL SECURITY Characteristic
</h3>
</div>
</div>
</div>
<p>
For stored routines (procedures and functions) and views, the
object definition can include an
<code class="literal">
SQL SECURITY
</code>
characteristic with a value of
<code class="literal">
DEFINER
</code>
or
<code class="literal">
INVOKER
</code>
to specify whether the object
executes in definer or invoker context. If the definition omits
the
<code class="literal">
SQL SECURITY
</code>
characteristic, the default
is definer context.
</p>
<p>
Triggers and events have no
<code class="literal">
SQL SECURITY
</code>
characteristic and always execute in definer context. The server
invokes these objects automatically as necessary, so there is no
invoking user.
</p>
<p>
Definer and invoker security contexts differ as follows:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
A stored object that executes in definer security context
executes with the privileges of the account named by its
<code class="literal">
DEFINER
</code>
attribute. These privileges may
be entirely different from those of the invoking user. The
invoker must have appropriate privileges to reference the
object (for example,
<a class="link" href="privileges-provided.html#priv_execute">
<code class="literal">
EXECUTE
</code>
</a>
to call a stored procedure or
<a class="link" href="privileges-provided.html#priv_select">
<code class="literal">
SELECT
</code>
</a>
to select from a
view), but during object execution, the invoker's privileges
are ignored and only the
<code class="literal">
DEFINER
</code>
account
privileges matter. If the
<code class="literal">
DEFINER
</code>
account
has few privileges, the object is correspondingly limited in
the operations it can perform. If the
<code class="literal">
DEFINER
</code>
account is highly privileged
(such as an administrative account), the object can perform
powerful operations
<span class="emphasis">
<em>
no matter who invokes
it.
</em>
</span>
</p>
</li>
<li class="listitem">
<p>
A stored routine or view that executes in invoker security
context can perform only operations for which the invoker
has privileges. The
<code class="literal">
DEFINER
</code>
attribute has
no effect on object execution.
</p>
</li>
</ul>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h3 class="title">
<a name="stored-objects-security-examples">
</a>
Examples
</h3>
</div>
</div>
</div>
<p>
Consider the following stored procedure, which is declared with
<code class="literal">
SQL SECURITY DEFINER
</code>
to execute in definer
security context:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa217678"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CREATE</span> <span class="token keyword">DEFINER</span> <span class="token operator">=</span> <span class="token string">'admin'</span>@<span class="token string">'localhost'</span> <span class="token keyword">PROCEDURE</span> p1<span class="token punctuation">(</span><span class="token punctuation">)</span>
<span class="token keyword">SQL</span> <span class="token keyword">SECURITY</span> <span class="token keyword">DEFINER</span>
<span class="token keyword">BEGIN</span>
<span class="token keyword">UPDATE</span> t1 <span class="token keyword">SET</span> counter <span class="token operator">=</span> counter <span class="token operator">+</span> <span class="token number">1</span><span class="token punctuation">;</span>
<span class="token keyword">END</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Any user who has the
<a class="link" href="privileges-provided.html#priv_execute">
<code class="literal">
EXECUTE
</code>
</a>
privilege for
<code class="literal">
p1
</code>
can invoke it with a
<a class="link" href="call.html" title="15.2.1 CALL Statement">
<code class="literal">
CALL
</code>
</a>
statement. However, when
<code class="literal">
p1
</code>
executes, it does so in definer security
context and thus executes with the privileges of
<code class="literal">
'admin'@'localhost'
</code>
, the account named as its
<code class="literal">
DEFINER
</code>
attribute. This account must have the
<a class="link" href="privileges-provided.html#priv_execute">
<code class="literal">
EXECUTE
</code>
</a>
privilege for
<code class="literal">
p1
</code>
as well as the
<a class="link" href="privileges-provided.html#priv_update">
<code class="literal">
UPDATE
</code>
</a>
privilege for the table
<code class="literal">
t1
</code>
referenced within the object body.
Otherwise, the procedure fails.
</p>
<p>
Now consider this stored procedure, which is identical to
<code class="literal">
p1
</code>
except that its
<code class="literal">
SQL
SECURITY
</code>
characteristic is
<code class="literal">
INVOKER
</code>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa75937940"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CREATE</span> <span class="token keyword">DEFINER</span> <span class="token operator">=</span> <span class="token string">'admin'</span>@<span class="token string">'localhost'</span> <span class="token keyword">PROCEDURE</span> p2<span class="token punctuation">(</span><span class="token punctuation">)</span>
<span class="token keyword">SQL</span> <span class="token keyword">SECURITY</span> <span class="token keyword">INVOKER</span>
<span class="token keyword">BEGIN</span>
<span class="token keyword">UPDATE</span> t1 <span class="token keyword">SET</span> counter <span class="token operator">=</span> counter <span class="token operator">+</span> <span class="token number">1</span><span class="token punctuation">;</span>
<span class="token keyword">END</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Unlike
<code class="literal">
p1
</code>
,
<code class="literal">
p2
</code>
executes in
invoker security context and thus with the privileges of the
invoking user regardless of the
<code class="literal">
DEFINER
</code>
attribute value.
<code class="literal">
p2
</code>
fails if the invoker
lacks the
<a class="link" href="privileges-provided.html#priv_execute">
<code class="literal">
EXECUTE
</code>
</a>
privilege for
<code class="literal">
p2
</code>
or the
<a class="link" href="privileges-provided.html#priv_update">
<code class="literal">
UPDATE
</code>
</a>
privilege for the table
<code class="literal">
t1
</code>
.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h3 class="title">
<a name="stored-objects-security-orphan-objects">
</a>
Orphan Stored Objects
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045081587280">
</a>
<a class="indexterm" name="idm46045081585792">
</a>
<a class="indexterm" name="idm46045081584720">
</a>
<a class="indexterm" name="idm46045081583264">
</a>
<p>
An orphan stored object is one for which its
<code class="literal">
DEFINER
</code>
attribute names a nonexistent
account:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
An orphan stored object can be created by specifying a
nonexistent
<code class="literal">
DEFINER
</code>
account at
object-creation time.
</p>
</li>
<li class="listitem">
<p>
An existing stored object can become orphaned through
execution of a
<a class="link" href="drop-user.html" title="15.7.1.5 DROP USER Statement">
<code class="literal">
DROP USER
</code>
</a>
statement that drops the object
<code class="literal">
DEFINER
</code>
account, or a
<a class="link" href="rename-user.html" title="15.7.1.7 RENAME USER Statement">
<code class="literal">
RENAME USER
</code>
</a>
statement that renames the object
<code class="literal">
DEFINER
</code>
account.
</p>
</li>
</ul>
</div>
<p>
An orphan stored object may be problematic in these ways:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Because the
<code class="literal">
DEFINER
</code>
account does not
exist, the object may not work as expected if it executes in
definer security context:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
For a stored routine, an error occurs at routine
execution time if the
<code class="literal">
SQL SECURITY
</code>
value is
<code class="literal">
DEFINER
</code>
but the definer
account does not exist.
</p>
</li>
<li class="listitem">
<p>
For a trigger, it is not a good idea for trigger
activation to occur until the account actually does
exist. Otherwise, the behavior with respect to privilege
checking is undefined.
</p>
</li>
<li class="listitem">
<p>
For an event, an error occurs at event execution time if
the account does not exist.
</p>
</li>
<li class="listitem">
<p>
For a view, an error occurs when the view is referenced
if the
<code class="literal">
SQL SECURITY
</code>
value is
<code class="literal">
DEFINER
</code>
but the definer account does
not exist.
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
The object may present a security risk if the nonexistent
<code class="literal">
DEFINER
</code>
account is subsequently
re-created for a purpose unrelated to the object. In this
case, the account
<span class="quote">
“
<span class="quote">
adopts
</span>
”
</span>
the object and, with
the appropriate privileges, is able to execute it even if
that is not intended.
</p>
</li>
</ul>
</div>
<p>
The server imposes the following account-management security
checks designed to prevent operations that (perhaps
inadvertently) cause stored objects to become orphaned or that
cause adoption of stored objects that are currently orphaned:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="link" href="drop-user.html" title="15.7.1.5 DROP USER Statement">
<code class="literal">
DROP USER
</code>
</a>
fails with an error
if any account to be dropped is named as the
<code class="literal">
DEFINER
</code>
attribute for any stored object.
(That is, the statement fails if dropping an account would
cause a stored object to become orphaned.)
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="rename-user.html" title="15.7.1.7 RENAME USER Statement">
<code class="literal">
RENAME USER
</code>
</a>
fails with an
error if any account to be renamed is named as the
<code class="literal">
DEFINER
</code>
attribute for any stored object.
(That is, the statement fails if renaming an account would
cause a stored object to become orphaned.)
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="create-user.html" title="15.7.1.3 CREATE USER Statement">
<code class="literal">
CREATE USER
</code>
</a>
fails with an
error if any account to be created is named as the
<code class="literal">
DEFINER
</code>
attribute for any stored object.
(That is, the statement fails if creating an account would
cause the account to adopt a currently orphaned stored
object.)
</p>
</li>
</ul>
</div>
<p>
In certain situations, it may be necessary to deliberately
execute those account-management statements even when they would
otherwise fail. To make this possible, if a user has the
<a class="link" href="privileges-provided.html#priv_allow-nonexistent-definer">
<code class="literal">
ALLOW_NONEXISTENT_DEFINER
</code>
</a>
privilege, that privilege overrides the orphan object security
checks and the statements succeed with a warning rather than
failing with an error.
</p>
<p>
To obtain information about the accounts used as stored object
definers in a MySQL installation, query the
<code class="literal">
INFORMATION_SCHEMA
</code>
.
</p>
<p>
This query identifies which
<code class="literal">
INFORMATION_SCHEMA
</code>
tables describe objects
that have a
<code class="literal">
DEFINER
</code>
attribute:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa57706897"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> TABLE_SCHEMA<span class="token punctuation">,</span> <span class="token keyword">TABLE_NAME</span> <span class="token keyword">FROM</span> INFORMATION_SCHEMA<span class="token punctuation">.</span><span class="token keyword">COLUMNS</span>
<span class="token keyword">WHERE</span> <span class="token keyword">COLUMN_NAME</span> <span class="token operator">=</span> <span class="token string">'DEFINER'</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> TABLE_SCHEMA <span class="token punctuation">|</span> TABLE_NAME <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> information_schema <span class="token punctuation">|</span> EVENTS <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> information_schema <span class="token punctuation">|</span> ROUTINES <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> information_schema <span class="token punctuation">|</span> TRIGGERS <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> information_schema <span class="token punctuation">|</span> VIEWS <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
<p>
The result tells you which tables to query to discover which
stored object
<code class="literal">
DEFINER
</code>
values exist and which
objects have a particular
<code class="literal">
DEFINER
</code>
value:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
To identify which
<code class="literal">
DEFINER
</code>
values exist in
each table, use these queries:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa73446548"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SELECT</span> <span class="token keyword">DISTINCT</span> <span class="token keyword">DEFINER</span> <span class="token keyword">FROM</span> INFORMATION_SCHEMA<span class="token punctuation">.</span><span class="token keyword">EVENTS</span><span class="token punctuation">;</span>
<span class="token keyword">SELECT</span> <span class="token keyword">DISTINCT</span> <span class="token keyword">DEFINER</span> <span class="token keyword">FROM</span> INFORMATION_SCHEMA<span class="token punctuation">.</span>ROUTINES<span class="token punctuation">;</span>
<span class="token keyword">SELECT</span> <span class="token keyword">DISTINCT</span> <span class="token keyword">DEFINER</span> <span class="token keyword">FROM</span> INFORMATION_SCHEMA<span class="token punctuation">.</span><span class="token keyword">TRIGGERS</span><span class="token punctuation">;</span>
<span class="token keyword">SELECT</span> <span class="token keyword">DISTINCT</span> <span class="token keyword">DEFINER</span> <span class="token keyword">FROM</span> INFORMATION_SCHEMA<span class="token punctuation">.</span>VIEWS<span class="token punctuation">;</span></code></pre>
</div>
<p>
The query results are significant for any account displayed
as follows:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
If the account exists, dropping or renaming it causes
stored objects to become orphaned. If you plan to drop
or rename the account, consider first dropping its
associated stored objects or redefining them to have a
different definer.
</p>
</li>
<li class="listitem">
<p>
If the account does not exist, creating it causes it to
adopt currently orphaned stored objects. If you plan to
create the account, consider whether the orphaned
objects should be associated with it. If not, redefine
them to have a different definer.
</p>
</li>
</ul>
</div>
<p>
To redefine an object with a different definer, you can use
<a class="link" href="alter-event.html" title="15.1.3 ALTER EVENT Statement">
<code class="literal">
ALTER EVENT
</code>
</a>
or
<a class="link" href="alter-view.html" title="15.1.11 ALTER VIEW Statement">
<code class="literal">
ALTER VIEW
</code>
</a>
to directly modify
the
<code class="literal">
DEFINER
</code>
account of events and views.
For stored procedures and functions and for triggers, you
must drop the object and re-create it to assign a different
<code class="literal">
DEFINER
</code>
account
</p>
</li>
<li class="listitem">
<p>
To identify which objects have a given
<code class="literal">
DEFINER
</code>
account, use these queries,
substituting the account of interest for
<code class="literal">
<em class="replaceable">
<code>
user_name
</code>
</em>
@
<em class="replaceable">
<code>
host_name
</code>
</em>
</code>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa53359433"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SELECT</span> EVENT_SCHEMA<span class="token punctuation">,</span> EVENT_NAME <span class="token keyword">FROM</span> INFORMATION_SCHEMA<span class="token punctuation">.</span><span class="token keyword">EVENTS</span>
<span class="token keyword">WHERE</span> <span class="token keyword">DEFINER</span> <span class="token operator">=</span> <span class="token string">'<em class="replaceable">user_name</em>@<em class="replaceable">host_name</em>'</span><span class="token punctuation">;</span>
<span class="token keyword">SELECT</span> ROUTINE_SCHEMA<span class="token punctuation">,</span> ROUTINE_NAME<span class="token punctuation">,</span> ROUTINE_TYPE
<span class="token keyword">FROM</span> INFORMATION_SCHEMA<span class="token punctuation">.</span>ROUTINES
<span class="token keyword">WHERE</span> <span class="token keyword">DEFINER</span> <span class="token operator">=</span> <span class="token string">'<em class="replaceable">user_name</em>@<em class="replaceable">host_name</em>'</span><span class="token punctuation">;</span>
<span class="token keyword">SELECT</span> TRIGGER_SCHEMA<span class="token punctuation">,</span> TRIGGER_NAME <span class="token keyword">FROM</span> INFORMATION_SCHEMA<span class="token punctuation">.</span><span class="token keyword">TRIGGERS</span>
<span class="token keyword">WHERE</span> <span class="token keyword">DEFINER</span> <span class="token operator">=</span> <span class="token string">'<em class="replaceable">user_name</em>@<em class="replaceable">host_name</em>'</span><span class="token punctuation">;</span>
<span class="token keyword">SELECT</span> TABLE_SCHEMA<span class="token punctuation">,</span> <span class="token keyword">TABLE_NAME</span> <span class="token keyword">FROM</span> INFORMATION_SCHEMA<span class="token punctuation">.</span>VIEWS
<span class="token keyword">WHERE</span> <span class="token keyword">DEFINER</span> <span class="token operator">=</span> <span class="token string">'<em class="replaceable">user_name</em>@<em class="replaceable">host_name</em>'</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
For the
<a class="link" href="information-schema-routines-table.html" title="28.3.30 The INFORMATION_SCHEMA ROUTINES Table">
<code class="literal">
ROUTINES
</code>
</a>
table, the
query includes the
<code class="literal">
ROUTINE_TYPE
</code>
column so
that output rows distinguish whether the
<code class="literal">
DEFINER
</code>
is for a stored procedure or
stored function.
</p>
<p>
If the account you are searching for does not exist, any
objects displayed by those queries are orphan objects.
</p>
</li>
</ul>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h3 class="title">
<a name="stored-objects-security-guidelines">
</a>
Risk-Minimization Guidelines
</h3>
</div>
</div>
</div>
<p>
To minimize the risk potential for stored object creation and
use, follow these guidelines:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Do not create orphan stored objects; that is, objects for
which the
<code class="literal">
DEFINER
</code>
attribute names a
nonexistent account. Do not cause stored objects to become
orphaned by dropping or renaming an account named by the
<code class="literal">
DEFINER
</code>
attribute of any existing object.
</p>
</li>
<li class="listitem">
<p>
For a stored routine or view, use
<code class="literal">
SQL SECURITY
INVOKER
</code>
in the object definition when possible so
that it can be used only by users with permissions
appropriate for the operations performed by the object.
</p>
</li>
<li class="listitem">
<p>
If you create definer-context stored objects while using an
account that has the
<a class="link" href="privileges-provided.html#priv_set-any-definer">
<code class="literal">
SET_ANY_DEFINER
</code>
</a>
privilege,
specify an explicit
<code class="literal">
DEFINER
</code>
attribute
that names an account possessing only the privileges
required for the operations performed by the object. Specify
a highly privileged
<code class="literal">
DEFINER
</code>
account only
when absolutely necessary.
</p>
</li>
<li class="listitem">
<p>
Administrators can prevent users from creating stored
objects that specify highly privileged
<code class="literal">
DEFINER
</code>
accounts by not granting them the
<a class="link" href="privileges-provided.html#priv_set-any-definer">
<code class="literal">
SET_ANY_DEFINER
</code>
</a>
privilege.
</p>
</li>
<li class="listitem">
<p>
Definer-context objects should be written keeping in mind
that they may be able to access data for which the invoking
user has no privileges. In some cases, you can prevent
references to these objects by not granting unauthorized
users particular privileges:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
A stored routine cannot be referenced by a user who does
not have the
<a class="link" href="privileges-provided.html#priv_execute">
<code class="literal">
EXECUTE
</code>
</a>
privilege for it.
</p>
</li>
<li class="listitem">
<p>
A view cannot be referenced by a user who does not have
the appropriate privilege for it
(
<a class="link" href="privileges-provided.html#priv_select">
<code class="literal">
SELECT
</code>
</a>
to select from
it,
<a class="link" href="privileges-provided.html#priv_insert">
<code class="literal">
INSERT
</code>
</a>
to insert into
it, and so forth).
</p>
</li>
</ul>
</div>
<p>
However, no such control exists for triggers and events
because they always execute in definer context. The server
invokes these objects automatically as necessary, and users
do not reference them directly:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
A trigger is activated by access to the table with which
it is associated, even ordinary table accesses by users
with no special privileges.
</p>
</li>
<li class="listitem">
<p>
An event is executed by the server on a scheduled basis.
</p>
</li>
</ul>
</div>
<p>
In both cases, if the
<code class="literal">
DEFINER
</code>
account is
highly privileged, the object may be able to perform
sensitive or dangerous operations. This remains true if the
privileges needed to create the object are revoked from the
account of the user who created it. Administrators should be
especially careful about granting users object-creation
privileges.
</p>
</li>
<li class="listitem">
<p>
By default, when a routine with the
<code class="literal">
SQL SECURITY
DEFINER
</code>
characteristic is executed, MySQL Server
does not set any active roles for the MySQL account named in
the
<code class="literal">
DEFINER
</code>
clause, only the default
roles. The exception is if the
<a class="link" href="server-system-variables.html#sysvar_activate_all_roles_on_login">
<code class="literal">
activate_all_roles_on_login
</code>
</a>
system variable is enabled, in which case MySQL Server sets
all roles granted to the
<code class="literal">
DEFINER
</code>
user,
including mandatory roles. Any privileges granted through
roles are therefore not checked by default when the
<a class="link" href="create-procedure.html" title="15.1.17 CREATE PROCEDURE and CREATE FUNCTION Statements">
<code class="literal">
CREATE PROCEDURE
</code>
</a>
or
<a class="link" href="create-function.html" title="15.1.14 CREATE FUNCTION Statement">
<code class="literal">
CREATE
FUNCTION
</code>
</a>
statement is issued. For stored programs,
if execution should occur with roles different from the
default, the program body can execute
<a class="link" href="set-role.html" title="15.7.1.11 SET ROLE Statement">
<code class="literal">
SET ROLE
</code>
</a>
to activate the
required roles. This must be done with caution since the
privileges assigned to roles can be changed.
</p>
</li>
</ul>
</div>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/operator-precedence.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="operator-precedence">
</a>
14.4.1 Operator Precedence
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045207581056">
</a>
<a class="indexterm" name="idm46045207579568">
</a>
<p>
Operator precedences are shown in the following list, from
highest precedence to the lowest. Operators that are shown
together on a line have the same precedence.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa87358476"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">INTERVAL</span>
<span class="token datatype">BINARY</span><span class="token punctuation">,</span> <span class="token keyword">COLLATE</span>
<span class="token operator">!</span>
<span class="token operator">-</span> <span class="token punctuation">(</span>unary minus<span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token operator">~</span> <span class="token punctuation">(</span>unary <span class="token datatype">bit</span> inversion<span class="token punctuation">)</span>
<span class="token operator">^</span>
<span class="token operator">*</span><span class="token punctuation">,</span> <span class="token operator">/</span><span class="token punctuation">,</span> <span class="token operator">DIV</span><span class="token punctuation">,</span> <span class="token operator">%</span><span class="token punctuation">,</span> <span class="token operator">MOD</span>
<span class="token operator">-</span><span class="token punctuation">,</span> <span class="token operator">+</span>
<span class="token operator"><<</span><span class="token punctuation">,</span> <span class="token operator">>></span>
<span class="token operator">&</span>
<span class="token operator">|</span>
<span class="token operator">=</span> <span class="token punctuation">(</span>comparison<span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token operator"><=></span><span class="token punctuation">,</span> <span class="token operator">>=</span><span class="token punctuation">,</span> <span class="token operator">></span><span class="token punctuation">,</span> <span class="token operator"><=</span><span class="token punctuation">,</span> <span class="token operator"><</span><span class="token punctuation">,</span> <span class="token operator"><></span><span class="token punctuation">,</span> <span class="token operator">!=</span><span class="token punctuation">,</span> <span class="token operator">IS</span><span class="token punctuation">,</span> <span class="token operator">LIKE</span><span class="token punctuation">,</span> <span class="token operator">REGEXP</span><span class="token punctuation">,</span> <span class="token keyword">IN</span><span class="token punctuation">,</span> MEMBER <span class="token keyword">OF</span>
<span class="token operator">BETWEEN</span><span class="token punctuation">,</span> <span class="token operator">CASE</span><span class="token punctuation">,</span> <span class="token keyword">WHEN</span><span class="token punctuation">,</span> <span class="token keyword">THEN</span><span class="token punctuation">,</span> <span class="token keyword">ELSE</span>
<span class="token operator">NOT</span>
<span class="token operator">AND</span><span class="token punctuation">,</span> <span class="token operator">&&</span>
<span class="token keyword">XOR</span>
<span class="token operator">OR</span><span class="token punctuation">,</span> <span class="token operator">||</span>
<span class="token operator">=</span> <span class="token punctuation">(</span>assignment<span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token operator">:=</span></code></pre>
</div>
<p>
The precedence of
<code class="literal">
=
</code>
depends on whether it is
used as a comparison operator
(
<a class="link" href="comparison-operators.html#operator_equal">
<code class="literal">
=
</code>
</a>
) or as an
assignment operator
(
<a class="link" href="assignment-operators.html#operator_assign-equal">
<code class="literal">
=
</code>
</a>
). When
used as a comparison operator, it has the same precedence as
<a class="link" href="comparison-operators.html#operator_equal-to">
<code class="literal">
<=>
</code>
</a>
,
<a class="link" href="comparison-operators.html#operator_greater-than-or-equal">
<code class="literal">
>=
</code>
</a>
,
<a class="link" href="comparison-operators.html#operator_greater-than">
<code class="literal">
>
</code>
</a>
,
<a class="link" href="comparison-operators.html#operator_less-than-or-equal">
<code class="literal">
<=
</code>
</a>
,
<a class="link" href="comparison-operators.html#operator_less-than">
<code class="literal">
<
</code>
</a>
,
<a class="link" href="comparison-operators.html#operator_not-equal">
<code class="literal">
<>
</code>
</a>
,
<a class="link" href="comparison-operators.html#operator_not-equal">
<code class="literal">
!=
</code>
</a>
,
<a class="link" href="comparison-operators.html#operator_is">
<code class="literal">
IS
</code>
</a>
,
<a class="link" href="string-comparison-functions.html#operator_like">
<code class="literal">
LIKE
</code>
</a>
,
<a class="link" href="regexp.html#operator_regexp">
<code class="literal">
REGEXP
</code>
</a>
, and
<a class="link" href="comparison-operators.html#operator_in">
<code class="literal">
IN()
</code>
</a>
. When used as an assignment
operator, it has the same precedence as
<a class="link" href="assignment-operators.html#operator_assign-value">
<code class="literal">
:=
</code>
</a>
.
<a class="xref" href="set-variable.html" title="15.7.6.1 SET Syntax for Variable Assignment">
Section 15.7.6.1, “SET Syntax for Variable Assignment”
</a>
, and
<a class="xref" href="user-variables.html" title="11.4 User-Defined Variables">
Section 11.4, “User-Defined Variables”
</a>
, explain how MySQL determines
which interpretation of
<code class="literal">
=
</code>
should apply.
</p>
<p>
For operators that occur at the same precedence level within an
expression, evaluation proceeds left to right, with the
exception that assignments evaluate right to left.
</p>
<p>
The precedence and meaning of some operators depends on the SQL
mode:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
By default,
<a class="link" href="logical-operators.html#operator_or">
<code class="literal">
||
</code>
</a>
is a logical
<a class="link" href="logical-operators.html#operator_or">
<code class="literal">
OR
</code>
</a>
operator. With
<a class="link" href="sql-mode.html#sqlmode_pipes_as_concat">
<code class="literal">
PIPES_AS_CONCAT
</code>
</a>
enabled,
<a class="link" href="logical-operators.html#operator_or">
<code class="literal">
||
</code>
</a>
is string
concatenation, with a precedence between
<a class="link" href="bit-functions.html#operator_bitwise-xor">
<code class="literal">
^
</code>
</a>
and
the unary operators.
</p>
</li>
<li class="listitem">
<p>
By default,
<a class="link" href="logical-operators.html#operator_not">
<code class="literal">
!
</code>
</a>
has a higher precedence than
<code class="literal">
NOT
</code>
. With
<a class="link" href="sql-mode.html#sqlmode_high_not_precedence">
<code class="literal">
HIGH_NOT_PRECEDENCE
</code>
</a>
enabled,
<a class="link" href="logical-operators.html#operator_not">
<code class="literal">
!
</code>
</a>
and
<code class="literal">
NOT
</code>
have the same precedence.
</p>
</li>
</ul>
</div>
<p>
See
<a class="xref" href="sql-mode.html" title="7.1.11 Server SQL Modes">
Section 7.1.11, “Server SQL Modes”
</a>
.
</p>
<a class="indexterm" name="idm46045207539168">
</a>
<a class="indexterm" name="idm46045207538096">
</a>
<a class="indexterm" name="idm46045207537024">
</a>
<a class="indexterm" name="idm46045207535536">
</a>
<p>
The precedence of operators determines the order of evaluation
of terms in an expression. To override this order and group
terms explicitly, use parentheses. For example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa11170717"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token number">1</span><span class="token operator">+</span><span class="token number">2</span><span class="token operator">*</span><span class="token number">3</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token number">7</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token punctuation">(</span><span class="token number">1</span><span class="token operator">+</span><span class="token number">2</span><span class="token punctuation">)</span><span class="token operator">*</span><span class="token number">3</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token number">9</span></code></pre>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/group-replication-use-cases.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="group-replication-use-cases">
</a>
20.1.2 Group Replication Use Cases
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045134531760">
</a>
<p>
Group Replication enables you to create fault-tolerant systems
with redundancy by replicating the system state to a set of
servers. Even if some of the servers subsequently fail, as long it
is not all or a majority, the system is still available. Depending
on the number of servers which fail the group might have degraded
performance or scalability, but it is still available. Server
failures are isolated and independent. They are tracked by a group
membership service which relies on a distributed failure detector
that is able to signal when any servers leave the group, either
voluntarily or due to an unexpected halt. There is a distributed
recovery procedure to ensure that when servers join the group they
are brought up to date automatically. There is no need for server
failover, and the multi-source update everywhere nature ensures
that even updates are not blocked in the event of a single server
failure. To summarize, MySQL Group Replication guarantees that the
database service is continuously available.
</p>
<p>
It is important to understand that although the database service
is available, in the event of an unexpected server exit, those
clients connected to it must be redirected, or failed over, to a
different server. This is not something Group Replication attempts
to resolve. A connector, load balancer, router, or some form of
middleware are more suitable to deal with this issue. For example
see
<a class="ulink" href="/doc/mysql-router/8.4/en/" target="_top">
MySQL Router 8.4
</a>
.
</p>
<p>
To summarize, MySQL Group Replication provides a highly available,
highly elastic, dependable MySQL service.
</p>
<div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Tip
</div>
<p>
To deploy multiple instances of MySQL, you can use
<a class="ulink" href="/doc/mysql-shell/8.4/en/mysql-innodb-cluster.html" target="_top">
InnoDB Cluster
</a>
which enables you to easily administer a group of MySQL server instances in
<a class="ulink" href="/doc/mysql-shell/8.4/en/" target="_top">
MySQL Shell
</a>
. InnoDB Cluster wraps MySQL Group Replication in a programmatic environment that enables you easily deploy a cluster of MySQL instances to achieve high availability. In addition, InnoDB Cluster interfaces seamlessly with
<a class="ulink" href="/doc/mysql-router/8.4/en/" target="_top">
MySQL Router
</a>
, which enables your applications to connect to the cluster without writing your own failover process. For similar use cases that do not require high availability, however, you can use
<a class="ulink" href="/doc/mysql-shell/8.4/en/mysql-innodb-replicaset.html" target="_top">
InnoDB ReplicaSet
</a>
. Installation instructions for MySQL Shell can be found
<a class="ulink" href="/doc/mysql-shell/8.4/en/mysql-shell-install.html" target="_top">
here
</a>
.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="group-replication-examples-of-use-case-scenarios">
</a>
Example Use Cases
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045134519136">
</a>
<p>
The following examples are typical use cases for Group
Replication.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<span class="emphasis">
<em>
Elastic Replication
</em>
</span>
- Environments that
require a very fluid replication infrastructure, where the
number of servers has to grow or shrink dynamically and with
as few side-effects as possible. For instance, database
services for the cloud.
</p>
</li>
<li class="listitem">
<p>
<span class="emphasis">
<em>
Highly Available Shards
</em>
</span>
- Sharding is a
popular approach to achieve write scale-out. Use MySQL Group
Replication to implement highly available shards, where each
shard maps to a replication group.
</p>
</li>
<li class="listitem">
<p>
<span class="emphasis">
<em>
Alternative to asynchronous Source-Replica
replication
</em>
</span>
- In certain situations, using a
single source server makes it a single point of contention.
Writing to an entire group may prove more scalable under
certain circumstances.
</p>
</li>
<li class="listitem">
<p>
<span class="emphasis">
<em>
Autonomic Systems
</em>
</span>
- Additionally, you
can deploy MySQL Group Replication purely for the automation
that is built into the replication protocol (described
already in this and previous chapters).
</p>
</li>
</ul>
</div>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/mysqld.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="mysqld">
</a>
6.3.1 mysqld — The MySQL Server
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045322016432">
</a>
<a class="indexterm" name="idm46045322015104">
</a>
<p>
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
, also known as MySQL Server, is a
single multithreaded program that does most of the work in a
MySQL installation. It does not spawn additional processes.
MySQL Server manages access to the MySQL data directory that
contains databases and tables. The data directory is also the
default location for other information such as log files and
status files.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
Some installation packages contain a debugging version of the
server named
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld-debug
</strong>
</span>
</a>
. Invoke this
version instead of
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
for debugging
support, memory allocation checking, and trace file support
(see
<a class="xref" href="making-trace-files.html" title="7.9.1.2 Creating Trace Files">
Section 7.9.1.2, “Creating Trace Files”
</a>
).
</p>
</div>
<p>
When MySQL server starts, it listens for network connections
from client programs and manages access to databases on behalf
of those clients.
</p>
<p>
The
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
program has many options that can
be specified at startup. For a complete list of options, run
this command:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa91456882"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal">mysqld <span class="token property">--verbose</span> <span class="token property">--help</span></code></pre>
</div>
<p>
MySQL Server also has a set of system variables that affect its
operation as it runs. System variables can be set at server
startup, and many of them can be changed at runtime to effect
dynamic server reconfiguration. MySQL Server also has a set of
status variables that provide information about its operation.
You can monitor these status variables to access runtime
performance characteristics.
</p>
<p>
For a full description of MySQL Server command options, system
variables, and status variables, see
<a class="xref" href="mysqld-server.html" title="7.1 The MySQL Server">
Section 7.1, “The MySQL Server”
</a>
. For information about
installing MySQL and setting up the initial configuration, see
<a class="xref" href="installing.html" title="Chapter 2 Installing MySQL">
Chapter 2,
<i>
Installing MySQL
</i>
</a>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/innodb-backup.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="innodb-backup">
</a>
17.18.1 InnoDB Backup
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045149254624">
</a>
<a class="indexterm" name="idm46045149253136">
</a>
<p>
The key to safe database management is making regular backups.
Depending on your data volume, number of MySQL servers, and
database workload, you can use these backup techniques, alone or
in combination:
<a class="link" href="glossary.html#glos_hot_backup" title="hot backup">
hot backup
</a>
with
<span class="emphasis">
<em>
MySQL Enterprise Backup
</em>
</span>
;
<a class="link" href="glossary.html#glos_cold_backup" title="cold backup">
cold backup
</a>
by copying
files while the MySQL server is shut down;
<a class="link" href="glossary.html#glos_logical_backup" title="logical backup">
logical backup
</a>
with
<a class="link" href="mysqldump.html" title="6.5.4 mysqldump — A Database Backup Program">
<span class="command">
<strong>
mysqldump
</strong>
</span>
</a>
for smaller data volumes or to record
the structure of schema objects. Hot and cold backups are
<a class="link" href="glossary.html#glos_physical_backup" title="physical backup">
physical backups
</a>
that
copy actual data files, which can be used directly by the
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
server for faster restore.
</p>
<p>
Using
<span class="emphasis">
<em>
MySQL Enterprise Backup
</em>
</span>
is the recommended method for
backing up
<code class="literal">
InnoDB
</code>
data.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
<code class="literal">
InnoDB
</code>
does not support databases that are
restored using third-party backup tools.
</p>
</div>
<h4>
<a name="idm46045149241264">
</a>
Hot Backups
</h4>
<p>
The
<span class="command">
<strong>
mysqlbackup
</strong>
</span>
command, part of the MySQL Enterprise Backup
component, lets you back up a running MySQL instance, including
<code class="literal">
InnoDB
</code>
tables, with minimal disruption to
operations while producing a consistent snapshot of the database.
When
<span class="command">
<strong>
mysqlbackup
</strong>
</span>
is copying
<code class="literal">
InnoDB
</code>
tables, reads and writes to
<code class="literal">
InnoDB
</code>
tables can continue. MySQL Enterprise Backup can also
create compressed backup files, and back up subsets of tables and
databases. In conjunction with the MySQL binary log, users can
perform point-in-time recovery. MySQL Enterprise Backup is part of the MySQL
Enterprise subscription. For more details, see
<a class="xref" href="mysql-enterprise-backup.html" title="32.1 MySQL Enterprise Backup Overview">
Section 32.1, “MySQL Enterprise Backup Overview”
</a>
.
</p>
<h4>
<a name="idm46045149235344">
</a>
Cold Backups
</h4>
<p>
If you can shut down the MySQL server, you can make a physical
backup that consists of all files used by
<code class="literal">
InnoDB
</code>
to manage its tables. Use the following
procedure:
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
Perform a
<a class="link" href="glossary.html#glos_slow_shutdown" title="slow shutdown">
slow
shutdown
</a>
of the MySQL server and make sure that it
stops without errors.
</p>
</li>
<li class="listitem">
<p>
Copy all
<code class="literal">
InnoDB
</code>
data files
(
<code class="filename">
ibdata
</code>
files and
<code class="filename">
.ibd
</code>
files) into a safe place.
</p>
</li>
<li class="listitem">
<p>
Copy all
<code class="literal">
InnoDB
</code>
redo log files
(
<code class="filename">
#ib_redo
<em class="replaceable">
<code>
N
</code>
</em>
</code>
files) to a safe place.
</p>
</li>
<li class="listitem">
<p>
Copy your
<code class="filename">
my.cnf
</code>
configuration file or
files to a safe place.
</p>
</li>
</ol>
</div>
<h4>
<a name="idm46045149223648">
</a>
Logical Backups Using mysqldump
</h4>
<p>
In addition to physical backups, it is recommended that you
regularly create logical backups by dumping your tables using
<a class="link" href="mysqldump.html" title="6.5.4 mysqldump — A Database Backup Program">
<span class="command">
<strong>
mysqldump
</strong>
</span>
</a>
. A binary file might be corrupted
without you noticing it. Dumped tables are stored into text files
that are human-readable, so spotting table corruption becomes
easier. Also, because the format is simpler, the chance for
serious data corruption is smaller.
<a class="link" href="mysqldump.html" title="6.5.4 mysqldump — A Database Backup Program">
<span class="command">
<strong>
mysqldump
</strong>
</span>
</a>
also has a
<a class="link" href="mysqldump.html#option_mysqldump_single-transaction">
<code class="option">
--single-transaction
</code>
</a>
option for making a consistent snapshot without locking out other
clients. See
<a class="xref" href="backup-policy.html" title="9.3.1 Establishing a Backup Policy">
Section 9.3.1, “Establishing a Backup Policy”
</a>
.
</p>
<p>
Replication works with
<a class="link" href="innodb-storage-engine.html" title="Chapter 17 The InnoDB Storage Engine">
<code class="literal">
InnoDB
</code>
</a>
tables,
so you can use MySQL replication capabilities to keep a copy of
your database at database sites requiring high availability. See
<a class="xref" href="innodb-and-mysql-replication.html" title="17.19 InnoDB and MySQL Replication">
Section 17.19, “InnoDB and MySQL Replication”
</a>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/selecting-columns.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="selecting-columns">
</a>
5.3.4.3 Selecting Particular Columns
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045325234704">
</a>
<a class="indexterm" name="idm46045325233248">
</a>
<p>
If you do not want to see entire rows from your table, just
name the columns in which you are interested, separated by
commas. For example, if you want to know when your animals
were born, select the
<code class="literal">
name
</code>
and
<code class="literal">
birth
</code>
columns:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa56073422"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token keyword">name</span><span class="token punctuation">,</span> birth <span class="token keyword">FROM</span> pet<span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> name <span class="token punctuation">|</span> birth <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> Fluffy <span class="token punctuation">|</span> 1993<span class="token punctuation">-</span>02<span class="token punctuation">-</span>04 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Claws <span class="token punctuation">|</span> 1994<span class="token punctuation">-</span>03<span class="token punctuation">-</span>17 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Buffy <span class="token punctuation">|</span> 1989<span class="token punctuation">-</span>05<span class="token punctuation">-</span>13 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Fang <span class="token punctuation">|</span> 1990<span class="token punctuation">-</span>08<span class="token punctuation">-</span>27 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Bowser <span class="token punctuation">|</span> 1989<span class="token punctuation">-</span>08<span class="token punctuation">-</span>31 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Chirpy <span class="token punctuation">|</span> 1998<span class="token punctuation">-</span>09<span class="token punctuation">-</span>11 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Whistler <span class="token punctuation">|</span> 1997<span class="token punctuation">-</span>12<span class="token punctuation">-</span>09 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Slim <span class="token punctuation">|</span> 1996<span class="token punctuation">-</span>04<span class="token punctuation">-</span>29 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Puffball <span class="token punctuation">|</span> 1999<span class="token punctuation">-</span>03<span class="token punctuation">-</span>30 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
<p>
To find out who owns pets, use this query:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa31180518"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token keyword">owner</span> <span class="token keyword">FROM</span> pet<span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> owner <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> Harold <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Gwen <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Harold <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Benny <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Diane <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Gwen <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Gwen <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Benny <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Diane <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
<a class="indexterm" name="idm46045325225456">
</a>
<p>
Notice that the query simply retrieves the
<code class="literal">
owner
</code>
column from each record, and some of
them appear more than once. To minimize the output, retrieve
each unique output record just once by adding the keyword
<code class="literal">
DISTINCT
</code>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa20087778"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token keyword">DISTINCT</span> <span class="token keyword">owner</span> <span class="token keyword">FROM</span> pet<span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> owner <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> Benny <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Diane <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Gwen <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Harold <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
<p>
You can use a
<code class="literal">
WHERE
</code>
clause to combine row
selection with column selection. For example, to get birth
dates for dogs and cats only, use this query:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa49234284"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token keyword">name</span><span class="token punctuation">,</span> species<span class="token punctuation">,</span> birth <span class="token keyword">FROM</span> pet
<span class="token keyword">WHERE</span> species <span class="token operator">=</span> <span class="token string">'dog'</span> <span class="token operator">OR</span> species <span class="token operator">=</span> <span class="token string">'cat'</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> name <span class="token punctuation">|</span> species <span class="token punctuation">|</span> birth <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> Fluffy <span class="token punctuation">|</span> cat <span class="token punctuation">|</span> 1993<span class="token punctuation">-</span>02<span class="token punctuation">-</span>04 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Claws <span class="token punctuation">|</span> cat <span class="token punctuation">|</span> 1994<span class="token punctuation">-</span>03<span class="token punctuation">-</span>17 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Buffy <span class="token punctuation">|</span> dog <span class="token punctuation">|</span> 1989<span class="token punctuation">-</span>05<span class="token punctuation">-</span>13 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Fang <span class="token punctuation">|</span> dog <span class="token punctuation">|</span> 1990<span class="token punctuation">-</span>08<span class="token punctuation">-</span>27 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Bowser <span class="token punctuation">|</span> dog <span class="token punctuation">|</span> 1989<span class="token punctuation">-</span>08<span class="token punctuation">-</span>31 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/clone.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="clone">
</a>
15.7.5 CLONE Statement
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045171624560">
</a>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa71764669"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CLONE</span> <em class="replaceable">clone_action</em>
<em class="replaceable">clone_action</em>: {
<span class="token keyword">LOCAL</span> <span class="token keyword">DATA</span> <span class="token keyword">DIRECTORY</span> <span class="token punctuation">[</span><span class="token operator">=</span><span class="token punctuation">]</span> <span class="token string">'<em class="replaceable">clone_dir</em>'</span><span class="token punctuation">;</span>
<span class="token operator">|</span> <span class="token keyword">INSTANCE</span> <span class="token keyword">FROM</span> <span class="token string">'<em class="replaceable">user</em>'</span>@<span class="token string">'<em class="replaceable">host</em>'</span>:<span class="token keyword"><em class="replaceable">port</em></span>
<span class="token keyword">IDENTIFIED</span> <span class="token keyword">BY</span> <span class="token string">'<em class="replaceable">password</em>'</span>
<span class="token punctuation">[</span><span class="token keyword">DATA</span> <span class="token keyword">DIRECTORY</span> <span class="token punctuation">[</span><span class="token operator">=</span><span class="token punctuation">]</span> <span class="token string">'<em class="replaceable">clone_dir</em>'</span><span class="token punctuation">]</span>
<span class="token punctuation">[</span><span class="token keyword">REQUIRE</span> <span class="token punctuation">[</span><span class="token keyword">NO</span><span class="token punctuation">]</span> <span class="token keyword">SSL</span><span class="token punctuation">]</span>
}</code></pre>
</div>
<p>
The
<a class="link" href="clone.html" title="15.7.5 CLONE Statement">
<code class="literal">
CLONE
</code>
</a>
statement is used to
clone data locally or from a remote MySQL server instance. To use
<a class="link" href="clone.html" title="15.7.5 CLONE Statement">
<code class="literal">
CLONE
</code>
</a>
syntax, the clone plugin must
be installed. See
<a class="xref" href="clone-plugin.html" title="7.6.7 The Clone Plugin">
Section 7.6.7, “The Clone Plugin”
</a>
.
</p>
<p>
<a class="link" href="clone.html" title="15.7.5 CLONE Statement">
<code class="literal">
CLONE LOCAL DATA
DIRECTORY
</code>
</a>
syntax clones data from the local MySQL data
directory to a directory on the same server or node where the
MySQL server instance runs. The
<code class="literal">
'clone_dir'
</code>
directory is the full path of the local directory that data is
cloned to. An absolute path is required. The specified directory
must not exist, but the specified path must be an existent path.
The MySQL server requires the necessary write access to create the
specified directory. For more information, see
<a class="xref" href="clone-plugin-local.html" title="7.6.7.2 Cloning Data Locally">
Section 7.6.7.2, “Cloning Data Locally”
</a>
.
</p>
<p>
<a class="link" href="clone.html" title="15.7.5 CLONE Statement">
<code class="literal">
CLONE INSTANCE
</code>
</a>
syntax clones data from a remote MySQL server instance (the donor)
and transfers it to the MySQL instance where the cloning operation
was initiated (the recipient).
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
<em class="replaceable">
<code>
user
</code>
</em>
</code>
is the
clone user on the donor MySQL server instance.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
<em class="replaceable">
<code>
host
</code>
</em>
</code>
is the
<a class="link" href="server-system-variables.html#sysvar_hostname">
<code class="literal">
hostname
</code>
</a>
address of the donor
MySQL server instance. Internet Protocol version 6 (IPv6)
address format is not supported. An alias to the IPv6 address
can be used instead. An IPv4 address can be used as is.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
<em class="replaceable">
<code>
port
</code>
</em>
</code>
is the
<a class="link" href="server-system-variables.html#sysvar_port">
<code class="literal">
port
</code>
</a>
number of the donor
MySQL server instance. (The X Protocol port specified by
<a class="link" href="x-plugin-options-system-variables.html#sysvar_mysqlx_port">
<code class="literal">
mysqlx_port
</code>
</a>
is not supported.
Connecting to the donor MySQL server instance through MySQL Router
is also not supported.)
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
IDENTIFIED BY
'
<em class="replaceable">
<code>
password
</code>
</em>
'
</code>
specifies the
password of the clone user on the donor MySQL server instance.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
DATA DIRECTORY [=]
'
<em class="replaceable">
<code>
clone_dir
</code>
</em>
'
</code>
is an
optional clause used to specify a directory on the recipient
for the data you are cloning. Use this option if you do not
want to remove existing data in the recipient data directory.
An absolute path is required, and the directory must not
exist. The MySQL server must have the necessary write access
to create the directory.
</p>
<p>
When the optional
<code class="literal">
DATA DIRECTORY [=]
'
<em class="replaceable">
<code>
clone_dir
</code>
</em>
'
</code>
clause is not
used, a cloning operation removes existing data in the
recipient data directory, replaces it with the cloned data,
and automatically restarts the server afterward.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
[REQUIRE [NO] SSL]
</code>
explicitly specifies
whether an encrypted connection is to be used or not when
transferring cloned data over the network. An error is
returned if the explicit specification cannot be satisfied. If
an SSL clause is not specified, clone attempts to establish an
encrypted connection by default, falling back to an insecure
connection if the secure connection attempt fails. A secure
connection is required when cloning encrypted data regardless
of whether this clause is specified. For more information, see
<a class="xref" href="clone-plugin-remote.html#clone-plugin-remote-ssl" title="Configuring an Encrypted Connection for Cloning">
Configuring an Encrypted Connection for Cloning
</a>
.
</p>
</li>
</ul>
</div>
<p>
For additional information about cloning data from a remote MySQL
server instance, see
<a class="xref" href="clone-plugin-remote.html" title="7.6.7.3 Cloning Remote Data">
Section 7.6.7.3, “Cloning Remote Data”
</a>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/innodb-init-startup-configuration.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="innodb-init-startup-configuration">
</a>
17.8.1 InnoDB Startup Configuration
</h3>
</div>
</div>
</div>
<p>
The first decisions to make about
<code class="literal">
InnoDB
</code>
configuration involve the configuration of data files, log files,
page size, and memory buffers, which should be configured before
initializing
<code class="literal">
InnoDB
</code>
. Modifying the
configuration after
<code class="literal">
InnoDB
</code>
is initialized may
involve non-trivial procedures.
</p>
<p>
This section provides information about specifying
<code class="literal">
InnoDB
</code>
settings in a configuration file,
viewing
<code class="literal">
InnoDB
</code>
initialization information, and
important storage considerations.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="xref" href="innodb-init-startup-configuration.html#innodb-startup-mysql-configuration-file" title="Specifying Options in a MySQL Option File">
Specifying Options in a MySQL Option File
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="innodb-init-startup-configuration.html#innodb-startup-initialization-information" title="Viewing InnoDB Initialization Information">
Viewing InnoDB Initialization Information
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="innodb-init-startup-configuration.html#innodb-startup-storage-considerations" title="Important Storage Considerations">
Important Storage Considerations
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="innodb-init-startup-configuration.html#innodb-startup-data-file-configuration" title="System Tablespace Data File Configuration">
System Tablespace Data File Configuration
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="innodb-init-startup-configuration.html#innodb-startup-doublewrite-file-config" title="InnoDB Doublewrite Buffer File Configuration">
InnoDB Doublewrite Buffer File Configuration
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="innodb-init-startup-configuration.html#innodb-startup-log-file-configuration" title="Redo Log Configuration">
Redo Log Configuration
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="innodb-init-startup-configuration.html#innodb-startup-undo-tablespace" title="Undo Tablespace Configuration">
Undo Tablespace Configuration
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="innodb-init-startup-configuration.html#innodb-startup-temporary-tablespace" title="Global Temporary Tablespace Configuration">
Global Temporary Tablespace Configuration
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="innodb-init-startup-configuration.html#innodb-startup-session-temporary-tablespaces" title="Session Temporary Tablespace Configuration">
Session Temporary Tablespace Configuration
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="innodb-init-startup-configuration.html#innodb-startup-page-size" title="Page Size Configuration">
Page Size Configuration
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="innodb-init-startup-configuration.html#innodb-startup-memory-configuration" title="Memory Configuration">
Memory Configuration
</a>
</p>
</li>
</ul>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="innodb-startup-mysql-configuration-file">
</a>
Specifying Options in a MySQL Option File
</h4>
</div>
</div>
</div>
<p>
Because MySQL uses data file, log file, and page size settings
to initialize
<code class="literal">
InnoDB
</code>
, it is recommended that
you define these settings in an option file that MySQL reads at
startup, prior to initializing
<code class="literal">
InnoDB
</code>
.
Normally,
<code class="literal">
InnoDB
</code>
is initialized when the
MySQL server is started for the first time.
</p>
<p>
You can place
<code class="literal">
InnoDB
</code>
options in the
<code class="literal">
[mysqld]
</code>
group of any option file that your
server reads when it starts. The locations of MySQL option files
are described in
<a class="xref" href="option-files.html" title="6.2.2.2 Using Option Files">
Section 6.2.2.2, “Using Option Files”
</a>
.
</p>
<p>
To make sure that
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
reads options only
from a specific file (and
<code class="filename">
mysqld-auto.cnf
</code>
),
use the
<a class="link" href="option-file-options.html#option_general_defaults-file">
<code class="option">
--defaults-file
</code>
</a>
option
as the first option on the command line when starting the
server:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa36828397"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal">mysqld <span class="token constant">--defaults-file</span><span class="token attr-value"><span class="token punctuation">=</span><em class="replaceable">path_to_option_file</em></span></code></pre>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="innodb-startup-initialization-information">
</a>
Viewing InnoDB Initialization Information
</h4>
</div>
</div>
</div>
<p>
To view
<code class="literal">
InnoDB
</code>
initialization information
during startup, start
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
from a command
prompt, which prints initialization information to the console.
</p>
<p>
For example, on Windows, if
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
is located
in
<code class="filename">
C:\Program Files\MySQL\MySQL Server
8.4\bin
</code>
, start the MySQL server like
this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa97512061"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">C:\></span> <span class="token atrule">"C:\Program Files\MySQL\MySQL Server 8.4\bin\mysqld"</span> <span class="token property">--console</span></code></pre>
</div>
<p>
On Unix-like systems,
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
is located in
the
<code class="filename">
bin
</code>
directory of your MySQL
installation:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa47297954"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">bin/mysqld</span> <span class="token constant">--user</span><span class="token attr-value"><span class="token punctuation">=</span>mysql</span> &</code></pre>
</div>
<p>
If you do not send server output to the console, check the error
log after startup to see the initialization information
<code class="literal">
InnoDB
</code>
printed during the startup process.
</p>
<p>
For information about starting MySQL using other methods, see
<a class="xref" href="automatic-start.html" title="2.9.5 Starting and Stopping MySQL Automatically">
Section 2.9.5, “Starting and Stopping MySQL Automatically”
</a>
.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
<code class="literal">
InnoDB
</code>
does not open all user tables and
associated data files at startup. However,
<code class="literal">
InnoDB
</code>
does check for the existence of
tablespace files referenced in the data dictionary. If a
tablespace file is not found,
<code class="literal">
InnoDB
</code>
logs
an error and continues the startup sequence. Tablespace files
referenced in the redo log may be opened during crash recovery
for redo application.
</p>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="innodb-startup-storage-considerations">
</a>
Important Storage Considerations
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045163616192">
</a>
<a class="indexterm" name="idm46045163614688">
</a>
<p>
Review the following storage-related considerations before
proceeding with your startup configuration.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
In some cases, you can improve database performance by
placing data and log files on separate physical disks. You
can also use raw disk partitions (raw devices) for
<code class="literal">
InnoDB
</code>
data files, which may speed up
I/O. See
<a class="xref" href="innodb-system-tablespace.html#innodb-raw-devices" title="Using Raw Disk Partitions for the System Tablespace">
Using Raw Disk Partitions for the System Tablespace
</a>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
InnoDB
</code>
is a transaction-safe (ACID
compliant) storage engine with commit, rollback, and
crash-recovery capabilities to protect user data.
<span class="bold">
<strong>
However, it cannot do so
</strong>
</span>
if
the underlying operating system or hardware does not work as
advertised. Many operating systems or disk subsystems may
delay or reorder write operations to improve performance. On
some operating systems, the very
<code class="literal">
fsync()
</code>
system call that should wait until all unwritten data for a
file has been flushed might actually return before the data
has been flushed to stable storage. Because of this, an
operating system crash or a power outage may destroy
recently committed data, or in the worst case, even corrupt
the database because write operations have been reordered.
If data integrity is important to you, perform
<span class="quote">
“
<span class="quote">
pull-the-plug
</span>
”
</span>
tests before using anything in
production. On macOS,
<code class="literal">
InnoDB
</code>
uses a
special
<code class="literal">
fcntl()
</code>
file flush method. Under
Linux, it is advisable to
<span class="bold">
<strong>
disable the
write-back cache
</strong>
</span>
.
</p>
<p>
On ATA/SATA disk drives, a command such
<code class="literal">
hdparm -W0
/dev/hda
</code>
may work to disable the write-back cache.
<span class="bold">
<strong>
Beware that some drives or disk
controllers may be unable to disable the write-back
cache.
</strong>
</span>
</p>
</li>
<li class="listitem">
<p>
With regard to
<code class="literal">
InnoDB
</code>
recovery
capabilities that protect user data,
<code class="literal">
InnoDB
</code>
uses a file flush technique
involving a structure called the
<a class="link" href="glossary.html#glos_doublewrite_buffer" title="doublewrite buffer">
doublewrite
buffer
</a>
, which is enabled by default
(
<a class="link" href="innodb-parameters.html#sysvar_innodb_doublewrite">
<code class="literal">
innodb_doublewrite=ON
</code>
</a>
).
The doublewrite buffer adds safety to recovery following an
unexpected exit or power outage, and improves performance on
most varieties of Unix by reducing the need for
<code class="literal">
fsync()
</code>
operations. It is recommended
that the
<a class="link" href="innodb-parameters.html#sysvar_innodb_doublewrite">
<code class="literal">
innodb_doublewrite
</code>
</a>
option remains enabled if you are concerned with data
integrity or possible failures. For information about the
doublewrite buffer, see
<a class="xref" href="innodb-disk-io.html" title="17.11.1 InnoDB Disk I/O">
Section 17.11.1, “InnoDB Disk I/O”
</a>
.
</p>
</li>
<li class="listitem">
<p>
Before using NFS with
<code class="literal">
InnoDB
</code>
, review
potential issues outlined in
<a class="xref" href="disk-issues.html#disk-issues-nfs" title="Using NFS with MySQL">
Using NFS with MySQL
</a>
.
</p>
</li>
</ul>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="innodb-startup-data-file-configuration">
</a>
System Tablespace Data File Configuration
</h4>
</div>
</div>
</div>
<p>
The
<a class="link" href="innodb-parameters.html#sysvar_innodb_data_file_path">
<code class="literal">
innodb_data_file_path
</code>
</a>
option defines the name, size, and attributes of
<code class="literal">
InnoDB
</code>
system tablespace data files. If you
do not configure this option prior to initializing the MySQL
server, the default behavior is to create a single
auto-extending data file, slightly larger than 12MB, named
<code class="filename">
ibdata1
</code>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa15342673"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">SHOW</span> <span class="token keyword">VARIABLES</span> <span class="token operator">LIKE</span> <span class="token string">'innodb_data_file_path'</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> Variable_name <span class="token punctuation">|</span> Value <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> innodb_data_file_path <span class="token punctuation">|</span> ibdata1:12M:autoextend <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
<p>
The full data file specification syntax includes the file name,
file size,
<code class="literal">
autoextend
</code>
attribute, and
<code class="literal">
max
</code>
attribute:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-ini"><div class="docs-select-all right" id="sa78484555"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-ini"><em class="replaceable">file_name</em>:<em class="replaceable">file_size</em>[:autoextend[:max:<em class="replaceable">max_file_size</em>]]</code></pre>
</div>
<p>
File sizes are specified in kilobytes, megabytes, or gigabytes
by appending
<code class="literal">
K
</code>
,
<code class="literal">
M
</code>
or
<code class="literal">
G
</code>
to the size value. If specifying the data
file size in kilobytes, do so in multiples of 1024. Otherwise,
kilobyte values are rounded to nearest megabyte (MB) boundary.
The sum of file sizes must be, at a minimum, slightly larger
than 12MB.
</p>
<p>
You can specify more than one data file using a
semicolon-separated list. For example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-ini"><div class="docs-select-all right" id="sa50218135"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-ini"><span class="token selector">[mysqld]</span>
<span class="token constant">innodb_data_file_path</span><span class="token attr-value"><span class="token punctuation">=</span>ibdata1:50M;ibdata2:50M:autoextend</span></code></pre>
</div>
<p>
The
<code class="literal">
autoextend
</code>
and
<code class="literal">
max
</code>
attributes can be used only for the data file that is specified
last.
</p>
<p>
When the
<code class="literal">
autoextend
</code>
attribute is specified,
the data file automatically increases in size by 64MB increments
as space is required. The
<a class="link" href="innodb-parameters.html#sysvar_innodb_autoextend_increment">
<code class="literal">
innodb_autoextend_increment
</code>
</a>
variable controls the increment size.
</p>
<p>
To specify a maximum size for an auto-extending data file, use
the
<code class="literal">
max
</code>
attribute following the
<code class="literal">
autoextend
</code>
attribute. Use the
<code class="literal">
max
</code>
attribute only in cases where
constraining disk usage is of critical importance. The following
configuration permits
<code class="filename">
ibdata1
</code>
to grow to a
limit of 500MB:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-ini"><div class="docs-select-all right" id="sa7590620"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-ini"><span class="token selector">[mysqld]</span>
<span class="token constant">innodb_data_file_path</span><span class="token attr-value"><span class="token punctuation">=</span>ibdata1:12M:autoextend:max:500M</span></code></pre>
</div>
<p>
A minimum file size is enforced for the
<span class="emphasis">
<em>
first
</em>
</span>
system tablespace data file to ensure
that there is enough space for doublewrite buffer pages. The
following table shows minimum file sizes for each
<code class="literal">
InnoDB
</code>
page size. The default
<code class="literal">
InnoDB
</code>
page size is 16384 (16KB).
</p>
<div class="informaltable">
<table summary="The minimum system tablespace data file for each InnoDB page size.">
<colgroup>
<col style="width: 30%"/>
<col style="width: 30%"/>
</colgroup>
<thead>
<tr>
<th>
Page Size (innodb_page_size)
</th>
<th>
Minimum File Size
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
16384 (16KB) or less
</td>
<td>
3MB
</td>
</tr>
<tr>
<td>
32768 (32KB)
</td>
<td>
6MB
</td>
</tr>
<tr>
<td>
65536 (64KB)
</td>
<td>
12MB
</td>
</tr>
</tbody>
</table>
</div>
<p>
If your disk becomes full, you can add a data file on another
disk. For instructions, see
<a class="xref" href="innodb-system-tablespace.html#innodb-resize-system-tablespace" title="Resizing the System Tablespace">
Resizing the System Tablespace
</a>
.
</p>
<p>
The size limit for individual files is determined by your
operating system. You can set the file size to more than 4GB on
operating systems that support large files. You can also use raw
disk partitions as data files. See
<a class="xref" href="innodb-system-tablespace.html#innodb-raw-devices" title="Using Raw Disk Partitions for the System Tablespace">
Using Raw Disk Partitions for the System Tablespace
</a>
.
</p>
<p>
<code class="literal">
InnoDB
</code>
is not aware of the file system
maximum file size, so be cautious on file systems where the
maximum file size is a small value such as 2GB.
</p>
<p>
System tablespace files are created in the data directory by
default (
<a class="link" href="server-system-variables.html#sysvar_datadir">
<code class="literal">
datadir
</code>
</a>
). To specify
an alternate location, use the
<a class="link" href="innodb-parameters.html#sysvar_innodb_data_home_dir">
<code class="literal">
innodb_data_home_dir
</code>
</a>
option.
For example, to create a system tablespace data file in a
directory named
<code class="filename">
myibdata
</code>
, use this
configuration:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-ini"><div class="docs-select-all right" id="sa63645759"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-ini"><span class="token selector">[mysqld]</span>
<span class="token constant">innodb_data_home_dir</span> <span class="token attr-value"><span class="token punctuation">=</span> /myibdata/</span>
<span class="token constant">innodb_data_file_path</span><span class="token attr-value"><span class="token punctuation">=</span>ibdata1:50M:autoextend</span></code></pre>
</div>
<p>
A trailing slash is required when specifying a value for
<a class="link" href="innodb-parameters.html#sysvar_innodb_data_home_dir">
<code class="literal">
innodb_data_home_dir
</code>
</a>
.
<code class="literal">
InnoDB
</code>
does not create directories, so ensure
that the specified directory exists before you start the server.
Also, ensure sure that the MySQL server has the proper access
rights to create files in the directory.
</p>
<p>
<code class="literal">
InnoDB
</code>
forms the directory path for each data
file by textually concatenating the value of
<a class="link" href="innodb-parameters.html#sysvar_innodb_data_home_dir">
<code class="literal">
innodb_data_home_dir
</code>
</a>
to the
data file name. If
<a class="link" href="innodb-parameters.html#sysvar_innodb_data_home_dir">
<code class="literal">
innodb_data_home_dir
</code>
</a>
is not
defined, the default value is
<span class="quote">
“
<span class="quote">
./
</span>
”
</span>
, which is the
data directory. (The MySQL server changes its current working
directory to the data directory when it begins executing.)
</p>
<p>
Alternatively, you can specify an absolute path for system
tablespace data files. The following configuration is equivalent
to the preceding one:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-ini"><div class="docs-select-all right" id="sa28737378"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-ini"><span class="token selector">[mysqld]</span>
<span class="token constant">innodb_data_file_path</span><span class="token attr-value"><span class="token punctuation">=</span>/myibdata/ibdata1:50M:autoextend</span></code></pre>
</div>
<p>
When you specify an absolute path for
<a class="link" href="innodb-parameters.html#sysvar_innodb_data_file_path">
<code class="literal">
innodb_data_file_path
</code>
</a>
, the
setting is not concatenated with the
<a class="link" href="innodb-parameters.html#sysvar_innodb_data_home_dir">
<code class="literal">
innodb_data_home_dir
</code>
</a>
setting.
System tablespace files are created in the specified absolute
path. The specified directory must exist before you start the
server.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="innodb-startup-doublewrite-file-config">
</a>
InnoDB Doublewrite Buffer File Configuration
</h4>
</div>
</div>
</div>
<p>
The
<code class="literal">
InnoDB
</code>
doublewrite buffer storage area
resides in doublewrite files, which provides flexibility with
respect to the storage location of doublewrite pages. In
previous releases, the doublewrite buffer storage area resided
in the system tablespace. The
<a class="link" href="innodb-parameters.html#sysvar_innodb_doublewrite_dir">
<code class="literal">
innodb_doublewrite_dir
</code>
</a>
variable
defines the directory where
<code class="literal">
InnoDB
</code>
creates
doublewrite files at startup. If no directory is specified,
doublewrite files are created in the
<a class="link" href="innodb-parameters.html#sysvar_innodb_data_home_dir">
<code class="literal">
innodb_data_home_dir
</code>
</a>
directory,
which defaults to the data directory if unspecified.
</p>
<p>
To have doublewrite files created in a location other than the
<a class="link" href="innodb-parameters.html#sysvar_innodb_data_home_dir">
<code class="literal">
innodb_data_home_dir
</code>
</a>
directory,
configure
<a class="link" href="innodb-parameters.html#sysvar_innodb_doublewrite_dir">
<code class="literal">
innodb_doublewrite_dir
</code>
</a>
variable. For example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-ini"><div class="docs-select-all right" id="sa14658878"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-ini"><span class="token constant">innodb_doublewrite_dir</span><span class="token attr-value"><span class="token punctuation">=</span><em class="replaceable">/path/to/doublewrite_directory</em></span></code></pre>
</div>
<p>
Other doublewrite buffer variables permit defining the number of
doublewrite files, the number of pages per thread, and the
doublewrite batch size. For more information about doublewrite
buffer configuration, see
<a class="xref" href="innodb-doublewrite-buffer.html" title="17.6.4 Doublewrite Buffer">
Section 17.6.4, “Doublewrite Buffer”
</a>
.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="innodb-startup-log-file-configuration">
</a>
Redo Log Configuration
</h4>
</div>
</div>
</div>
<p>
The amount of disk space occupied by redo log files is
controlled by the
<a class="link" href="innodb-parameters.html#sysvar_innodb_redo_log_capacity">
<code class="literal">
innodb_redo_log_capacity
</code>
</a>
variable, which can be set at startup or runtime; for example,
to set the variable to 8GiB in an option file, add the following
entry:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-ini"><div class="docs-select-all right" id="sa96900745"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-ini"><span class="token selector">[mysqld]</span>
<span class="token constant">innodb_redo_log_capacity</span> <span class="token attr-value"><span class="token punctuation">=</span> 8589934592</span></code></pre>
</div>
<p>
For information about configuring redo log capacity at runtime,
see
<a class="xref" href="innodb-redo-log.html#innodb-modifying-redo-log-capacity" title="Configuring Redo Log Capacity">
Configuring Redo Log Capacity
</a>
.
</p>
<p>
The
<a class="link" href="innodb-parameters.html#sysvar_innodb_redo_log_capacity">
<code class="literal">
innodb_redo_log_capacity
</code>
</a>
variable supersedes the
<a class="link" href="innodb-parameters.html#sysvar_innodb_log_file_size">
<code class="literal">
innodb_log_file_size
</code>
</a>
and
<a class="link" href="innodb-parameters.html#sysvar_innodb_log_files_in_group">
<code class="literal">
innodb_log_files_in_group
</code>
</a>
variables, which are deprecated. When the
<code class="literal">
innodb_redo_log_capacity
</code>
setting is defined,
the
<code class="literal">
innodb_log_file_size
</code>
and
<code class="literal">
innodb_log_files_in_group
</code>
settings are
ignored; otherwise, if one or both of these deprecated settings
are defined then they are used to compute
<a class="link" href="server-status-variables.html#statvar_Innodb_redo_log_capacity_resized">
<code class="literal">
Innodb_redo_log_capacity_resized
</code>
</a>
as (
<code class="literal">
innodb_log_files_in_group
</code>
*
<code class="literal">
innodb_log_file_size
</code>
). If none of those
variables are set, then the default
<code class="literal">
innodb_redo_log_capacity
</code>
value is used.
</p>
<p>
<code class="literal">
InnoDB
</code>
attempts to maintain 32 redo log
files, with each file equal to 1/32 *
<code class="literal">
innodb_redo_log_capacity
</code>
. The redo log files
reside in the
<code class="filename">
#innodb_redo
</code>
directory in the
data directory unless a different directory was specified by the
<a class="link" href="innodb-parameters.html#sysvar_innodb_log_group_home_dir">
<code class="literal">
innodb_log_group_home_dir
</code>
</a>
variable. If
<code class="literal">
innodb_log_group_home_dir
</code>
was
defined, the redo log files reside in the
<code class="filename">
#innodb_redo
</code>
directory in that directory.
For more information, see
<a class="xref" href="innodb-redo-log.html" title="17.6.5 Redo Log">
Section 17.6.5, “Redo Log”
</a>
.
</p>
<p>
You can define a different number of redo log files and
different redo log file size when initializing the MySQL Server
instance by configuring the
<a class="link" href="innodb-parameters.html#sysvar_innodb_log_files_in_group">
<code class="literal">
innodb_log_files_in_group
</code>
</a>
and
<a class="link" href="innodb-parameters.html#sysvar_innodb_log_file_size">
<code class="literal">
innodb_log_file_size
</code>
</a>
variables.
</p>
<p>
<a class="link" href="innodb-parameters.html#sysvar_innodb_log_files_in_group">
<code class="literal">
innodb_log_files_in_group
</code>
</a>
defines the number of log files in the log group. The default
and recommended value is 2.
</p>
<p>
<a class="link" href="innodb-parameters.html#sysvar_innodb_log_file_size">
<code class="literal">
innodb_log_file_size
</code>
</a>
defines
the size in bytes of each log file in the log group. The
combined log file size
(
<a class="link" href="innodb-parameters.html#sysvar_innodb_log_file_size">
<code class="literal">
innodb_log_file_size
</code>
</a>
*
<a class="link" href="innodb-parameters.html#sysvar_innodb_log_files_in_group">
<code class="literal">
innodb_log_files_in_group
</code>
</a>
)
cannot exceed the maximum value, which is slightly less than
512GB. A pair of 255 GB log files, for example, approaches the
limit but does not exceed it. The default log file size is 48MB.
Generally, the combined size of the log files should be large
enough that the server can smooth out peaks and troughs in
workload activity, which often means that there is enough redo
log space to handle more than an hour of write activity. A
larger log file size means less checkpoint flush activity in the
buffer pool, which reduces disk I/O. For additional information,
see
<a class="xref" href="optimizing-innodb-logging.html" title="10.5.4 Optimizing InnoDB Redo Logging">
Section 10.5.4, “Optimizing InnoDB Redo Logging”
</a>
.
</p>
<p>
The
<a class="link" href="innodb-parameters.html#sysvar_innodb_log_group_home_dir">
<code class="literal">
innodb_log_group_home_dir
</code>
</a>
defines the directory path to the
<code class="literal">
InnoDB
</code>
log
files. You might use this option to place
<code class="literal">
InnoDB
</code>
redo log files in a different physical
storage location than
<code class="literal">
InnoDB
</code>
data files to
avoid potential I/O resource conflicts; for example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-ini"><div class="docs-select-all right" id="sa39295694"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-ini"><span class="token selector">[mysqld]</span>
<span class="token constant">innodb_log_group_home_dir</span> <span class="token attr-value"><span class="token punctuation">=</span> /dr3/iblogs</span></code></pre>
</div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
<code class="literal">
InnoDB
</code>
does not create directories, so make
sure that the log directory exists before you start the
server. Use the Unix or DOS
<code class="literal">
mkdir
</code>
command
to create any necessary directories.
</p>
<p>
Make sure that the MySQL server has the proper access rights
to create files in the log directory. More generally, the
server must have access rights in any directory where it needs
to create files.
</p>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="innodb-startup-undo-tablespace">
</a>
Undo Tablespace Configuration
</h4>
</div>
</div>
</div>
<p>
Undo logs, by default, reside in two undo tablespaces created
when the MySQL instance is initialized.
</p>
<p>
The
<a class="link" href="innodb-parameters.html#sysvar_innodb_undo_directory">
<code class="literal">
innodb_undo_directory
</code>
</a>
variable defines the path where
<code class="literal">
InnoDB
</code>
creates default undo tablespaces. If that variable is undefined,
default undo tablespaces are created in the data directory. The
<a class="link" href="innodb-parameters.html#sysvar_innodb_undo_directory">
<code class="literal">
innodb_undo_directory
</code>
</a>
variable
is not dynamic. Configuring it requires restarting the server.
</p>
<p>
The I/O patterns for undo logs make undo tablespaces good
candidates for
<a class="link" href="glossary.html#glos_ssd" title="SSD">
SSD
</a>
storage.
</p>
<p>
For information about configuring additional undo tablespaces,
see
<a class="xref" href="innodb-undo-tablespaces.html" title="17.6.3.4 Undo Tablespaces">
Section 17.6.3.4, “Undo Tablespaces”
</a>
.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="innodb-startup-temporary-tablespace">
</a>
Global Temporary Tablespace Configuration
</h4>
</div>
</div>
</div>
<p>
The global temporary tablespace stores rollback segments for
changes made to user-created temporary tables.
</p>
<p>
A single auto-extending global temporary tablespace data file
named
<code class="filename">
ibtmp1
</code>
in the
<a class="link" href="innodb-parameters.html#sysvar_innodb_data_home_dir">
<code class="literal">
innodb_data_home_dir
</code>
</a>
directory
by default. The initial file size is slightly larger than 12MB.
</p>
<p>
The
<a class="link" href="innodb-parameters.html#sysvar_innodb_temp_data_file_path">
<code class="literal">
innodb_temp_data_file_path
</code>
</a>
option specifies the path, file name, and file size for global
temporary tablespace data files. File size is specified in KB,
MB, or GB by appending K, M, or G to the size value. The file
size or combined file size must be slightly larger than 12MB.
</p>
<p>
To specify an alternate location for global temporary tablespace
data files, configure the
<a class="link" href="innodb-parameters.html#sysvar_innodb_temp_data_file_path">
<code class="literal">
innodb_temp_data_file_path
</code>
</a>
option at startup.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="innodb-startup-session-temporary-tablespaces">
</a>
Session Temporary Tablespace Configuration
</h4>
</div>
</div>
</div>
<p>
In MySQL 8.4,
<code class="literal">
InnoDB
</code>
is always
used as the on-disk storage engine for internal temporary
tables.
</p>
<p>
The
<a class="link" href="innodb-parameters.html#sysvar_innodb_temp_tablespaces_dir">
<code class="literal">
innodb_temp_tablespaces_dir
</code>
</a>
variable defines the location where
<code class="literal">
InnoDB
</code>
creates session temporary tablespaces. The default location is
the
<code class="filename">
#innodb_temp
</code>
directory in the data
directory.
</p>
<p>
To specify an alternate location for session temporary
tablespaces, configure the
<a class="link" href="innodb-parameters.html#sysvar_innodb_temp_tablespaces_dir">
<code class="literal">
innodb_temp_tablespaces_dir
</code>
</a>
variable at startup. A fully qualified path or path relative to
the data directory is permitted.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="innodb-startup-page-size">
</a>
Page Size Configuration
</h4>
</div>
</div>
</div>
<p>
The
<a class="link" href="innodb-parameters.html#sysvar_innodb_page_size">
<code class="literal">
innodb_page_size
</code>
</a>
option
specifies the page size for all
<code class="literal">
InnoDB
</code>
tablespaces in a MySQL instance. This value is set when the
instance is created and remains constant afterward. Valid values
are 64KB, 32KB, 16KB (the default), 8KB, and 4KB. Alternatively,
you can specify page size in bytes (65536, 32768, 16384, 8192,
4096).
</p>
<p>
The default 16KB page size is appropriate for a wide range of
workloads, particularly for queries involving table scans and
DML operations involving bulk updates. Smaller page sizes might
be more efficient for OLTP workloads involving many small
writes, where contention can be an issue when a single page
contains many rows. Smaller pages can also be more efficient for
SSD storage devices, which typically use small block sizes.
Keeping the
<code class="literal">
InnoDB
</code>
page size close to the
storage device block size minimizes the amount of unchanged data
that is rewritten to disk.
</p>
<div class="important" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Important
</div>
<p>
<a class="link" href="innodb-parameters.html#sysvar_innodb_page_size">
<code class="literal">
innodb_page_size
</code>
</a>
can be set
only when initializing the data directory. See the description
of this variable for more information.
</p>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="innodb-startup-memory-configuration">
</a>
Memory Configuration
</h4>
</div>
</div>
</div>
<p>
MySQL allocates memory to various caches and buffers to improve
performance of database operations. When allocating memory for
<code class="literal">
InnoDB
</code>
, always consider memory required by
the operating system, memory allocated to other applications,
and memory allocated for other MySQL buffers and caches. For
example, if you use
<code class="literal">
MyISAM
</code>
tables, consider
the amount of memory allocated for the key buffer
(
<a class="link" href="server-system-variables.html#sysvar_key_buffer_size">
<code class="literal">
key_buffer_size
</code>
</a>
). For an
overview of MySQL buffers and caches, see
<a class="xref" href="memory-use.html" title="10.12.3.1 How MySQL Uses Memory">
Section 10.12.3.1, “How MySQL Uses Memory”
</a>
.
</p>
<p>
Buffers specific to
<code class="literal">
InnoDB
</code>
are configured
using the following parameters:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="link" href="innodb-parameters.html#sysvar_innodb_buffer_pool_size">
<code class="literal">
innodb_buffer_pool_size
</code>
</a>
defines size of the buffer pool, which is the memory area
that holds cached data for
<code class="literal">
InnoDB
</code>
tables,
indexes, and other auxiliary buffers. The size of the buffer
pool is important for system performance, and it is
typically recommended that
<a class="link" href="innodb-parameters.html#sysvar_innodb_buffer_pool_size">
<code class="literal">
innodb_buffer_pool_size
</code>
</a>
is
configured to 50 to 75 percent of system memory. The default
buffer pool size is 128MB. For additional guidance, see
<a class="xref" href="memory-use.html" title="10.12.3.1 How MySQL Uses Memory">
Section 10.12.3.1, “How MySQL Uses Memory”
</a>
. For information about how to
configure
<code class="literal">
InnoDB
</code>
buffer pool size, see
<a class="xref" href="innodb-buffer-pool-resize.html" title="17.8.3.1 Configuring InnoDB Buffer Pool Size">
Section 17.8.3.1, “Configuring InnoDB Buffer Pool Size”
</a>
. Buffer pool
size can be configured at startup or dynamically.
</p>
<p>
On systems with a large amount of memory, you can improve
concurrency by dividing the buffer pool into multiple buffer
pool instances. The number of buffer pool instances is
controlled by the by
<a class="link" href="innodb-parameters.html#sysvar_innodb_buffer_pool_instances">
<code class="literal">
innodb_buffer_pool_instances
</code>
</a>
option. By default,
<code class="literal">
InnoDB
</code>
creates one
buffer pool instance. The number of buffer pool instances
can be configured at startup. For more information, see
<a class="xref" href="innodb-multiple-buffer-pools.html" title="17.8.3.2 Configuring Multiple Buffer Pool Instances">
Section 17.8.3.2, “Configuring Multiple Buffer Pool Instances”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="innodb-parameters.html#sysvar_innodb_log_buffer_size">
<code class="literal">
innodb_log_buffer_size
</code>
</a>
defines the size of the buffer that
<code class="literal">
InnoDB
</code>
uses to write to the log files on
disk. The default size is 64MB. A large log buffer enables
large transactions to run without writing the log to disk
before the transactions commit. If you have transactions
that update, insert, or delete many rows, you might consider
increasing the size of the log buffer to save disk I/O.
<a class="link" href="innodb-parameters.html#sysvar_innodb_log_buffer_size">
<code class="literal">
innodb_log_buffer_size
</code>
</a>
can
be configured at startup. For related information, see
<a class="xref" href="optimizing-innodb-logging.html" title="10.5.4 Optimizing InnoDB Redo Logging">
Section 10.5.4, “Optimizing InnoDB Redo Logging”
</a>
.
</p>
</li>
</ul>
</div>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Warning
</div>
<p>
On 32-bit GNU/Linux x86, if memory usage is set too high,
<code class="literal">
glibc
</code>
may permit the process heap to grow
over the thread stacks, causing a server failure. It is a risk
if the memory allocated to the
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
process for global and per-thread buffers and caches is close
to or exceeds 2GB.
</p>
<p>
A formula similar to the following that calculates global and
per-thread memory allocation for MySQL can be used to estimate
MySQL memory usage. You may need to modify the formula to
account for buffers and caches in your MySQL version and
configuration. For an overview of MySQL buffers and caches,
see
<a class="xref" href="memory-use.html" title="10.12.3.1 How MySQL Uses Memory">
Section 10.12.3.1, “How MySQL Uses Memory”
</a>
.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-none"><div class="docs-select-all right" id="sa43913281"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-none">innodb_buffer_pool_size
+ key_buffer_size
+ max_connections*(sort_buffer_size+read_buffer_size+binlog_cache_size)
+ max_connections*2MB</code></pre>
</div>
<p>
Each thread uses a stack (often 2MB, but only 256KB in MySQL
binaries provided by Oracle Corporation.) and in the worst
case also uses
<code class="literal">
sort_buffer_size +
read_buffer_size
</code>
additional memory.
</p>
</div>
<p>
On Linux, if the kernel is enabled for large page support,
<code class="literal">
InnoDB
</code>
can use large pages to allocate memory
for its buffer pool. See
<a class="xref" href="large-page-support.html" title="10.12.3.3 Enabling Large Page Support">
Section 10.12.3.3, “Enabling Large Page Support”
</a>
.
</p>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/mysql-cluster-programs-ndb-perror.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="mysql-cluster-programs-ndb-perror">
</a>
25.5.16 ndb_perror — Obtain NDB Error Message Information
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045100742256">
</a>
<p>
<a class="link" href="mysql-cluster-programs-ndb-perror.html" title="25.5.16 ndb_perror — Obtain NDB Error Message Information">
<span class="command">
<strong>
ndb_perror
</strong>
</span>
</a>
shows information about an NDB
error, given its error code. This includes the error message,
the type of error, and whether the error is permanent or
temporary. This is intended as a drop-in replacement for
<a class="link" href="perror.html" title="6.8.1 perror — Display MySQL Error Message Information">
<span class="command">
<strong>
perror
</strong>
</span>
</a>
<a class="ulink" href="/doc/refman/8.0/en/perror.html#option_perror_ndb" target="_top">
<code class="option">
--ndb
</code>
</a>
,
which is no longer supported.
</p>
<h4>
<a name="idm46045100737232">
</a>
Usage
</h4>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa10372790"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal">ndb_perror <span class="token punctuation">[</span><em class="replaceable">options</em><span class="token punctuation">]</span> <em class="replaceable">error_code</em></code></pre>
</div>
<p>
<a class="link" href="mysql-cluster-programs-ndb-perror.html" title="25.5.16 ndb_perror — Obtain NDB Error Message Information">
<span class="command">
<strong>
ndb_perror
</strong>
</span>
</a>
does not need to access a running
NDB Cluster, or any nodes (including SQL nodes). To view
information about a given NDB error, invoke the program, using
the error code as an argument, like this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa1420516"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">ndb_perror</span> 323
NDB error code 323<span class="token punctuation">:</span> Invalid nodegroup id<span class="token punctuation">,</span> nodegroup already existing<span class="token punctuation">:</span> Permanent error<span class="token punctuation">:</span> Application error</code></pre>
</div>
<p>
To display only the error message, invoke
<a class="link" href="mysql-cluster-programs-ndb-perror.html" title="25.5.16 ndb_perror — Obtain NDB Error Message Information">
<span class="command">
<strong>
ndb_perror
</strong>
</span>
</a>
with the
<a class="link" href="mysql-cluster-programs-ndb-perror.html#option_ndb_perror_silent">
<code class="option">
--silent
</code>
</a>
option (short form
<code class="option">
-s
</code>
), as shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa92944932"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">ndb_perror</span> <span class="token property">-s</span> 323
Invalid nodegroup id<span class="token punctuation">,</span> nodegroup already existing<span class="token punctuation">:</span> Permanent error<span class="token punctuation">:</span> Application error</code></pre>
</div>
<p>
Like
<a class="link" href="perror.html" title="6.8.1 perror — Display MySQL Error Message Information">
<span class="command">
<strong>
perror
</strong>
</span>
</a>
,
<a class="link" href="mysql-cluster-programs-ndb-perror.html" title="25.5.16 ndb_perror — Obtain NDB Error Message Information">
<span class="command">
<strong>
ndb_perror
</strong>
</span>
</a>
accepts multiple error codes:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa3102433"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$> </span><span class="token command">ndb_perror</span> 321 1001
NDB error code 321<span class="token punctuation">:</span> Invalid nodegroup id<span class="token punctuation">:</span> Permanent error<span class="token punctuation">:</span> Application error
NDB error code 1001<span class="token punctuation">:</span> Illegal connect string</code></pre>
</div>
<p>
Additional program options for
<a class="link" href="mysql-cluster-programs-ndb-perror.html" title="25.5.16 ndb_perror — Obtain NDB Error Message Information">
<span class="command">
<strong>
ndb_perror
</strong>
</span>
</a>
are
described later in this section.
</p>
<p>
<a class="link" href="mysql-cluster-programs-ndb-perror.html" title="25.5.16 ndb_perror — Obtain NDB Error Message Information">
<span class="command">
<strong>
ndb_perror
</strong>
</span>
</a>
replaces
<a class="link" href="perror.html" title="6.8.1 perror — Display MySQL Error Message Information">
<span class="command">
<strong>
perror
</strong>
</span>
</a>
<code class="option">
--ndb
</code>
, which is no longer supported by NDB
Cluster. To make substitution easier in scripts and other
applications that might depend on
<a class="link" href="perror.html" title="6.8.1 perror — Display MySQL Error Message Information">
<span class="command">
<strong>
perror
</strong>
</span>
</a>
for
obtaining NDB error information,
<a class="link" href="mysql-cluster-programs-ndb-perror.html" title="25.5.16 ndb_perror — Obtain NDB Error Message Information">
<span class="command">
<strong>
ndb_perror
</strong>
</span>
</a>
supports its own
<span class="quote">
“
<span class="quote">
dummy
</span>
”
</span>
<a class="link" href="mysql-cluster-programs-ndb-perror.html#option_ndb_perror_ndb">
<code class="option">
--ndb
</code>
</a>
option, which does
nothing.
</p>
<p>
The following table includes all options that are specific to
the NDB Cluster program
<a class="link" href="mysql-cluster-programs-ndb-perror.html" title="25.5.16 ndb_perror — Obtain NDB Error Message Information">
<span class="command">
<strong>
ndb_perror
</strong>
</span>
</a>
.
Additional descriptions follow the table.
</p>
<p>
</p>
<h4>
<a name="mysql-cluster-programs-ndb-perror-additional-options">
</a>
Additional Options
</h4>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a name="option_ndb_perror_defaults-extra-file">
</a>
<a class="link" href="mysql-cluster-programs-ndb-perror.html#option_ndb_perror_defaults-extra-file">
<code class="option">
--defaults-extra-file
</code>
</a>
</p>
<a class="indexterm" name="idm46045100706032">
</a>
<a class="indexterm" name="idm46045100704576">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for defaults-extra-file">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--defaults-extra-file=path
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
[none]
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Read given file after global files are read.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_perror_defaults-file">
</a>
<a class="link" href="mysql-cluster-programs-ndb-perror.html#option_ndb_perror_defaults-file">
<code class="option">
--defaults-file
</code>
</a>
</p>
<a class="indexterm" name="idm46045100690224">
</a>
<a class="indexterm" name="idm46045100688736">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for defaults-file">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--defaults-file=path
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
[none]
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Read default options from given file only.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_perror_defaults-group-suffix">
</a>
<a class="link" href="mysql-cluster-programs-ndb-perror.html#option_ndb_perror_defaults-group-suffix">
<code class="option">
--defaults-group-suffix
</code>
</a>
</p>
<a class="indexterm" name="idm46045100674528">
</a>
<a class="indexterm" name="idm46045100673072">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for defaults-group-suffix">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--defaults-group-suffix=string
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
[none]
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Also read groups with concat(group, suffix).
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_perror_help">
</a>
<a class="link" href="mysql-cluster-programs-ndb-perror.html#option_ndb_perror_help">
<code class="option">
--help
</code>
</a>
,
<code class="option">
-?
</code>
</p>
<a class="indexterm" name="idm46045100658416">
</a>
<a class="indexterm" name="idm46045100656928">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for help">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--help
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Display program help text and exit.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_perror_login-path">
</a>
<a class="link" href="mysql-cluster-programs-ndb-perror.html#option_ndb_perror_login-path">
<code class="option">
--login-path
</code>
</a>
</p>
<a class="indexterm" name="idm46045100647184">
</a>
<a class="indexterm" name="idm46045100645696">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for login-path">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--login-path=path
</code>
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
[none]
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Read given path from login file.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_perror_no-login-paths">
</a>
<a class="link" href="mysql-cluster-programs-ndb-perror.html#option_ndb_perror_no-login-paths">
<code class="option">
--no-login-paths
</code>
</a>
</p>
<a class="indexterm" name="idm46045100631424">
</a>
<a class="indexterm" name="idm46045100629936">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for no-login-paths">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--no-login-paths
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Skips reading options from the login path file.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_perror_ndb">
</a>
<a class="link" href="mysql-cluster-programs-ndb-perror.html#option_ndb_perror_ndb">
<code class="option">
--ndb
</code>
</a>
</p>
<a class="indexterm" name="idm46045100620448">
</a>
<a class="indexterm" name="idm46045100618960">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for ndb">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--ndb
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
For compatibility with applications depending on old
versions of
<a class="link" href="perror.html" title="6.8.1 perror — Display MySQL Error Message Information">
<span class="command">
<strong>
perror
</strong>
</span>
</a>
that use that
program's
<a class="ulink" href="/doc/refman/8.0/en/perror.html#option_perror_ndb" target="_top">
<code class="option">
--ndb
</code>
</a>
option.
The option when used with
<a class="link" href="mysql-cluster-programs-ndb-perror.html" title="25.5.16 ndb_perror — Obtain NDB Error Message Information">
<span class="command">
<strong>
ndb_perror
</strong>
</span>
</a>
does
nothing, and is ignored by it.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_perror_no-defaults">
</a>
<a class="link" href="mysql-cluster-programs-ndb-perror.html#option_ndb_perror_no-defaults">
<code class="option">
--no-defaults
</code>
</a>
</p>
<a class="indexterm" name="idm46045100605696">
</a>
<a class="indexterm" name="idm46045100604208">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for no-defaults">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--no-defaults
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Do not read default options from any option file other than
login file.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_perror_print-defaults">
</a>
<a class="link" href="mysql-cluster-programs-ndb-perror.html#option_ndb_perror_print-defaults">
<code class="option">
--print-defaults
</code>
</a>
</p>
<a class="indexterm" name="idm46045100594496">
</a>
<a class="indexterm" name="idm46045100593008">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for print-defaults">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--print-defaults
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Print program argument list and exit.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_perror_silent">
</a>
<a class="link" href="mysql-cluster-programs-ndb-perror.html#option_ndb_perror_silent">
<code class="option">
--silent
</code>
</a>
,
<code class="option">
-s
</code>
</p>
<a class="indexterm" name="idm46045100582928">
</a>
<a class="indexterm" name="idm46045100581440">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for silent">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--silent
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Show error message only.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_perror_version">
</a>
<a class="link" href="mysql-cluster-programs-ndb-perror.html#option_ndb_perror_version">
<code class="option">
--version
</code>
</a>
,
<code class="option">
-V
</code>
</p>
<a class="indexterm" name="idm46045100571344">
</a>
<a class="indexterm" name="idm46045100569856">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for version">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--version
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Print program version information and exit.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_perror_verbose">
</a>
<a class="link" href="mysql-cluster-programs-ndb-perror.html#option_ndb_perror_verbose">
<code class="option">
--verbose
</code>
</a>
,
<code class="option">
-v
</code>
</p>
<a class="indexterm" name="idm46045100559744">
</a>
<a class="indexterm" name="idm46045100558256">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for verbose">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--verbose
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Verbose output; disable with
<a class="link" href="mysql-cluster-programs-ndb-perror.html#option_ndb_perror_silent">
<code class="option">
--silent
</code>
</a>
.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/mysql-shell-userguide.html | <div id="docs-body">
<div class="chapter">
<div class="titlepage">
<div>
<div>
<h1 class="title">
<a name="mysql-shell-userguide">
</a>
Chapter 21 MySQL Shell
</h1>
</div>
</div>
</div>
<a class="indexterm" name="idm46045128188560">
</a>
<a class="indexterm" name="idm46045128187520">
</a>
<a class="indexterm" name="idm46045128186032">
</a>
<p>
MySQL Shell is an advanced client and code editor for MySQL Server.
In addition to the provided SQL functionality, similar to
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
, MySQL Shell provides scripting
capabilities for JavaScript and Python and includes APIs for working
with MySQL. MySQL Shell is a component that you can install
separately.
</p>
<p>
The following discussion briefly describes MySQL Shell's
capabilities. For more information, see the MySQL Shell manual,
available at
<a class="ulink" href="/doc/mysql-shell/en/" target="_top">
https://dev.mysql.com/doc/mysql-shell/en/
</a>
.
</p>
<p>
MySQL Shell includes the following APIs implemented in JavaScript
and Python which you can use to develop code that interacts with
MySQL.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
The X DevAPI enables developers to work with both relational
and document data when MySQL Shell is connected to a MySQL
server using the X Protocol. This enables you to use MySQL as a
Document Store, sometimes referred to as
<span class="quote">
“
<span class="quote">
using
NoSQL
</span>
”
</span>
. For more information, see
<a class="xref" href="document-store.html" title="Chapter 22 Using MySQL as a Document Store">
Chapter 22,
<i>
Using MySQL as a Document Store
</i>
</a>
. For documentation on the
concepts and usage of X DevAPI, which is implemented in
MySQL Shell, see
<a class="ulink" href="/doc/x-devapi-userguide/en/" target="_top">
X DevAPI User Guide
</a>
.
</p>
</li>
<li class="listitem">
<p>
The AdminAPI enables database administrators to work with
InnoDB Cluster, which provides an integrated solution for high
availability and scalability using InnoDB based MySQL databases,
without requiring advanced MySQL expertise. The AdminAPI also
includes support for InnoDB ReplicaSet, which enables you to
administer a set of MySQL instances running asynchronous
GTID-based replication in a similar way to InnoDB Cluster.
Additionally, the AdminAPI makes administration of MySQL Router
easier, including integration with both InnoDB Cluster and
InnoDB ReplicaSet. See
<a class="ulink" href="/doc/mysql-shell/8.4/en/admin-api-userguide.html" target="_top">
MySQL AdminAPI
</a>
.
</p>
</li>
</ul>
</div>
<p>
MySQL Shell is available in two editions, the Community Edition and
the Commercial Edition. The Community Edition is available free of
charge. The Commercial Edition provides additional Enterprise
features at low cost.
</p>
</div>
<br/>
</div>
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.