url
stringlengths 45
122
| content
stringlengths 380
3.07M
|
---|---|
https://dev.mysql.com/doc/refman/8.4/en/sys-extract-table-from-file-name.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="sys-extract-table-from-file-name">
</a>
30.4.5.2 The extract_table_from_file_name() Function
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045061035888">
</a>
<a class="indexterm" name="idm46045061034432">
</a>
<p>
Given a file path name, returns the path component that
represents the table name.
</p>
<p>
This function is useful when extracting file I/O information
from the Performance Schema that includes file path names. It
provides a convenient way to display table names, which can be
more easily understood than full path names, and can be used
in joins against object table names.
</p>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="sys-extract-table-from-file-name-parameters">
</a>
Parameters
</h5>
</div>
</div>
</div>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
path VARCHAR(512)
</code>
: The full path to a
data file from which to extract the table name.
</p>
</li>
</ul>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="sys-extract-table-from-file-name-return-value">
</a>
Return Value
</h5>
</div>
</div>
</div>
<p>
A
<code class="literal">
VARCHAR(64)
</code>
value.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="sys-extract-table-from-file-name-example">
</a>
Example
</h5>
</div>
</div>
</div>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa60667397"><div class="copy-help left">Press ⌘+C to 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>extract_table_from_file_name<span class="token punctuation">(</span><span class="token string">'/usr/local/mysql/data/world/City.ibd'</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 class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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.extract_table_from_file_name('/usr/local/mysql/data/world/City.ibd') <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>
<span class="token output"><span class="token punctuation">|</span> City <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></code></pre>
</div>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/replication-features-fractional-seconds.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="replication-features-fractional-seconds">
</a>
19.5.1.15 Replication and Fractional Seconds Support
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045135508624">
</a>
<a class="indexterm" name="idm46045135507136">
</a>
<p>
MySQL 8.4 permits fractional seconds for
<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">
DATETIME
</code>
</a>
, and
<a class="link" href="datetime.html" title="13.2.2 The DATE, DATETIME, and TIMESTAMP Types">
<code class="literal">
TIMESTAMP
</code>
</a>
values, with up to
microseconds (6 digits) precision. See
<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>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/performance-schema-data-locks-table.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="performance-schema-data-locks-table">
</a>
29.12.13.1 The data_locks Table
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045070548736">
</a>
<a class="indexterm" name="idm46045070547248">
</a>
<p>
The
<a class="link" href="performance-schema-data-locks-table.html" title="29.12.13.1 The data_locks Table">
<code class="literal">
data_locks
</code>
</a>
table shows data
locks held and requested. For information about which lock
requests are blocked by which held locks, see
<a class="xref" href="performance-schema-data-lock-waits-table.html" title="29.12.13.2 The data_lock_waits Table">
Section 29.12.13.2, “The data_lock_waits Table”
</a>
.
</p>
<p>
Example data lock information:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa65173355"><div class="copy-help left">Press ⌘+C to 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>data_locks\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> INNODB
ENGINE_LOCK_ID<span class="token punctuation">:</span> 139664434886512<span class="token punctuation">:</span>1059<span class="token punctuation">:</span>139664350547912
ENGINE_TRANSACTION_ID<span class="token punctuation">:</span> 2569
THREAD_ID<span class="token punctuation">:</span> 46
EVENT_ID<span class="token punctuation">:</span> 12
OBJECT_SCHEMA<span class="token punctuation">:</span> test
OBJECT_NAME<span class="token punctuation">:</span> t1
PARTITION_NAME<span class="token punctuation">:</span> NULL
SUBPARTITION_NAME<span class="token punctuation">:</span> NULL
INDEX_NAME<span class="token punctuation">:</span> NULL
OBJECT_INSTANCE_BEGIN<span class="token punctuation">:</span> 139664350547912
LOCK_TYPE<span class="token punctuation">:</span> TABLE
LOCK_MODE<span class="token punctuation">:</span> IX
LOCK_STATUS<span class="token punctuation">:</span> GRANTED
LOCK_DATA<span class="token punctuation">:</span> NULL
<span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span 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
ENGINE_LOCK_ID<span class="token punctuation">:</span> 139664434886512<span class="token punctuation">:</span>2<span class="token punctuation">:</span>4<span class="token punctuation">:</span>1<span class="token punctuation">:</span>139664350544872
ENGINE_TRANSACTION_ID<span class="token punctuation">:</span> 2569
THREAD_ID<span class="token punctuation">:</span> 46
EVENT_ID<span class="token punctuation">:</span> 12
OBJECT_SCHEMA<span class="token punctuation">:</span> test
OBJECT_NAME<span class="token punctuation">:</span> t1
PARTITION_NAME<span class="token punctuation">:</span> NULL
SUBPARTITION_NAME<span class="token punctuation">:</span> NULL
INDEX_NAME<span class="token punctuation">:</span> GEN_CLUST_INDEX
OBJECT_INSTANCE_BEGIN<span class="token punctuation">:</span> 139664350544872
LOCK_TYPE<span class="token punctuation">:</span> RECORD
LOCK_MODE<span class="token punctuation">:</span> X
LOCK_STATUS<span class="token punctuation">:</span> GRANTED
LOCK_DATA<span class="token punctuation">:</span> supremum pseudo-record</span></code></pre>
</div>
<p>
Unlike most Performance Schema data collection, there are no
instruments for controlling whether data lock information is
collected or system variables for controlling data lock table
sizes. The Performance Schema collects information that is
already available in the server, so there is no memory or CPU
overhead to generate this information or need for parameters
that control its collection.
</p>
<p>
Use the
<a class="link" href="performance-schema-data-locks-table.html" title="29.12.13.1 The data_locks Table">
<code class="literal">
data_locks
</code>
</a>
table to help
diagnose performance problems that occur during times of heavy
concurrent load. For
<code class="literal">
InnoDB
</code>
, see the
discussion of this topic at
<a class="xref" href="innodb-information-schema-transactions.html" title="17.15.2 InnoDB INFORMATION_SCHEMA Transaction and Locking Information">
Section 17.15.2, “InnoDB INFORMATION_SCHEMA Transaction and Locking Information”
</a>
.
</p>
<p>
The
<a class="link" href="performance-schema-data-locks-table.html" title="29.12.13.1 The data_locks Table">
<code class="literal">
data_locks
</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">
ENGINE
</code>
</p>
<p>
The storage engine that holds or requested the lock.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
ENGINE_LOCK_ID
</code>
</p>
<p>
The ID of the lock held or requested by the storage
engine. Tuples of (
<code class="literal">
ENGINE_LOCK_ID
</code>
,
<code class="literal">
ENGINE
</code>
) values are unique.
</p>
<p>
Lock ID formats are internal and subject to change at any
time. Applications should not rely on lock IDs having a
particular format.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
ENGINE_TRANSACTION_ID
</code>
</p>
<p>
The storage engine internal ID of the transaction that
requested the lock. This can be considered the owner of
the lock, although the lock might still be pending, not
actually granted yet
(
<code class="literal">
LOCK_STATUS='WAITING'
</code>
).
</p>
<p>
If the transaction has not yet performed any write
operation (is still considered read only), the column
contains internal data that users should not try to
interpret. Otherwise, the column is the transaction ID.
</p>
<p>
For
<code class="literal">
InnoDB
</code>
, to obtain details about the
transaction, join this column with the
<code class="literal">
TRX_ID
</code>
column of the
<code class="literal">
INFORMATION_SCHEMA
</code>
<a class="link" href="information-schema-innodb-trx-table.html" title="28.4.28 The INFORMATION_SCHEMA INNODB_TRX Table">
<code class="literal">
INNODB_TRX
</code>
</a>
table.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
THREAD_ID
</code>
</p>
<p>
The thread ID of the session that created the lock. To
obtain details about the thread, join this column with the
<code class="literal">
THREAD_ID
</code>
column of the Performance
Schema
<a class="link" href="performance-schema-threads-table.html" title="29.12.22.8 The threads Table">
<code class="literal">
threads
</code>
</a>
table.
</p>
<p>
<code class="literal">
THREAD_ID
</code>
can be used together with
<code class="literal">
EVENT_ID
</code>
to determine the event during
which the lock data structure was created in memory. (This
event might have occurred before this particular lock
request occurred, if the data structure is used to store
multiple locks.)
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
EVENT_ID
</code>
</p>
<p>
The Performance Schema event that caused the lock. Tuples
of (
<code class="literal">
THREAD_ID
</code>
,
<code class="literal">
EVENT_ID
</code>
) values implicitly identify a
parent event in other Performance Schema tables:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
The parent wait event in the
<code class="literal">
events_waits_
<em class="replaceable">
<code>
xxx
</code>
</em>
</code>
tables
</p>
</li>
<li class="listitem">
<p>
The parent stage event in the
<code class="literal">
events_stages_
<em class="replaceable">
<code>
xxx
</code>
</em>
</code>
tables
</p>
</li>
<li class="listitem">
<p>
The parent statement event in the
<code class="literal">
events_statements_
<em class="replaceable">
<code>
xxx
</code>
</em>
</code>
tables
</p>
</li>
<li class="listitem">
<p>
The parent transaction event in the
<a class="link" href="performance-schema-events-transactions-current-table.html" title="29.12.7.1 The events_transactions_current Table">
<code class="literal">
events_transactions_current
</code>
</a>
table
</p>
</li>
</ul>
</div>
<p>
To obtain details about the parent event, join the
<code class="literal">
THREAD_ID
</code>
and
<code class="literal">
EVENT_ID
</code>
columns with the columns of
like name in the appropriate parent event table. See
<a class="xref" href="performance-schema-obtaining-parent-events.html" title="29.19.2 Obtaining Parent Event Information">
Section 29.19.2, “Obtaining Parent Event Information”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
OBJECT_SCHEMA
</code>
</p>
<p>
The schema that contains the locked table.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
OBJECT_NAME
</code>
</p>
<p>
The name of the locked table.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
PARTITION_NAME
</code>
</p>
<p>
The name of the locked partition, if any;
<code class="literal">
NULL
</code>
otherwise.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
SUBPARTITION_NAME
</code>
</p>
<p>
The name of the locked subpartition, if any;
<code class="literal">
NULL
</code>
otherwise.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
INDEX_NAME
</code>
</p>
<p>
The name of the locked index, if any;
<code class="literal">
NULL
</code>
otherwise.
</p>
<p>
In practice,
<code class="literal">
InnoDB
</code>
always creates an
index (
<code class="literal">
GEN_CLUST_INDEX
</code>
), so
<code class="literal">
INDEX_NAME
</code>
is
non-
<code class="literal">
NULL
</code>
for
<code class="literal">
InnoDB
</code>
tables.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
OBJECT_INSTANCE_BEGIN
</code>
</p>
<p>
The address in memory of the lock.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
LOCK_TYPE
</code>
</p>
<p>
The type of lock.
</p>
<p>
The value is storage engine dependent. For
<code class="literal">
InnoDB
</code>
, permitted values are
<code class="literal">
RECORD
</code>
for a row-level lock,
<code class="literal">
TABLE
</code>
for a table-level lock.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
LOCK_MODE
</code>
</p>
<p>
How the lock is requested.
</p>
<p>
The value is storage engine dependent. For
<code class="literal">
InnoDB
</code>
, permitted values are
<code class="literal">
S[,GAP]
</code>
,
<code class="literal">
X[,GAP]
</code>
,
<code class="literal">
IS[,GAP]
</code>
,
<code class="literal">
IX[,GAP]
</code>
,
<code class="literal">
AUTO_INC
</code>
, and
<code class="literal">
UNKNOWN
</code>
. Lock modes other than
<code class="literal">
AUTO_INC
</code>
and
<code class="literal">
UNKNOWN
</code>
indicate gap locks, if present. For information about
<code class="literal">
S
</code>
,
<code class="literal">
X
</code>
,
<code class="literal">
IS
</code>
,
<code class="literal">
IX
</code>
, and gap
locks, refer to
<a class="xref" href="innodb-locking.html" title="17.7.1 InnoDB Locking">
Section 17.7.1, “InnoDB Locking”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
LOCK_STATUS
</code>
</p>
<p>
The status of the lock request.
</p>
<p>
The value is storage engine dependent. For
<code class="literal">
InnoDB
</code>
, permitted values are
<code class="literal">
GRANTED
</code>
(lock is held) and
<code class="literal">
WAITING
</code>
(lock is being waited for).
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
LOCK_DATA
</code>
</p>
<p>
The data associated with the lock, if any. The value is
storage engine dependent. For
<code class="literal">
InnoDB
</code>
, a
value is shown if the
<code class="literal">
LOCK_TYPE
</code>
is
<code class="literal">
RECORD
</code>
, otherwise the value is
<code class="literal">
NULL
</code>
. Primary key values of the locked
record are shown for a lock placed on the primary key
index. Secondary index values of the locked record are
shown with primary key values appended for a lock placed
on a secondary index. If there is no primary key,
<code class="literal">
LOCK_DATA
</code>
shows either the key values
of a selected unique index or the unique
<code class="literal">
InnoDB
</code>
internal row ID number,
according to the rules governing
<code class="literal">
InnoDB
</code>
clustered index use (see
<a class="xref" href="innodb-index-types.html" title="17.6.2.1 Clustered and Secondary Indexes">
Section 17.6.2.1, “Clustered and Secondary Indexes”
</a>
).
<code class="literal">
LOCK_DATA
</code>
reports
<span class="quote">
“
<span class="quote">
supremum
pseudo-record
</span>
”
</span>
for a lock taken on a supremum
pseudo-record. If the page containing the locked record is
not in the buffer pool because it was written to disk
while the lock was held,
<code class="literal">
InnoDB
</code>
does
not fetch the page from disk. Instead,
<code class="literal">
LOCK_DATA
</code>
reports
<code class="literal">
NULL
</code>
.
</p>
</li>
</ul>
</div>
<p>
The
<a class="link" href="performance-schema-data-locks-table.html" title="29.12.13.1 The data_locks Table">
<code class="literal">
data_locks
</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">
ENGINE_LOCK_ID
</code>
,
<code class="literal">
ENGINE
</code>
)
</p>
</li>
<li class="listitem">
<p>
Index on (
<code class="literal">
ENGINE_TRANSACTION_ID
</code>
,
<code class="literal">
ENGINE
</code>
)
</p>
</li>
<li class="listitem">
<p>
Index on (
<code class="literal">
THREAD_ID
</code>
,
<code class="literal">
EVENT_ID
</code>
)
</p>
</li>
<li class="listitem">
<p>
Index on (
<code class="literal">
OBJECT_SCHEMA
</code>
,
<code class="literal">
OBJECT_NAME
</code>
,
<code class="literal">
PARTITION_NAME
</code>
,
<code class="literal">
SUBPARTITION_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-data-locks-table.html" title="29.12.13.1 The data_locks Table">
<code class="literal">
data_locks
</code>
</a>
table.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/manual-info.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title">
<a name="manual-info">
</a>
1.1 About This Manual
</h2>
</div>
</div>
</div>
<a class="indexterm" name="idm46045335341328">
</a>
<a class="indexterm" name="idm46045335340320">
</a>
<p>
This is the Reference Manual for the MySQL Database System,
version 8.4, through release 8.4.3.
Differences between minor versions of MySQL 8.4 are
noted in the present text with reference to release numbers
(8.4.
<em class="replaceable">
<code>
x
</code>
</em>
). For license
information, see the
<a class="link" href="preface.html#legalnotice" title="Legal Notices">
Legal
Notices
</a>
.
</p>
<p>
This manual is not intended for use with older versions of the
MySQL software due to the many functional and other differences
between MySQL 8.4 and previous versions. If you are
using an earlier release of the MySQL software, please refer to
the appropriate manual. For example, the
<a class="ulink" href="/doc/refman/8.0/en/" target="_top">
MySQL 8.0
Reference Manual
</a>
covers the 8.0 bugfix series of MySQL
software releases.
</p>
<p>
Because this manual serves as a reference, it does not provide
general instruction on SQL or relational database concepts. It
also does not teach you how to use your operating system or
command-line interpreter.
</p>
<p>
The MySQL Database Software is under constant development, and the
Reference Manual is updated frequently as well. The most recent
version of the manual is available online in searchable form at
<a class="ulink" href="/doc/" target="_top">
https://dev.mysql.com/doc/
</a>
. Other formats also are available
there, including downloadable HTML and PDF versions.
</p>
<a class="indexterm" name="idm46045335333616">
</a>
<p>
The source code for MySQL itself contains internal documentation
written using Doxygen. The generated Doxygen content is available
from
<a class="ulink" href="/doc/index-other.html" target="_top">
https://dev.mysql.com/doc/index-other.html
</a>
. It is also
possible to generate this content locally from a MySQL source
distribution using the instructions at
<a class="xref" href="source-installation-doxygen.html" title="2.8.10 Generating MySQL Doxygen Documentation Content">
Section 2.8.10, “Generating MySQL Doxygen Documentation Content”
</a>
.
</p>
<p>
If you have questions about using MySQL, join the
<a class="ulink" href="https://mysqlcommunity.slack.com/" target="_blank">
MySQL Community
Slack
</a>
. If you have suggestions concerning additions or
corrections to the manual itself, please send them to the
<a class="ulink" href="http://www.mysql.com/company/contact/" target="_blank">
http://www.mysql.com/company/contact/
</a>
.
</p>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h3 class="title">
<a name="manual-conventions">
</a>
Typographical and Syntax Conventions
</h3>
</div>
</div>
</div>
<p>
This manual uses certain typographical conventions:
</p>
<a class="indexterm" name="idm46045335327216">
</a>
<a class="indexterm" name="idm46045335325824">
</a>
<a class="indexterm" name="idm46045335324816">
</a>
<a class="indexterm" name="idm46045335323424">
</a>
<a class="indexterm" name="idm46045335322032">
</a>
<a class="indexterm" name="idm46045335321024">
</a>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
Text in this style
</code>
is used for SQL
statements; database, table, and column names; program listings
and source code; and environment variables. Example:
<span class="quote">
“
<span class="quote">
To
reload the grant tables, use the
<a class="link" href="flush.html#flush-privileges">
<code class="literal">
FLUSH
PRIVILEGES
</code>
</a>
statement.
</span>
”
</span>
</p>
</li>
<li class="listitem">
<p>
<strong class="userinput">
<code>
Text in this style
</code>
</strong>
indicates input that
you type in examples.
</p>
</li>
<li class="listitem">
<p>
<span class="command">
<strong>
Text in this style
</strong>
</span>
indicates the names of
executable programs and scripts, examples being
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
(the MySQL command-line client program)
and
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
(the MySQL server executable).
</p>
</li>
<li class="listitem">
<p>
<em class="replaceable">
<code>
Text in this style
</code>
</em>
is used for
variable input for which you should substitute a value of your
own choosing.
</p>
</li>
<li class="listitem">
<p>
<span class="emphasis">
<em>
Text in this style
</em>
</span>
is used for emphasis.
</p>
</li>
<li class="listitem">
<p>
<span class="bold">
<strong>
Text in this style
</strong>
</span>
is used in
table headings and to convey especially strong emphasis.
</p>
</li>
<li class="listitem">
<p>
<code class="option">
Text in this style
</code>
is used to indicate a
program option that affects how the program is executed, or that
supplies information that is needed for the program to function
in a certain way.
<span class="emphasis">
<em>
Example
</em>
</span>
:
<span class="quote">
“
<span class="quote">
The
<code class="option">
--host
</code>
option (short form
<code class="option">
-h
</code>
)
tells 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 program the hostname
or IP address of the MySQL server that it should connect
to
</span>
”
</span>
.
</p>
</li>
<li class="listitem">
<p>
File names and directory names are written like this:
<span class="quote">
“
<span class="quote">
The
global
<code class="filename">
my.cnf
</code>
file is located in the
<code class="filename">
/etc
</code>
directory.
</span>
”
</span>
</p>
</li>
<li class="listitem">
<p>
Character sequences are written like this:
<span class="quote">
“
<span class="quote">
To specify a
wildcard, use the
<span class="quote">
‘
<span class="quote">
<code class="literal">
%
</code>
</span>
’
</span>
character.
</span>
”
</span>
</p>
</li>
</ul>
</div>
<p>
When commands or statements are prefixed by a prompt, we use these:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa73592481"><div class="copy-help left">Press ⌘+C to 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">type</span> a command here
<span class="token prompt">#> </span><span class="token command">type</span> a command as <em class="replaceable">root</em> here
<span class="token prompt">C:\></span><span class="token command"> type</span> a command here <span class="token punctuation">(</span>Windows only<span class="token punctuation">)</span>
<span class="token prompt">mysql></span><span class="token command"> type</span> a mysql statement here</code></pre>
</div>
<p>
Commands are issued in your command interpreter. On Unix, this is
typically a program such as
<span class="command">
<strong>
sh
</strong>
</span>
,
<span class="command">
<strong>
csh
</strong>
</span>
, or
<span class="command">
<strong>
bash
</strong>
</span>
. On Windows, the
equivalent program is
<span class="command">
<strong>
command.com
</strong>
</span>
or
<span class="command">
<strong>
cmd.exe
</strong>
</span>
, typically run in a console window.
Statements prefixed by
<code class="literal">
mysql
</code>
are issued 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>
command-line client.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
When you enter a command or statement shown in an example, do not
type the prompt shown in the example.
</p>
</div>
<p>
In some areas different systems may be distinguished from each other
to show that commands should be executed in two different
environments. For example, while working with replication the
commands might be prefixed with
<code class="literal">
source
</code>
and
<code class="literal">
replica
</code>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa46009648"><div class="copy-help left">Press ⌘+C to 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">source></span> <span class="token keyword">type</span> a mysql statement <span class="token keyword">on</span> the <span class="token keyword">replication</span> <span class="token keyword">source</span> here
<span class="token prompt">replica></span> <span class="token keyword">type</span> a mysql statement <span class="token keyword">on</span> the <span class="token keyword">replica</span> here</code></pre>
</div>
<p>
Database, table, and column names must often be substituted into
statements. To indicate that such substitution is necessary, this
manual uses
<em class="replaceable">
<code>
db_name
</code>
</em>
,
<em class="replaceable">
<code>
tbl_name
</code>
</em>
, and
<em class="replaceable">
<code>
col_name
</code>
</em>
. For example, you might see a
statement like this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa21082747"><div class="copy-help left">Press ⌘+C to 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> <em class="replaceable">col_name</em> <span class="token keyword">FROM</span> <em class="replaceable">db_name</em><span class="token punctuation">.</span><em class="replaceable">tbl_name</em><span class="token punctuation">;</span></code></pre>
</div>
<p>
This means that if you were to enter a similar statement, you would
supply your own database, table, and column names, perhaps like
this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa73155833"><div class="copy-help left">Press ⌘+C to 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> author_name <span class="token keyword">FROM</span> biblio_db<span class="token punctuation">.</span>author_list<span class="token punctuation">;</span></code></pre>
</div>
<p>
SQL keywords are not case-sensitive and may be written in any
lettercase. This manual uses uppercase.
</p>
<p>
In syntax descriptions, square brackets
(
<span class="quote">
“
<span class="quote">
<code class="literal">
[
</code>
</span>
”
</span>
and
<span class="quote">
“
<span class="quote">
<code class="literal">
]
</code>
</span>
”
</span>
) indicate optional words or
clauses. For example, in the following statement,
<code class="literal">
IF
EXISTS
</code>
is optional:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa53970195"><div class="copy-help left">Press ⌘+C to 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">DROP</span> <span class="token keyword">TABLE</span> <span class="token punctuation">[</span><span class="token keyword">IF</span> <span class="token keyword">EXISTS</span><span class="token punctuation">]</span> <em class="replaceable">tbl_name</em></code></pre>
</div>
<p>
When a syntax element consists of a number of alternatives, the
alternatives are separated by vertical bars
(
<span class="quote">
“
<span class="quote">
<code class="literal">
|
</code>
</span>
”
</span>
). When one member from a set of
choices
<span class="emphasis">
<em>
may
</em>
</span>
be chosen, the alternatives are
listed within square brackets (
<span class="quote">
“
<span class="quote">
<code class="literal">
[
</code>
</span>
”
</span>
and
<span class="quote">
“
<span class="quote">
<code class="literal">
]
</code>
</span>
”
</span>
):
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa2429763"><div class="copy-help left">Press ⌘+C to 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 function">TRIM</span><span class="token punctuation">(</span><span class="token punctuation">[</span><span class="token punctuation">[</span><span class="token keyword">BOTH</span> <span class="token operator">|</span> <span class="token keyword">LEADING</span> <span class="token operator">|</span> <span class="token keyword">TRAILING</span><span class="token punctuation">]</span> <span class="token punctuation">[</span><em class="replaceable">remstr</em><span class="token punctuation">]</span> <span class="token keyword">FROM</span><span class="token punctuation">]</span> <em class="replaceable">str</em><span class="token punctuation">)</span></code></pre>
</div>
<p>
When one member from a set of choices
<span class="emphasis">
<em>
must
</em>
</span>
be
chosen, the alternatives are listed within braces
(
<span class="quote">
“
<span class="quote">
<code class="literal">
{
</code>
</span>
”
</span>
and
<span class="quote">
“
<span class="quote">
<code class="literal">
}
</code>
</span>
”
</span>
):
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa72667936"><div class="copy-help left">Press ⌘+C to 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">DESCRIBE</span> <span class="token operator">|</span> <span class="token keyword">DESC</span>} <em class="replaceable">tbl_name</em> <span class="token punctuation">[</span><em class="replaceable">col_name</em> <span class="token operator">|</span> <em class="replaceable">wild</em><span class="token punctuation">]</span></code></pre>
</div>
<p>
An ellipsis (
<code class="literal">
...
</code>
) indicates the omission of a
section of a statement, typically to provide a shorter version of
more complex syntax. For example,
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT ... INTO
OUTFILE
</code>
</a>
is shorthand for the form of
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
statement that has an
<code class="literal">
INTO OUTFILE
</code>
clause following other parts of the
statement.
</p>
<p>
An ellipsis can also indicate that the preceding syntax element of a
statement may be repeated. In the following example, multiple
<em class="replaceable">
<code>
reset_option
</code>
</em>
values may be given, with
each of those after the first preceded by commas:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa85436636"><div class="copy-help left">Press ⌘+C to 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">RESET</span> <em class="replaceable">reset_option</em> <span class="token punctuation">[</span><span class="token punctuation">,</span><em class="replaceable">reset_option</em><span class="token punctuation">]</span> <span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span></code></pre>
</div>
<p>
Commands for setting shell variables are shown using Bourne shell
syntax. For example, the sequence to set the
<code class="literal">
CC
</code>
environment variable and run the
<span class="command">
<strong>
configure
</strong>
</span>
command looks like this in Bourne shell syntax:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa50803970"><div class="copy-help left">Press ⌘+C to 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">CC</span><span class="token attr-value"><span class="token punctuation">=</span>gcc</span> <span class="token punctuation">.</span>/configure</code></pre>
</div>
<a class="indexterm" name="idm46045335254704">
</a>
<a class="indexterm" name="idm46045335253696">
</a>
<p>
If you are using
<span class="command">
<strong>
csh
</strong>
</span>
or
<span class="command">
<strong>
tcsh
</strong>
</span>
,
you must issue commands somewhat differently:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa66377055"><div class="copy-help left">Press ⌘+C to 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">setenv</span> CC gcc
<span class="token prompt">$> </span><span class="token command">./configure</span></code></pre>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h3 class="title">
<a name="manual-authorship">
</a>
Manual Authorship
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045335247936">
</a>
<p>
The Reference Manual source files are written in DocBook XML
format. The HTML version and other formats are produced
automatically, primarily using the DocBook XSL stylesheets. For
information about DocBook, see
<a class="ulink" href="http://docbook.org/" target="_blank">
http://docbook.org/
</a>
</p>
<p>
This manual was originally written by David Axmark and Michael
<span class="quote">
“
<span class="quote">
Monty
</span>
”
</span>
Widenius. It is maintained by the MySQL
Documentation Team, consisting of Edward Gilmore, Stefan Hinz,
David Hollis, Philip Olson, Daniel So, and Jon Stephens.
</p>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/index-merge-optimization.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="index-merge-optimization">
</a>
10.2.1.3 Index Merge Optimization
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045229892064">
</a>
<a class="indexterm" name="idm46045229891024">
</a>
<a class="indexterm" name="idm46045229889936">
</a>
<p>
The
<span class="firstterm">
Index Merge
</span>
access
method retrieves rows with multiple
<a class="link" href="explain-output.html#jointype_range">
<code class="literal">
range
</code>
</a>
scans and merges
their results into one. This access method merges index scans
from a single table only, not scans across multiple tables.
The merge can produce unions, intersections, or
unions-of-intersections of its underlying scans.
</p>
<p>
Example queries for which Index Merge may be used:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa3684630"><div class="copy-help left">Press ⌘+C to 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">key1</em> <span class="token operator">=</span> <span class="token number">10</span> <span class="token operator">OR</span> <em class="replaceable">key2</em> <span class="token operator">=</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> <span class="token punctuation">(</span><em class="replaceable">key1</em> <span class="token operator">=</span> <span class="token number">10</span> <span class="token operator">OR</span> <em class="replaceable">key2</em> <span class="token operator">=</span> <span class="token number">20</span><span class="token punctuation">)</span> <span class="token operator">AND</span> <em class="replaceable">non_key</em> <span class="token operator">=</span> <span class="token number">30</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 punctuation">,</span> t2
<span class="token keyword">WHERE</span> <span class="token punctuation">(</span>t1<span class="token punctuation">.</span><em class="replaceable">key1</em> <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 operator">OR</span> t1<span class="token punctuation">.</span><em class="replaceable">key2</em> <span class="token operator">LIKE</span> <span class="token string">'<em class="replaceable">value</em>%'</span><span class="token punctuation">)</span>
<span class="token operator">AND</span> t2<span class="token punctuation">.</span><em class="replaceable">key1</em> <span class="token operator">=</span> t1<span class="token punctuation">.</span><em class="replaceable">some_col</em><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 punctuation">,</span> t2
<span class="token keyword">WHERE</span> t1<span class="token punctuation">.</span><em class="replaceable">key1</em> <span class="token operator">=</span> <span class="token number">1</span>
<span class="token operator">AND</span> <span class="token punctuation">(</span>t2<span class="token punctuation">.</span><em class="replaceable">key1</em> <span class="token operator">=</span> t1<span class="token punctuation">.</span><em class="replaceable">some_col</em> <span class="token operator">OR</span> t2<span class="token punctuation">.</span><em class="replaceable">key2</em> <span class="token operator">=</span> t1<span class="token punctuation">.</span><em class="replaceable">some_col2</em><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 Index Merge optimization algorithm has the following
known limitations:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
If your query has a complex
<code class="literal">
WHERE
</code>
clause with deep
<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>
nesting and MySQL does not choose the optimal plan, try
distributing terms using the following identity
transformations:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa73763025"><div class="copy-help left">Press ⌘+C to 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">x</em> <span class="token operator">AND</span> <em class="replaceable">y</em><span class="token punctuation">)</span> <span class="token operator">OR</span> <em class="replaceable">z</em> <span class="token operator">=</span><span class="token operator">></span> <span class="token punctuation">(</span><em class="replaceable">x</em> <span class="token operator">OR</span> <em class="replaceable">z</em><span class="token punctuation">)</span> <span class="token operator">AND</span> <span class="token punctuation">(</span><em class="replaceable">y</em> <span class="token operator">OR</span> <em class="replaceable">z</em><span class="token punctuation">)</span>
<span class="token punctuation">(</span><em class="replaceable">x</em> <span class="token operator">OR</span> <em class="replaceable">y</em><span class="token punctuation">)</span> <span class="token operator">AND</span> <em class="replaceable">z</em> <span class="token operator">=</span><span class="token operator">></span> <span class="token punctuation">(</span><em class="replaceable">x</em> <span class="token operator">AND</span> <em class="replaceable">z</em><span class="token punctuation">)</span> <span class="token operator">OR</span> <span class="token punctuation">(</span><em class="replaceable">y</em> <span class="token operator">AND</span> <em class="replaceable">z</em><span class="token punctuation">)</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
Index Merge is not applicable to full-text indexes.
</p>
</li>
</ul>
</div>
</div>
<p>
In
<a class="link" href="explain.html" title="15.8.2 EXPLAIN Statement">
<code class="literal">
EXPLAIN
</code>
</a>
output, the Index
Merge method appears as
<a class="link" href="explain-output.html#jointype_index_merge">
<code class="literal">
index_merge
</code>
</a>
in the
<code class="literal">
type
</code>
column. In this case, the
<code class="literal">
key
</code>
column contains a list of indexes used,
and
<code class="literal">
key_len
</code>
contains a list of the longest
key parts for those indexes.
</p>
<p>
The Index Merge access method has several algorithms, which
are displayed in the
<code class="literal">
Extra
</code>
field of
<a class="link" href="explain.html" title="15.8.2 EXPLAIN Statement">
<code class="literal">
EXPLAIN
</code>
</a>
output:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
Using intersect(...)
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
Using union(...)
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
Using sort_union(...)
</code>
</p>
</li>
</ul>
</div>
<p>
The following sections describe these algorithms in greater
detail. The optimizer chooses between different possible Index
Merge algorithms and other access methods based on cost
estimates of the various available options.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="xref" href="index-merge-optimization.html#index-merge-intersection" title="Index Merge Intersection Access Algorithm">
Index Merge Intersection Access Algorithm
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="index-merge-optimization.html#index-merge-union" title="Index Merge Union Access Algorithm">
Index Merge Union Access Algorithm
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="index-merge-optimization.html#index-merge-sort-union" title="Index Merge Sort-Union Access Algorithm">
Index Merge Sort-Union Access Algorithm
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="index-merge-optimization.html#index-merge-influencing" title="Influencing Index Merge Optimization">
Influencing Index Merge Optimization
</a>
</p>
</li>
</ul>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="index-merge-intersection">
</a>
Index Merge Intersection Access Algorithm
</h5>
</div>
</div>
</div>
<p>
This access algorithm is applicable when a
<code class="literal">
WHERE
</code>
clause is converted to several
range conditions on different keys combined with
<a class="link" href="logical-operators.html#operator_and">
<code class="literal">
AND
</code>
</a>
, and each condition is one
of the following:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
An
<em class="replaceable">
<code>
N
</code>
</em>
-part expression of this
form, where the index has exactly
<em class="replaceable">
<code>
N
</code>
</em>
parts (that is, all index
parts are covered):
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa29533768"><div class="copy-help left">Press ⌘+C to 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">key_part1</em> <span class="token operator">=</span> <em class="replaceable">const1</em> <span class="token operator">AND</span> <em class="replaceable">key_part2</em> <span class="token operator">=</span> <em class="replaceable">const2</em> <span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span> <span class="token operator">AND</span> <em class="replaceable">key_partN</em> <span class="token operator">=</span> <em class="replaceable">constN</em></code></pre>
</div>
</li>
<li class="listitem">
<p>
Any range condition over the primary key of an
<code class="literal">
InnoDB
</code>
table.
</p>
</li>
</ul>
</div>
<p>
Examples:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa15731858"><div class="copy-help left">Press ⌘+C to 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">innodb_table</em>
<span class="token keyword">WHERE</span> <em class="replaceable">primary_key</em> <span class="token operator"><</span> <span class="token number">10</span> <span class="token operator">AND</span> <em class="replaceable">key_col1</em> <span class="token operator">=</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">key1_part1</em> <span class="token operator">=</span> <span class="token number">1</span> <span class="token operator">AND</span> <em class="replaceable">key1_part2</em> <span class="token operator">=</span> <span class="token number">2</span> <span class="token operator">AND</span> <em class="replaceable">key2</em> <span class="token operator">=</span> <span class="token number">2</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
The Index Merge intersection algorithm performs simultaneous
scans on all used indexes and produces the intersection of
row sequences that it receives from the merged index scans.
</p>
<p>
If all columns used in the query are covered by the used
indexes, full table rows are not retrieved
(
<a class="link" href="explain.html" title="15.8.2 EXPLAIN Statement">
<code class="literal">
EXPLAIN
</code>
</a>
output contains
<code class="literal">
Using index
</code>
in
<code class="literal">
Extra
</code>
field in this case). Here is an example of such a query:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa45522334"><div class="copy-help left">Press ⌘+C to 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">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> key1 <span class="token operator">=</span> <span class="token number">1</span> <span class="token operator">AND</span> key2 <span class="token operator">=</span> <span class="token number">1</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
If the used indexes do not cover all columns used in the
query, full rows are retrieved only when the range
conditions for all used keys are satisfied.
</p>
<p>
If one of the merged conditions is a condition over the
primary key of an
<code class="literal">
InnoDB
</code>
table, it is not
used for row retrieval, but is used to filter out rows
retrieved using other conditions.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="index-merge-union">
</a>
Index Merge Union Access Algorithm
</h5>
</div>
</div>
</div>
<p>
The criteria for this algorithm are similar to those for the
Index Merge intersection algorithm. The algorithm is
applicable when the table's
<code class="literal">
WHERE
</code>
clause is converted to several range conditions on different
keys combined with
<a class="link" href="logical-operators.html#operator_or">
<code class="literal">
OR
</code>
</a>
, and each
condition is one of the following:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
An
<em class="replaceable">
<code>
N
</code>
</em>
-part expression of this
form, where the index has exactly
<em class="replaceable">
<code>
N
</code>
</em>
parts (that is, all index
parts are covered):
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa38473490"><div class="copy-help left">Press ⌘+C to 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">key_part1</em> <span class="token operator">=</span> <em class="replaceable">const1</em> <span class="token operator">OR</span> <em class="replaceable">key_part2</em> <span class="token operator">=</span> <em class="replaceable">const2</em> <span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span> <span class="token operator">OR</span> <em class="replaceable">key_partN</em> <span class="token operator">=</span> <em class="replaceable">constN</em></code></pre>
</div>
</li>
<li class="listitem">
<p>
Any range condition over a primary key of an
<code class="literal">
InnoDB
</code>
table.
</p>
</li>
<li class="listitem">
<p>
A condition for which the Index Merge intersection
algorithm is applicable.
</p>
</li>
</ul>
</div>
<p>
Examples:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa41940481"><div class="copy-help left">Press ⌘+C to 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> <em class="replaceable">key1</em> <span class="token operator">=</span> <span class="token number">1</span> <span class="token operator">OR</span> <em class="replaceable">key2</em> <span class="token operator">=</span> <span class="token number">2</span> <span class="token operator">OR</span> <em class="replaceable">key3</em> <span class="token operator">=</span> <span class="token number">3</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">innodb_table</em>
<span class="token keyword">WHERE</span> <span class="token punctuation">(</span><em class="replaceable">key1</em> <span class="token operator">=</span> <span class="token number">1</span> <span class="token operator">AND</span> <em class="replaceable">key2</em> <span class="token operator">=</span> <span class="token number">2</span><span class="token punctuation">)</span>
<span class="token operator">OR</span> <span class="token punctuation">(</span><em class="replaceable">key3</em> <span class="token operator">=</span> <span class="token string">'foo'</span> <span class="token operator">AND</span> <em class="replaceable">key4</em> <span class="token operator">=</span> <span class="token string">'bar'</span><span class="token punctuation">)</span> <span class="token operator">AND</span> <em class="replaceable">key5</em> <span class="token operator">=</span> <span class="token number">5</span><span class="token punctuation">;</span></code></pre>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="index-merge-sort-union">
</a>
Index Merge Sort-Union Access Algorithm
</h5>
</div>
</div>
</div>
<p>
This access algorithm is applicable when the
<code class="literal">
WHERE
</code>
clause is converted to several
range conditions combined by
<a class="link" href="logical-operators.html#operator_or">
<code class="literal">
OR
</code>
</a>
, but the Index Merge union
algorithm is not applicable.
</p>
<p>
Examples:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa29749457"><div class="copy-help left">Press ⌘+C to 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_col1</em> <span class="token operator"><</span> <span class="token number">10</span> <span class="token operator">OR</span> <em class="replaceable">key_col2</em> <span class="token operator"><</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> <span class="token punctuation">(</span><em class="replaceable">key_col1</em> <span class="token operator">></span> <span class="token number">10</span> <span class="token operator">OR</span> <em class="replaceable">key_col2</em> <span class="token operator">=</span> <span class="token number">20</span><span class="token punctuation">)</span> <span class="token operator">AND</span> <em class="replaceable">nonkey_col</em> <span class="token operator">=</span> <span class="token number">30</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
The difference between the sort-union algorithm and the
union algorithm is that the sort-union algorithm must first
fetch row IDs for all rows and sort them before returning
any rows.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="index-merge-influencing">
</a>
Influencing Index Merge Optimization
</h5>
</div>
</div>
</div>
<p>
Use of Index Merge is subject to the value of the
<a class="link" href="switchable-optimizations.html#optflag_index-merge">
<code class="literal">
index_merge
</code>
</a>
,
<a class="link" href="switchable-optimizations.html#optflag_index-merge-intersection">
<code class="literal">
index_merge_intersection
</code>
</a>
,
<a class="link" href="switchable-optimizations.html#optflag_index-merge-union">
<code class="literal">
index_merge_union
</code>
</a>
, and
<a class="link" href="switchable-optimizations.html#optflag_index-merge-sort-union">
<code class="literal">
index_merge_sort_union
</code>
</a>
flags of the
<a class="link" href="server-system-variables.html#sysvar_optimizer_switch">
<code class="literal">
optimizer_switch
</code>
</a>
system
variable. See
<a class="xref" href="switchable-optimizations.html" title="10.9.2 Switchable Optimizations">
Section 10.9.2, “Switchable Optimizations”
</a>
. By
default, all those flags are
<code class="literal">
on
</code>
. To
enable only certain algorithms, set
<a class="link" href="switchable-optimizations.html#optflag_index-merge">
<code class="literal">
index_merge
</code>
</a>
to
<code class="literal">
off
</code>
, and enable only such of the others
as should be permitted.
</p>
<p>
In addition to using the
<a class="link" href="server-system-variables.html#sysvar_optimizer_switch">
<code class="literal">
optimizer_switch
</code>
</a>
system
variable to control optimizer use of the Index Merge
algorithms session-wide, MySQL supports optimizer hints to
influence the optimizer on a per-statement basis. See
<a class="xref" href="optimizer-hints.html" title="10.9.3 Optimizer Hints">
Section 10.9.3, “Optimizer Hints”
</a>
.
</p>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/upgrade-prerequisites.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title">
<a name="upgrade-prerequisites">
</a>
3.6 Preparing Your Installation for Upgrade
</h2>
</div>
</div>
</div>
<p>
Before upgrading to the latest MySQL 8.4 release,
ensure the upgrade readiness of your current MySQL
8.3 or MySQL 8.4 server instance by
performing the preliminary checks described below. The upgrade
process may fail otherwise.
</p>
<div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Tip
</div>
<p>
Consider using the
<a class="ulink" href="/doc/mysql-shell/8.4/en/mysql-shell-utilities-upgrade.html" target="_top">
MySQL Shell upgrade checker utility
</a>
that enables you to verify whether MySQL server instances are ready for upgrade. You can select a target MySQL Server release to which you plan to upgrade, ranging from the MySQL Server 8.0.11 up to the MySQL Server release number that matches the current MySQL Shell release number. The upgrade checker utility carries out the automated checks that are relevant for the specified target release, and advises you of further relevant checks that you should make manually. The upgrade checker works for all GA releases of MySQL 5.7, 8.0, and 8.3. 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>
<p>
Preliminary checks:
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
The following issues must not be present:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
There must be no tables that use obsolete data types or
functions.
</p>
</li>
<li class="listitem">
<p>
There must be no orphan
<code class="filename">
.frm
</code>
files.
</p>
</li>
<li class="listitem">
<p>
Triggers must not have a missing or empty definer or an
invalid creation context (indicated by the
<code class="literal">
character_set_client
</code>
,
<code class="literal">
collation_connection
</code>
,
<code class="literal">
Database
Collation
</code>
attributes displayed by
<a class="link" href="show-triggers.html" title="15.7.7.40 SHOW TRIGGERS Statement">
<code class="literal">
SHOW TRIGGERS
</code>
</a>
or the
<code class="literal">
INFORMATION_SCHEMA
</code>
<a class="link" href="information-schema-triggers-table.html" title="28.3.44 The INFORMATION_SCHEMA TRIGGERS Table">
<code class="literal">
TRIGGERS
</code>
</a>
table). Any such
triggers must be dumped and restored to fix the issue.
</p>
</li>
</ul>
</div>
<p>
To check for these issues, execute this command:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa82656044"><div class="copy-help left">Press ⌘+C to 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">mysqlcheck <span class="token property">-u</span> root <span class="token property">-p</span> <span class="token property">--all-databases</span> <span class="token property">--check-upgrade</span></code></pre>
</div>
<p>
If
<a class="link" href="mysqlcheck.html" title="6.5.3 mysqlcheck — A Table Maintenance Program">
<span class="command">
<strong>
mysqlcheck
</strong>
</span>
</a>
reports any errors, correct
the issues.
</p>
</li>
<li class="listitem">
<p>
There must be no partitioned tables that use a storage engine
that does not have native partitioning support. To identify
such tables, execute this query:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa70815228"><div class="copy-help left">Press ⌘+C to 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> 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">TABLES</span>
<span class="token keyword">WHERE</span> <span class="token keyword">ENGINE</span> <span class="token operator">NOT</span> <span class="token keyword">IN</span> <span class="token punctuation">(</span><span class="token string">'innodb'</span><span class="token punctuation">,</span> <span class="token string">'ndbcluster'</span><span class="token punctuation">)</span>
<span class="token operator">AND</span> CREATE_OPTIONS <span class="token operator">LIKE</span> <span class="token string">'%partitioned%'</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Any table reported by the query must be altered to use
<code class="literal">
InnoDB
</code>
or be made nonpartitioned. To change
a table storage engine to
<code class="literal">
InnoDB
</code>
, execute
this statement:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa91040654"><div class="copy-help left">Press ⌘+C to 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> <span class="token keyword"><em class="replaceable">table_name</em></span> <span class="token keyword">ENGINE</span> <span class="token operator">=</span> INNODB<span class="token punctuation">;</span></code></pre>
</div>
<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>
<p>
To make a partitioned table nonpartitioned, execute this
statement:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa89459261"><div class="copy-help left">Press ⌘+C to 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> <span class="token keyword"><em class="replaceable">table_name</em></span> <span class="token keyword">REMOVE</span> <span class="token keyword">PARTITIONING</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
Some keywords may be reserved in MySQL 8.4 that
were not reserved previously. See
<a class="xref" href="keywords.html" title="11.3 Keywords and Reserved Words">
Section 11.3, “Keywords and Reserved Words”
</a>
.
This can cause words previously used as identifiers to become
illegal. To fix affected statements, use identifier quoting.
See
<a class="xref" href="identifiers.html" title="11.2 Schema Object Names">
Section 11.2, “Schema Object Names”
</a>
.
</p>
</li>
<li class="listitem">
<p>
There must be no tables in the MySQL 8.3
<code class="literal">
mysql
</code>
system database that have the same
name as a table used by the MySQL 8.4 data
dictionary. To identify tables with those names, execute this
query:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa82936274"><div class="copy-help left">Press ⌘+C to 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> 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">TABLES</span>
<span class="token keyword">WHERE</span>
<span class="token function">LOWER</span><span class="token punctuation">(</span>TABLE_SCHEMA<span class="token punctuation">)</span> <span class="token operator">=</span> <span class="token string">'mysql'</span>
<span class="token operator">AND</span>
<span class="token function">LOWER</span><span class="token punctuation">(</span><span class="token keyword">TABLE_NAME</span><span class="token punctuation">)</span> <span class="token keyword">IN</span>
<span class="token punctuation">(</span>
<span class="token string">'catalogs'</span><span class="token punctuation">,</span>
<span class="token string">'character_sets'</span><span class="token punctuation">,</span>
<span class="token string">'check_constraints'</span><span class="token punctuation">,</span>
<span class="token string">'collations'</span><span class="token punctuation">,</span>
<span class="token string">'column_statistics'</span><span class="token punctuation">,</span>
<span class="token string">'column_type_elements'</span><span class="token punctuation">,</span>
<span class="token string">'columns'</span><span class="token punctuation">,</span>
<span class="token string">'dd_properties'</span><span class="token punctuation">,</span>
<span class="token string">'events'</span><span class="token punctuation">,</span>
<span class="token string">'foreign_key_column_usage'</span><span class="token punctuation">,</span>
<span class="token string">'foreign_keys'</span><span class="token punctuation">,</span>
<span class="token string">'index_column_usage'</span><span class="token punctuation">,</span>
<span class="token string">'index_partitions'</span><span class="token punctuation">,</span>
<span class="token string">'index_stats'</span><span class="token punctuation">,</span>
<span class="token string">'indexes'</span><span class="token punctuation">,</span>
<span class="token string">'parameter_type_elements'</span><span class="token punctuation">,</span>
<span class="token string">'parameters'</span><span class="token punctuation">,</span>
<span class="token string">'resource_groups'</span><span class="token punctuation">,</span>
<span class="token string">'routines'</span><span class="token punctuation">,</span>
<span class="token string">'schemata'</span><span class="token punctuation">,</span>
<span class="token string">'st_spatial_reference_systems'</span><span class="token punctuation">,</span>
<span class="token string">'table_partition_values'</span><span class="token punctuation">,</span>
<span class="token string">'table_partitions'</span><span class="token punctuation">,</span>
<span class="token string">'table_stats'</span><span class="token punctuation">,</span>
<span class="token string">'tables'</span><span class="token punctuation">,</span>
<span class="token string">'tablespace_files'</span><span class="token punctuation">,</span>
<span class="token string">'tablespaces'</span><span class="token punctuation">,</span>
<span class="token string">'triggers'</span><span class="token punctuation">,</span>
<span class="token string">'view_routine_usage'</span><span class="token punctuation">,</span>
<span class="token string">'view_table_usage'</span>
<span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Any tables reported by the query must be dropped or renamed
(use
<a class="link" href="rename-table.html" title="15.1.36 RENAME TABLE Statement">
<code class="literal">
RENAME TABLE
</code>
</a>
). This may
also entail changes to applications that use the affected
tables.
</p>
</li>
<li class="listitem">
<p>
There must be no tables that have foreign key constraint names
longer than 64 characters. Use this query to identify tables
with constraint names that are too long:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa45402852"><div class="copy-help left">Press ⌘+C to 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> 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">TABLES</span>
<span class="token keyword">WHERE</span> <span class="token keyword">TABLE_NAME</span> <span class="token keyword">IN</span>
<span class="token punctuation">(</span><span class="token keyword">SELECT</span> <span class="token function">LEFT</span><span class="token punctuation">(</span><span class="token function">SUBSTR</span><span class="token punctuation">(</span>ID<span class="token punctuation">,</span><span class="token function">INSTR</span><span class="token punctuation">(</span>ID<span class="token punctuation">,</span><span class="token string">'/'</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 punctuation">,</span>
<span class="token function">INSTR</span><span class="token punctuation">(</span><span class="token function">SUBSTR</span><span class="token punctuation">(</span>ID<span class="token punctuation">,</span><span class="token function">INSTR</span><span class="token punctuation">(</span>ID<span class="token punctuation">,</span><span class="token string">'/'</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 punctuation">,</span><span class="token string">'_ibfk_'</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 keyword">FROM</span> INFORMATION_SCHEMA<span class="token punctuation">.</span>INNODB_SYS_FOREIGN
<span class="token keyword">WHERE</span> <span class="token function">LENGTH</span><span class="token punctuation">(</span><span class="token function">SUBSTR</span><span class="token punctuation">(</span>ID<span class="token punctuation">,</span><span class="token function">INSTR</span><span class="token punctuation">(</span>ID<span class="token punctuation">,</span><span class="token string">'/'</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 punctuation">)</span><span class="token operator">></span><span class="token number">64</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
For a table with a constraint name that exceeds 64 characters,
drop the constraint and add it back with constraint name that
does not exceed 64 characters (use
<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>
There must be no obsolete SQL modes defined by
<a class="link" href="server-system-variables.html#sysvar_sql_mode">
<code class="literal">
sql_mode
</code>
</a>
system variable.
Attempting to use an obsolete SQL mode prevents MySQL
8.4 from starting. Applications that use obsolete
SQL modes should be revised to avoid them. For information
about SQL modes removed in MySQL 8.4, see
<a class="ulink" href="/doc/refman/8.0/en/upgrading-from-previous-series.html#upgrade-server-changes" target="_top">
Server Changes
</a>
.
</p>
</li>
<li class="listitem">
<p>
There must be no views with explicitly defined columns names
that exceed 64 characters (views with column names up to 255
characters were permitted in MySQL 5.7). To avoid upgrade
errors, such views should be altered before upgrading.
Currently, the only method of identify views with column names
that exceed 64 characters is to inspect the view definition
using
<a class="link" href="show-create-view.html" title="15.7.7.14 SHOW CREATE VIEW Statement">
<code class="literal">
SHOW CREATE VIEW
</code>
</a>
. You can
also inspect view definitions by querying the Information
Schema
<a class="link" href="information-schema-views-table.html" title="28.3.47 The INFORMATION_SCHEMA VIEWS Table">
<code class="literal">
VIEWS
</code>
</a>
table.
</p>
</li>
<li class="listitem">
<p>
There must be no tables or stored procedures with individual
<code class="literal">
ENUM
</code>
or
<code class="literal">
SET
</code>
column
elements that exceed 255 characters or 1020 bytes in length.
Prior to MySQL 8.4, the maximum combined length
of
<code class="literal">
ENUM
</code>
or
<code class="literal">
SET
</code>
column
elements was 64K. In MySQL 8.4, the maximum
character length of an individual
<code class="literal">
ENUM
</code>
or
<code class="literal">
SET
</code>
column element is 255 characters, and
the maximum byte length is 1020 bytes. (The 1020 byte limit
supports multibyte character sets). Before upgrading to MySQL
8.0, modify any
<code class="literal">
ENUM
</code>
or
<code class="literal">
SET
</code>
column elements that exceed the new
limits. Failing to do so causes the upgrade to fail with an
error.
</p>
</li>
<li class="listitem">
<p>
Your MySQL 8.3 installation must not use
features that are not supported by MySQL 8.4. Any
changes here are necessarily installation specific, but the
following example illustrates the kind of thing to look for:
</p>
<p>
Some server startup options and system variables have been
removed in MySQL 8.4. See
<a class="xref" href="mysql-nutshell.html#mysql-nutshell-removals" title="Features Removed in MySQL 8.4">
Features Removed in MySQL 8.4
</a>
, and
<a class="xref" href="added-deprecated-removed.html" title="1.5 Server and Status Variables and Options Added, Deprecated, or Removed in MySQL 8.4 since 8.0">
Section 1.5, “Server and Status Variables and Options Added, Deprecated, or Removed in
MySQL 8.4 since 8.0”
</a>
. If you use any of
these, an upgrade requires configuration changes.
</p>
</li>
<li class="listitem">
<p>
If you intend to change the
<a class="link" href="server-system-variables.html#sysvar_lower_case_table_names">
<code class="literal">
lower_case_table_names
</code>
</a>
setting to 1 at upgrade time, ensure that schema and table
names are lowercase before upgrading. Otherwise, a failure
could occur due to a schema or table name lettercase mismatch.
You can use the following queries to check for schema and
table names containing uppercase characters:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa56866208"><div class="copy-help left">Press ⌘+C to 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">TABLE_NAME</span><span class="token punctuation">,</span> <span class="token function">if</span><span class="token punctuation">(</span><span class="token function">sha</span><span class="token punctuation">(</span><span class="token keyword">TABLE_NAME</span><span class="token punctuation">)</span> <span class="token operator">!=</span><span class="token function">sha</span><span class="token punctuation">(</span><span class="token function">lower</span><span class="token punctuation">(</span><span class="token keyword">TABLE_NAME</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">,</span><span class="token string">'Yes'</span><span class="token punctuation">,</span><span class="token string">'No'</span><span class="token punctuation">)</span> <span class="token keyword">as</span> UpperCase <span class="token keyword">from</span> information_schema<span class="token punctuation">.</span><span class="token keyword">tables</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
If
<a class="link" href="server-system-variables.html#sysvar_lower_case_table_names">
<code class="literal">
lower_case_table_names=1
</code>
</a>
,
table and schema names are checked by the upgrade process to
ensure that all characters are lowercase. If table or schema
names are found to contain uppercase characters, the upgrade
process fails with an error.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
Changing the
<a class="link" href="server-system-variables.html#sysvar_lower_case_table_names">
<code class="literal">
lower_case_table_names
</code>
</a>
setting at upgrade time is not recommended.
</p>
</div>
</li>
</ol>
</div>
<p>
If upgrade to MySQL 8.4 fails due to any of the
issues outlined above, the server reverts all changes to the data
directory. In this case, remove all redo log files and restart the
MySQL 8.3 server on the existing data directory to
address the errors. The redo log files
(
<code class="filename">
ib_logfile*
</code>
) reside in the MySQL data
directory by default. After the errors are fixed, perform a slow
shutdown (by setting
<a class="link" href="innodb-parameters.html#sysvar_innodb_fast_shutdown">
<code class="literal">
innodb_fast_shutdown=0
</code>
</a>
) before
attempting the upgrade again.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/spatial-types.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title">
<a name="spatial-types">
</a>
13.4 Spatial Data Types
</h2>
</div>
</div>
</div>
<div class="toc">
<dl class="toc">
<dt>
<span class="section">
<a href="spatial-type-overview.html">
13.4.1 Spatial Data Types
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="opengis-geometry-model.html">
13.4.2 The OpenGIS Geometry Model
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="gis-data-formats.html">
13.4.3 Supported Spatial Data Formats
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="geometry-well-formedness-validity.html">
13.4.4 Geometry Well-Formedness and Validity
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="spatial-reference-systems.html">
13.4.5 Spatial Reference System Support
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="creating-spatial-columns.html">
13.4.6 Creating Spatial Columns
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="populating-spatial-columns.html">
13.4.7 Populating Spatial Columns
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="fetching-spatial-data.html">
13.4.8 Fetching Spatial Data
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="optimizing-spatial-analysis.html">
13.4.9 Optimizing Spatial Analysis
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="creating-spatial-indexes.html">
13.4.10 Creating Spatial Indexes
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="using-spatial-indexes.html">
13.4.11 Using Spatial Indexes
</a>
</span>
</dt>
</dl>
</div>
<a class="indexterm" name="idm46045212236240">
</a>
<a class="indexterm" name="idm46045212235168">
</a>
<a class="indexterm" name="idm46045212234080">
</a>
<a class="indexterm" name="idm46045212232992">
</a>
<a class="indexterm" name="idm46045212231920">
</a>
<a class="indexterm" name="idm46045212230832">
</a>
<p>
The
<a class="ulink" href="http://www.opengeospatial.org" target="_blank">
Open Geospatial
Consortium
</a>
(OGC) is an international consortium of more
than 250 companies, agencies, and universities participating in
the development of publicly available conceptual solutions that
can be useful with all kinds of applications that manage spatial
data.
</p>
<p>
The Open Geospatial Consortium publishes the
<em class="citetitle">
OpenGIS® Implementation Standard for Geographic
information - Simple feature access - Part 2: SQL
option
</em>
, a document that proposes several conceptual
ways for extending an SQL RDBMS to support spatial data. This
specification is available from the OGC website at
<a class="ulink" href="http://www.opengeospatial.org/standards/sfs" target="_blank">
http://www.opengeospatial.org/standards/sfs
</a>
.
</p>
<p>
Following the OGC specification, MySQL implements spatial
extensions as a subset of the
<span class="bold">
<strong>
SQL with
Geometry Types
</strong>
</span>
environment. This term refers to an SQL
environment that has been extended with a set of geometry types. A
geometry-valued SQL column is implemented as a column that has a
geometry type. The specification describes a set of SQL geometry
types, as well as functions on those types to create and analyze
geometry values.
</p>
<p>
MySQL spatial extensions enable the generation, storage, and
analysis of geographic features:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Data types for representing spatial values
</p>
</li>
<li class="listitem">
<p>
Functions for manipulating spatial values
</p>
</li>
<li class="listitem">
<p>
Spatial indexing for improved access times to spatial columns
</p>
</li>
</ul>
</div>
<p>
The spatial data types and functions are available for
<a class="link" href="myisam-storage-engine.html" title="18.2 The MyISAM Storage Engine">
<code class="literal">
MyISAM
</code>
</a>
,
<a class="link" href="innodb-storage-engine.html" title="Chapter 17 The InnoDB Storage Engine">
<code class="literal">
InnoDB
</code>
</a>
,
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
, and
<a class="link" href="archive-storage-engine.html" title="18.5 The ARCHIVE Storage Engine">
<code class="literal">
ARCHIVE
</code>
</a>
tables. For indexing spatial
columns,
<code class="literal">
MyISAM
</code>
and
<code class="literal">
InnoDB
</code>
support both
<code class="literal">
SPATIAL
</code>
and
non-
<code class="literal">
SPATIAL
</code>
indexes. The other storage engines
support non-
<code class="literal">
SPATIAL
</code>
indexes, as described in
<a class="xref" href="create-index.html" title="15.1.15 CREATE INDEX Statement">
Section 15.1.15, “CREATE INDEX Statement”
</a>
.
</p>
<a class="indexterm" name="idm46045212210464">
</a>
<p>
A
<span class="bold">
<strong>
geographic feature
</strong>
</span>
is anything
in the world that has a location. A feature can be:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
An entity. For example, a mountain, a pond, a city.
</p>
</li>
<li class="listitem">
<p>
A space. For example, town district, the tropics.
</p>
</li>
<li class="listitem">
<p>
A definable location. For example, a crossroad, as a
particular place where two streets intersect.
</p>
</li>
</ul>
</div>
<a class="indexterm" name="idm46045212205200">
</a>
<p>
Some documents use the term
<span class="bold">
<strong>
geospatial
feature
</strong>
</span>
to refer to geographic features.
</p>
<a class="indexterm" name="idm46045212202944">
</a>
<p>
<span class="bold">
<strong>
Geometry
</strong>
</span>
is another word that
denotes a geographic feature. Originally the word
<span class="bold">
<strong>
geometry
</strong>
</span>
meant measurement of the
earth. Another meaning comes from cartography, referring to the
geometric features that cartographers use to map the world.
</p>
<p>
The discussion here considers these terms synonymous:
<span class="bold">
<strong>
geographic feature
</strong>
</span>
,
<span class="bold">
<strong>
geospatial feature
</strong>
</span>
,
<span class="bold">
<strong>
feature
</strong>
</span>
, or
<span class="bold">
<strong>
geometry
</strong>
</span>
. The term most commonly
used is
<span class="bold">
<strong>
geometry
</strong>
</span>
, defined as
<span class="emphasis">
<em>
a point or an aggregate of points representing anything
in the world that has a location
</em>
</span>
.
</p>
<p>
The following material covers these topics:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
The spatial data types implemented in MySQL model
</p>
</li>
<li class="listitem">
<p>
The basis of the spatial extensions in the OpenGIS geometry
model
</p>
</li>
<li class="listitem">
<p>
Data formats for representing spatial data
</p>
</li>
<li class="listitem">
<p>
How to use spatial data in MySQL
</p>
</li>
<li class="listitem">
<p>
Use of indexing for spatial data
</p>
</li>
<li class="listitem">
<p>
MySQL differences from the OpenGIS specification
</p>
</li>
</ul>
</div>
<p>
For information about functions that operate on spatial data, see
<a class="xref" href="spatial-analysis-functions.html" title="14.16 Spatial Analysis Functions">
Section 14.16, “Spatial Analysis Functions”
</a>
.
</p>
<h3>
<a name="idm46045212187904">
</a>
Additional Resources
</h3>
<p>
These standards are important for the MySQL implementation of
spatial operations:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
SQL/MM Part 3: Spatial.
</p>
</li>
<li class="listitem">
<p>
The
<a class="ulink" href="http://www.opengeospatial.org" target="_blank">
Open Geospatial
Consortium
</a>
publishes the
<em class="citetitle">
OpenGIS®
Implementation Standard for Geographic
information
</em>
, a document that proposes several
conceptual ways for extending an SQL RDBMS to support spatial
data. See in particular Simple Feature Access - Part 1: Common
Architecture, and Simple Feature Access - Part 2: SQL Option.
The Open Geospatial Consortium (OGC) maintains a website at
<a class="ulink" href="http://www.opengeospatial.org/" target="_blank">
http://www.opengeospatial.org/
</a>
. The
specification is available there at
<a class="ulink" href="http://www.opengeospatial.org/standards/sfs" target="_blank">
http://www.opengeospatial.org/standards/sfs
</a>
. It
contains additional information relevant to the material here.
</p>
</li>
<li class="listitem">
<p>
The grammar for
<a class="link" href="spatial-reference-systems.html" title="13.4.5 Spatial Reference System Support">
spatial reference
system
</a>
(SRS) definitions is based on the grammar
defined in
<em class="citetitle">
OpenGIS Implementation Specification:
Coordinate Transformation Services
</em>
, Revision 1.00,
OGC 01-009, January 12, 2001, Section 7.2. This specification
is available at
<a class="ulink" href="http://www.opengeospatial.org/standards/ct" target="_blank">
http://www.opengeospatial.org/standards/ct
</a>
. For
differences from that specification in SRS definitions as
implemented in MySQL, see
<a class="xref" href="create-spatial-reference-system.html" title="15.1.19 CREATE SPATIAL REFERENCE SYSTEM Statement">
Section 15.1.19, “CREATE SPATIAL REFERENCE SYSTEM Statement”
</a>
.
</p>
</li>
</ul>
</div>
<p>
If you have questions or concerns about the use of the spatial
extensions to MySQL, you can discuss them in the GIS forum:
<a class="ulink" href="https://forums.mysql.com/list.php?23" target="_blank">
https://forums.mysql.com/list.php?23
</a>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/performance-schema-system-variable-tables.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="performance-schema-system-variable-tables">
</a>
29.12.14 Performance Schema System Variable Tables
</h3>
</div>
</div>
</div>
<div class="toc">
<dl class="toc">
<dt>
<span class="section">
<a href="performance-schema-persisted-variables-table.html">
29.12.14.1 Performance Schema persisted_variables Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="performance-schema-variables-info-table.html">
29.12.14.2 Performance Schema variables_info Table
</a>
</span>
</dt>
</dl>
</div>
<p>
The MySQL server maintains many system variables that indicate
how it is configured (see
<a class="xref" href="server-system-variables.html" title="7.1.8 Server System Variables">
Section 7.1.8, “Server System Variables”
</a>
). System variable
information is available in these Performance Schema tables:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="link" href="performance-schema-system-variable-tables.html" title="29.12.14 Performance Schema System Variable Tables">
<code class="literal">
global_variables
</code>
</a>
: Global system
variables. An application that wants only global values
should use this table.
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="performance-schema-system-variable-tables.html" title="29.12.14 Performance Schema System Variable Tables">
<code class="literal">
session_variables
</code>
</a>
: System
variables for the current session. An application that wants
all system variable values for its own session should use
this table. It includes the session variables for its
session, as well as the values of global variables that have
no session counterpart.
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="performance-schema-system-variable-tables.html" title="29.12.14 Performance Schema System Variable Tables">
<code class="literal">
variables_by_thread
</code>
</a>
: Session
system variables for each active session. An application
that wants to know the session variable values for specific
sessions should use this table. It includes session
variables only, identified by thread ID.
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="performance-schema-persisted-variables-table.html" title="29.12.14.1 Performance Schema persisted_variables Table">
<code class="literal">
persisted_variables
</code>
</a>
: Provides a
SQL interface to the
<code class="filename">
mysqld-auto.cnf
</code>
file that stores persisted global system variable settings.
See
<a class="xref" href="performance-schema-persisted-variables-table.html" title="29.12.14.1 Performance Schema persisted_variables Table">
Section 29.12.14.1, “Performance Schema persisted_variables Table”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="performance-schema-variables-info-table.html" title="29.12.14.2 Performance Schema variables_info Table">
<code class="literal">
variables_info
</code>
</a>
: Shows, for each
system variable, the source from which it was most recently
set, and its range of values. See
<a class="xref" href="performance-schema-variables-info-table.html" title="29.12.14.2 Performance Schema variables_info Table">
Section 29.12.14.2, “Performance Schema variables_info Table”
</a>
.
</p>
</li>
</ul>
</div>
<p>
The
<a class="link" href="privileges-provided.html#priv_sensitive-variables-observer">
<code class="literal">
SENSITIVE_VARIABLES_OBSERVER
</code>
</a>
privilege is required to view the values of sensitive system
variables in these tables.
</p>
<p>
The session variable tables
(
<a class="link" href="performance-schema-system-variable-tables.html" title="29.12.14 Performance Schema System Variable Tables">
<code class="literal">
session_variables
</code>
</a>
,
<a class="link" href="performance-schema-system-variable-tables.html" title="29.12.14 Performance Schema System Variable Tables">
<code class="literal">
variables_by_thread
</code>
</a>
) contain
information only for active sessions, not terminated sessions.
</p>
<p>
The
<a class="link" href="performance-schema-system-variable-tables.html" title="29.12.14 Performance Schema System Variable Tables">
<code class="literal">
global_variables
</code>
</a>
and
<a class="link" href="performance-schema-system-variable-tables.html" title="29.12.14 Performance Schema System Variable Tables">
<code class="literal">
session_variables
</code>
</a>
tables have these
columns:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
VARIABLE_NAME
</code>
</p>
<p>
The system variable name.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
VARIABLE_VALUE
</code>
</p>
<p>
The system variable value. For
<a class="link" href="performance-schema-system-variable-tables.html" title="29.12.14 Performance Schema System Variable Tables">
<code class="literal">
global_variables
</code>
</a>
, this column
contains the global value. For
<a class="link" href="performance-schema-system-variable-tables.html" title="29.12.14 Performance Schema System Variable Tables">
<code class="literal">
session_variables
</code>
</a>
, this column
contains the variable value in effect for the current
session.
</p>
</li>
</ul>
</div>
<p>
The
<a class="link" href="performance-schema-system-variable-tables.html" title="29.12.14 Performance Schema System Variable Tables">
<code class="literal">
global_variables
</code>
</a>
and
<a class="link" href="performance-schema-system-variable-tables.html" title="29.12.14 Performance Schema System Variable Tables">
<code class="literal">
session_variables
</code>
</a>
tables have these
indexes:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Primary key on (
<code class="literal">
VARIABLE_NAME
</code>
)
</p>
</li>
</ul>
</div>
<p>
The
<a class="link" href="performance-schema-system-variable-tables.html" title="29.12.14 Performance Schema System Variable Tables">
<code class="literal">
variables_by_thread
</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">
THREAD_ID
</code>
</p>
<p>
The thread identifier of the session in which the system
variable is defined.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
VARIABLE_NAME
</code>
</p>
<p>
The system variable name.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
VARIABLE_VALUE
</code>
</p>
<p>
The session variable value for the session named by the
<code class="literal">
THREAD_ID
</code>
column.
</p>
</li>
</ul>
</div>
<p>
The
<a class="link" href="performance-schema-system-variable-tables.html" title="29.12.14 Performance Schema System Variable Tables">
<code class="literal">
variables_by_thread
</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">
THREAD_ID
</code>
,
<code class="literal">
VARIABLE_NAME
</code>
)
</p>
</li>
</ul>
</div>
<p>
The
<a class="link" href="performance-schema-system-variable-tables.html" title="29.12.14 Performance Schema System Variable Tables">
<code class="literal">
variables_by_thread
</code>
</a>
table
contains system variable information only about foreground
threads. If not all threads are instrumented by the Performance
Schema, this table misses some rows. In this case, the
<a class="link" href="performance-schema-status-variables.html#statvar_Performance_schema_thread_instances_lost">
<code class="literal">
Performance_schema_thread_instances_lost
</code>
</a>
status variable is greater than zero.
</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 supported
for Performance Schema system variable tables.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/mysql-cluster-online-operations.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="mysql-cluster-online-operations">
</a>
25.6.12 Online Operations with ALTER TABLE in NDB Cluster
</h3>
</div>
</div>
</div>
<p>
MySQL NDB Cluster supports online table schema changes using
<a class="link" href="alter-table.html#alter-table-performance" title="Performance and Space Requirements">
<code class="literal">
ALTER
TABLE ... ALGORITHM=DEFAULT|INPLACE|COPY
</code>
</a>
. NDB Cluster
handles
<code class="literal">
COPY
</code>
and
<code class="literal">
INPLACE
</code>
as
described in the next few paragraphs.
</p>
<p>
For
<code class="literal">
ALGORITHM=COPY
</code>
, the
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
NDB Cluster handler performs the
following actions:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Tells the data nodes to create an empty copy of the table, and
to make the required schema changes to this copy.
</p>
</li>
<li class="listitem">
<p>
Reads rows from the original table, and writes them to the
copy.
</p>
</li>
<li class="listitem">
<p>
Tells the data nodes to drop the original table and then to
rename the copy.
</p>
</li>
</ul>
</div>
<p>
We sometimes refer to this as a
<span class="quote">
“
<span class="quote">
copying
</span>
”
</span>
or
<span class="quote">
“
<span class="quote">
offline
</span>
”
</span>
<code class="literal">
ALTER TABLE
</code>
.
</p>
<p>
DML operations are not permitted concurrently with a copying
<code class="literal">
ALTER TABLE
</code>
.
</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>
on which the copying
<code class="literal">
ALTER
TABLE
</code>
statement is issued takes a metadata lock, but
this is in effect only on that
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
. Other
<code class="literal">
NDB
</code>
clients can modify row data during a
copying
<code class="literal">
ALTER TABLE
</code>
, resulting in
inconsistency.
</p>
<p>
For
<code class="literal">
ALGORITHM=INPLACE
</code>
, the NDB Cluster handler
tells the data nodes to make the required changes, and does not
perform any copying of data.
</p>
<p>
We also refer to this as a
<span class="quote">
“
<span class="quote">
non-copying
</span>
”
</span>
or
<span class="quote">
“
<span class="quote">
online
</span>
”
</span>
<code class="literal">
ALTER TABLE
</code>
.
</p>
<p>
A non-copying
<code class="literal">
ALTER TABLE
</code>
allows concurrent DML
operations.
</p>
<p>
<code class="literal">
ALGORITHM=INSTANT
</code>
is not supported by NDB
8.4.
</p>
<p>
Regardless of the algorithm used, the
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
takes a Global Schema Lock (GSL) while executing
<span class="command">
<strong>
ALTER
TABLE
</strong>
</span>
; this prevents execution of any (other) DDL or
backups concurrently on this or any other SQL node in the cluster.
This is normally not problematic, unless the
<code class="literal">
ALTER
TABLE
</code>
takes a very long time.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
Some older releases of NDB Cluster used a syntax specific to
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
for online
<code class="literal">
ALTER
TABLE
</code>
operations. That syntax has since been removed.
</p>
</div>
<p>
Operations that add and drop indexes on variable-width columns of
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
tables occur online. Online
operations are noncopying; that is, they do not require that
indexes be re-created. They do not lock the table being altered
from access by other API nodes in an NDB Cluster (but see
<a class="xref" href="mysql-cluster-online-operations.html#mysql-cluster-online-limitations" title="Limitations of NDB online operations">
Limitations of NDB online operations
</a>
, later in this
section). Such operations do not require single user mode for
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
table alterations made in an NDB
cluster with multiple API nodes; transactions can continue
uninterrupted during online DDL operations.
</p>
<p>
<code class="literal">
ALGORITHM=INPLACE
</code>
can be used to perform online
<code class="literal">
ADD COLUMN
</code>
,
<code class="literal">
ADD INDEX
</code>
(including
<code class="literal">
CREATE INDEX
</code>
statements), and
<code class="literal">
DROP INDEX
</code>
operations on
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
tables. Online renaming of
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
tables is also supported.
</p>
<p>
Disk-based columns cannot be added to
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
tables online. This means that,
if you wish to add an in-memory column to an
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
table that uses a table-level
<code class="literal">
STORAGE DISK
</code>
option, you must declare the new
column as using memory-based storage explicitly. For
example—assuming that you have already created tablespace
<code class="literal">
ts1
</code>
—suppose that you create table
<code class="literal">
t1
</code>
as follows:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa39953081"><div class="copy-help left">Press ⌘+C to 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>
<span class="token operator">></span> c1 <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 operator">></span> c2 <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 operator">></span> <span class="token punctuation">)</span>
<span class="token operator">></span> <span class="token keyword">TABLESPACE</span> ts1 <span class="token keyword">STORAGE</span> <span class="token keyword">DISK</span>
<span class="token operator">></span> <span class="token keyword">ENGINE</span> <span class="token keyword">NDB</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 0 rows affected (1.73 sec)</span>
<span class="token output">Records: 0 Duplicates: 0 Warnings: 0</span></code></pre>
</div>
<p>
You can add a new in-memory column to this table online as shown
here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa74169948"><div class="copy-help left">Press ⌘+C to 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> t1
<span class="token operator">></span> <span class="token keyword">ADD</span> <span class="token keyword">COLUMN</span> c3 <span class="token datatype">INT</span> <span class="token keyword">COLUMN_FORMAT</span> <span class="token keyword">DYNAMIC</span> <span class="token keyword">STORAGE</span> <span class="token keyword">MEMORY</span><span class="token punctuation">,</span>
<span class="token operator">></span> <span class="token keyword">ALGORITHM</span><span class="token operator">=</span><span class="token keyword">INPLACE</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 0 rows affected (1.25 sec)</span>
<span class="token output">Records: 0 Duplicates: 0 Warnings: 0</span></code></pre>
</div>
<p>
This statement fails if the
<code class="literal">
STORAGE MEMORY
</code>
option is omitted:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa83381785"><div class="copy-help left">Press ⌘+C to 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> t1
<span class="token operator">></span> <span class="token keyword">ADD</span> <span class="token keyword">COLUMN</span> c4 <span class="token datatype">INT</span> <span class="token keyword">COLUMN_FORMAT</span> <span class="token keyword">DYNAMIC</span><span class="token punctuation">,</span>
<span class="token operator">></span> <span class="token keyword">ALGORITHM</span><span class="token operator">=</span><span class="token keyword">INPLACE</span><span class="token punctuation">;</span>
<span class="token output">ERROR 1846 (0A000)<span class="token punctuation">:</span> ALGORITHM=INPLACE is not supported. Reason<span class="token punctuation">:</span>
Adding column(s) or add/reorganize partition not supported online. Try
ALGORITHM=COPY.</span></code></pre>
</div>
<p>
If you omit the
<code class="literal">
COLUMN_FORMAT DYNAMIC
</code>
option,
the dynamic column format is employed automatically, but a warning
is issued, as shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa28085521"><div class="copy-help left">Press ⌘+C to 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> ONLINE <span class="token keyword">TABLE</span> t1 <span class="token keyword">ADD</span> <span class="token keyword">COLUMN</span> c4 <span class="token datatype">INT</span> <span class="token keyword">STORAGE</span> <span class="token keyword">MEMORY</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 0 rows affected, 1 warning (1.17 sec)</span>
<span class="token output">Records: 0 Duplicates: 0 Warnings: 0</span>
<span class="token prompt">mysql></span> <span class="token keyword">SHOW</span> <span class="token keyword">WARNINGS</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>
Level<span class="token punctuation">:</span> Warning
Code<span class="token punctuation">:</span> 1478
Message<span class="token punctuation">:</span> DYNAMIC column c4 with STORAGE DISK is not supported, column will
become FIXED
</span>
<span class="token prompt">mysql></span> <span class="token keyword">SHOW</span> <span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> t1\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>
Table<span class="token punctuation">:</span> t1
Create Table<span class="token punctuation">:</span> CREATE TABLE `t1` (
`c1` int(11) NOT NULL,
`c2` varchar(30) DEFAULT NULL,
`c3` int(11) /<span class="token punctuation">*</span>!50606 STORAGE MEMORY <span class="token punctuation">*</span>/ /<span class="token punctuation">*</span>!50606 COLUMN_FORMAT DYNAMIC <span class="token punctuation">*</span>/ DEFAULT NULL,
`c4` int(11) /<span class="token punctuation">*</span>!50606 STORAGE MEMORY <span class="token punctuation">*</span>/ DEFAULT NULL,
PRIMARY KEY (`c1`)
) /<span class="token punctuation">*</span>!50606 TABLESPACE ts_1 STORAGE DISK <span class="token punctuation">*</span>/ ENGINE=ndbcluster DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
</span><span class="token output">1 row in set (0.03 sec)</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">
STORAGE
</code>
and
<code class="literal">
COLUMN_FORMAT
</code>
keywords are supported only in
NDB Cluster; in any other version of MySQL, attempting to use
either of these keywords in a
<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>
statement results in an error.
</p>
</div>
<p>
It is also possible to use the statement
<code class="literal">
ALTER TABLE ...
REORGANIZE PARTITION, ALGORITHM=INPLACE
</code>
with no
<code class="literal">
<em class="replaceable">
<code>
partition_names
</code>
</em>
INTO
(
<em class="replaceable">
<code>
partition_definitions
</code>
</em>
)
</code>
option on
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
tables. This can be
used to redistribute NDB Cluster data among new data nodes that
have been added to the cluster online. This does
<span class="emphasis">
<em>
not
</em>
</span>
perform any defragmentation, which
requires an
<a class="link" href="optimize-table.html" title="15.7.3.4 OPTIMIZE TABLE Statement">
<code class="literal">
OPTIMIZE TABLE
</code>
</a>
or null
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER TABLE
</code>
</a>
statement. For more
information, see
<a class="xref" href="mysql-cluster-online-add-node.html" title="25.6.7 Adding NDB Cluster Data Nodes Online">
Section 25.6.7, “Adding NDB Cluster Data Nodes Online”
</a>
.
</p>
<h4>
<a name="mysql-cluster-online-limitations">
</a>
Limitations of NDB online operations
</h4>
<p>
Online
<code class="literal">
DROP COLUMN
</code>
operations are not
supported.
</p>
<p>
Online
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER TABLE
</code>
</a>
,
<a class="link" href="create-index.html" title="15.1.15 CREATE INDEX Statement">
<code class="literal">
CREATE INDEX
</code>
</a>
, or
<a class="link" href="drop-index.html" title="15.1.27 DROP INDEX Statement">
<code class="literal">
DROP INDEX
</code>
</a>
statements that add
columns or add or drop indexes are subject to the following
limitations:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
A given online
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER TABLE
</code>
</a>
can
use only one of
<code class="literal">
ADD COLUMN
</code>
,
<code class="literal">
ADD
INDEX
</code>
, or
<code class="literal">
DROP INDEX
</code>
. One or more
columns can be added online in a single statement; only one
index may be created or dropped online in a single statement.
</p>
</li>
<li class="listitem">
<p>
The table being altered is not locked with respect to API
nodes other than the one on which an online
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER TABLE
</code>
</a>
<code class="literal">
ADD
COLUMN
</code>
,
<code class="literal">
ADD INDEX
</code>
, or
<code class="literal">
DROP INDEX
</code>
operation (or
<a class="link" href="create-index.html" title="15.1.15 CREATE INDEX Statement">
<code class="literal">
CREATE INDEX
</code>
</a>
or
<a class="link" href="drop-index.html" title="15.1.27 DROP INDEX Statement">
<code class="literal">
DROP INDEX
</code>
</a>
statement) is run.
However, the table is locked against any other operations
originating on the
<span class="emphasis">
<em>
same
</em>
</span>
API node while
the online operation is being executed.
</p>
</li>
<li class="listitem">
<p>
The table to be altered must have an explicit primary key; the
hidden primary key created by 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 not
sufficient for this purpose.
</p>
</li>
<li class="listitem">
<p>
The storage engine used by the table cannot be changed online.
</p>
</li>
<li class="listitem">
<p>
The tablespace used by the table cannot be changed online.
Statements such as
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER TABLE
<em class="replaceable">
<code>
ndb_table
</code>
</em>
... ALGORITHM=INPLACE,
TABLESPACE=
<em class="replaceable">
<code>
new_tablespace
</code>
</em>
</code>
</a>
are specifically disallowed.
</p>
</li>
<li class="listitem">
<p>
When used with NDB Cluster Disk Data tables, it is not
possible to change the storage type (
<code class="literal">
DISK
</code>
or
<code class="literal">
MEMORY
</code>
) of a column online. This means,
that when you add or drop an index in such a way that the
operation would be performed online, and you want the storage
type of the column or columns to be changed, you must use
<code class="literal">
ALGORITHM=COPY
</code>
in the statement that adds
or drops the index.
</p>
</li>
</ul>
</div>
<p>
Columns to be added online cannot use the
<a class="link" href="blob.html" title="13.3.4 The BLOB and TEXT Types">
<code class="literal">
BLOB
</code>
</a>
or
<a class="link" href="blob.html" title="13.3.4 The BLOB and TEXT Types">
<code class="literal">
TEXT
</code>
</a>
type, and must meet the
following criteria:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
The columns must be dynamic; that is, it must be possible to
create them using
<code class="literal">
COLUMN_FORMAT DYNAMIC
</code>
. If
you omit the
<code class="literal">
COLUMN_FORMAT DYNAMIC
</code>
option,
the dynamic column format is employed automatically.
</p>
</li>
<li class="listitem">
<p>
The columns must permit
<code class="literal">
NULL
</code>
values and not
have any explicit default value other than
<code class="literal">
NULL
</code>
. Columns added online are
automatically created as
<code class="literal">
DEFAULT NULL
</code>
, as
can be seen here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa79710977"><div class="copy-help left">Press ⌘+C to 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>
<span class="token operator">></span> c1 <span class="token datatype">INT</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span> <span class="token keyword">AUTO_INCREMENT</span> <span class="token keyword">PRIMARY</span> <span class="token keyword">KEY</span>
<span class="token operator">></span> <span class="token punctuation">)</span> <span class="token keyword">ENGINE</span><span class="token operator">=</span><span class="token keyword">NDB</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 0 rows affected (1.44 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">ALTER</span> <span class="token keyword">TABLE</span> t2
<span class="token operator">></span> <span class="token keyword">ADD</span> <span class="token keyword">COLUMN</span> c2 <span class="token datatype">INT</span><span class="token punctuation">,</span>
<span class="token operator">></span> <span class="token keyword">ADD</span> <span class="token keyword">COLUMN</span> c3 <span class="token datatype">INT</span><span class="token punctuation">,</span>
<span class="token operator">></span> <span class="token keyword">ALGORITHM</span><span class="token operator">=</span><span class="token keyword">INPLACE</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 0 rows affected, 2 warnings (0.93 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">SHOW</span> <span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> t1\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>
Table<span class="token punctuation">:</span> t1
Create Table<span class="token punctuation">:</span> CREATE TABLE `t2` (
`c1` int(11) NOT NULL AUTO_INCREMENT,
`c2` int(11) DEFAULT NULL,
`c3` int(11) DEFAULT NULL,
PRIMARY KEY (`c1`)
) ENGINE=ndbcluster DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
</span><span class="token output">1 row in set (0.00 sec)</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
The columns must be added following any existing columns. If
you attempt to add a column online before any existing columns
or using the
<code class="literal">
FIRST
</code>
keyword, the statement
fails with an error.
</p>
</li>
<li class="listitem">
<p>
Existing table columns cannot be reordered online.
</p>
</li>
</ul>
</div>
<p>
For online
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER TABLE
</code>
</a>
operations
on
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
tables, fixed-format columns
are converted to dynamic when they are added online, or when
indexes are created or dropped online, as shown here (repeating
the
<code class="literal">
CREATE TABLE
</code>
and
<code class="literal">
ALTER
TABLE
</code>
statements just shown for the sake of clarity):
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa36053430"><div class="copy-help left">Press ⌘+C to 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>
<span class="token operator">></span> c1 <span class="token datatype">INT</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span> <span class="token keyword">AUTO_INCREMENT</span> <span class="token keyword">PRIMARY</span> <span class="token keyword">KEY</span>
<span class="token operator">></span> <span class="token punctuation">)</span> <span class="token keyword">ENGINE</span><span class="token operator">=</span><span class="token keyword">NDB</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 0 rows affected (1.44 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">ALTER</span> <span class="token keyword">TABLE</span> t2
<span class="token operator">></span> <span class="token keyword">ADD</span> <span class="token keyword">COLUMN</span> c2 <span class="token datatype">INT</span><span class="token punctuation">,</span>
<span class="token operator">></span> <span class="token keyword">ADD</span> <span class="token keyword">COLUMN</span> c3 <span class="token datatype">INT</span><span class="token punctuation">,</span>
<span class="token operator">></span> <span class="token keyword">ALGORITHM</span><span class="token operator">=</span><span class="token keyword">INPLACE</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 0 rows affected, 2 warnings (0.93 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> Warning
Code<span class="token punctuation">:</span> 1478
Message<span class="token punctuation">:</span> Converted FIXED field 'c2' to DYNAMIC to enable online ADD COLUMN
<span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span 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>
Level<span class="token punctuation">:</span> Warning
Code<span class="token punctuation">:</span> 1478
Message<span class="token punctuation">:</span> Converted FIXED field 'c3' to DYNAMIC to enable online ADD COLUMN
</span><span class="token output">2 rows in set (0.00 sec)</span></code></pre>
</div>
<p>
Only the column or columns to be added online must be dynamic.
Existing columns need not be; this includes the table's
primary key, which may also be
<code class="literal">
FIXED
</code>
, as shown
here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa93538708"><div class="copy-help left">Press ⌘+C to 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>
<span class="token operator">></span> c1 <span class="token datatype">INT</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span> <span class="token keyword">AUTO_INCREMENT</span> <span class="token keyword">PRIMARY</span> <span class="token keyword">KEY</span> <span class="token keyword">COLUMN_FORMAT</span> <span class="token keyword">FIXED</span>
<span class="token operator">></span> <span class="token punctuation">)</span> <span class="token keyword">ENGINE</span><span class="token operator">=</span><span class="token keyword">NDB</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 0 rows affected (2.10 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">ALTER</span> <span class="token keyword">TABLE</span> t3 <span class="token keyword">ADD</span> <span class="token keyword">COLUMN</span> c2 <span class="token datatype">INT</span><span class="token punctuation">,</span> <span class="token keyword">ALGORITHM</span><span class="token operator">=</span><span class="token keyword">INPLACE</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 0 rows affected, 1 warning (0.78 sec)</span>
<span class="token output">Records: 0 Duplicates: 0 Warnings: 0</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> Warning
Code<span class="token punctuation">:</span> 1478
Message<span class="token punctuation">:</span> Converted FIXED field 'c2' to DYNAMIC to enable online ADD COLUMN
</span><span class="token output">1 row in set (0.00 sec)</span></code></pre>
</div>
<p>
Columns are not converted from
<code class="literal">
FIXED
</code>
to
<code class="literal">
DYNAMIC
</code>
column format by renaming operations.
For more information about
<code class="literal">
COLUMN_FORMAT
</code>
, see
<a class="xref" href="create-table.html" title="15.1.20 CREATE TABLE Statement">
Section 15.1.20, “CREATE TABLE Statement”
</a>
.
</p>
<p>
The
<code class="literal">
KEY
</code>
,
<code class="literal">
CONSTRAINT
</code>
, and
<code class="literal">
IGNORE
</code>
keywords are supported in
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER TABLE
</code>
</a>
statements using
<code class="literal">
ALGORITHM=INPLACE
</code>
.
</p>
<p>
Setting
<code class="literal">
MAX_ROWS
</code>
to 0 using an online
<code class="literal">
ALTER TABLE
</code>
statement is disallowed. You must
use a copying
<code class="literal">
ALTER TABLE
</code>
to perform this
operation. (Bug #21960004)
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/federated-storage-engine-resources.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="federated-storage-engine-resources">
</a>
18.8.4 FEDERATED Storage Engine Resources
</h3>
</div>
</div>
</div>
<p>
The following additional resources are available for the
<code class="literal">
FEDERATED
</code>
storage engine:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
A forum dedicated to the
<code class="literal">
FEDERATED
</code>
storage
engine is available at
<a class="ulink" href="https://forums.mysql.com/list.php?105" target="_blank">
https://forums.mysql.com/list.php?105
</a>
.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/sys-statements-with-sorting.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="sys-statements-with-sorting">
</a>
30.4.3.39 The statements_with_sorting and x$statements_with_sorting Views
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045062050016">
</a>
<a class="indexterm" name="idm46045062048560">
</a>
<a class="indexterm" name="idm46045062047056">
</a>
<a class="indexterm" name="idm46045062045552">
</a>
<p>
These views list normalized statements that have performed
sorts. By default, rows are sorted by descending total
latency.
</p>
<p>
The
<a class="link" href="sys-statements-with-sorting.html" title="30.4.3.39 The statements_with_sorting and x$statements_with_sorting Views">
<code class="literal">
statements_with_sorting
</code>
</a>
and
<a class="link" href="sys-statements-with-sorting.html" title="30.4.3.39 The statements_with_sorting and x$statements_with_sorting Views">
<code class="literal">
x$statements_with_sorting
</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">
query
</code>
</p>
<p>
The normalized statement string.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
db
</code>
</p>
<p>
The default database for the statement, or
<code class="literal">
NULL
</code>
if there is none.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
exec_count
</code>
</p>
<p>
The total number of times the statement has executed.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
total_latency
</code>
</p>
<p>
The total wait time of timed occurrences of the statement.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
sort_merge_passes
</code>
</p>
<p>
The total number of sort merge passes by occurrences of
the statement.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
avg_sort_merges
</code>
</p>
<p>
The average number of sort merge passes per occurrence of
the statement.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
sorts_using_scans
</code>
</p>
<p>
The total number of sorts using table scans by occurrences
of the statement.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
sort_using_range
</code>
</p>
<p>
The total number of sorts using range accesses by
occurrences of the statement.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
rows_sorted
</code>
</p>
<p>
The total number of rows sorted by occurrences of the
statement.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
avg_rows_sorted
</code>
</p>
<p>
The average number of rows sorted per occurrence of the
statement.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
first_seen
</code>
</p>
<p>
The time at which the statement was first seen.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
last_seen
</code>
</p>
<p>
The time at which the statement was most recently seen.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
digest
</code>
</p>
<p>
The statement digest.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/innodb-disk-management.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title">
<a name="innodb-disk-management">
</a>
17.11 InnoDB Disk I/O and File Space Management
</h2>
</div>
</div>
</div>
<div class="toc">
<dl class="toc">
<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>
</div>
<p>
As a DBA, you must manage disk I/O to keep the I/O subsystem from
becoming saturated, and manage disk space to avoid filling up
storage devices. The
<a class="link" href="glossary.html#glos_acid" title="ACID">
ACID
</a>
design
model requires a certain amount of I/O that might seem redundant,
but helps to ensure data reliability. Within these constraints,
<code class="literal">
InnoDB
</code>
tries to optimize the database work and
the organization of disk files to minimize the amount of disk I/O.
Sometimes, I/O is postponed until the database is not busy, or until
everything needs to be brought to a consistent state, such as during
a database restart after a
<a class="link" href="glossary.html#glos_fast_shutdown" title="fast shutdown">
fast
shutdown
</a>
.
</p>
<p>
This section discusses the main considerations for I/O and disk
space with the default kind of MySQL tables (also known as
<code class="literal">
InnoDB
</code>
tables):
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Controlling the amount of background I/O used to improve query
performance.
</p>
</li>
<li class="listitem">
<p>
Enabling or disabling features that provide extra durability at
the expense of additional I/O.
</p>
</li>
<li class="listitem">
<p>
Organizing tables into many small files, a few larger files, or
a combination of both.
</p>
</li>
<li class="listitem">
<p>
Balancing the size of redo log files against the I/O activity
that occurs when the log files become full.
</p>
</li>
<li class="listitem">
<p>
How to reorganize a table for optimal query performance.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/except.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="except">
</a>
15.2.4 EXCEPT Clause
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045182787168">
</a>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa30434592"><div class="copy-help left">Press ⌘+C to 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">query_expression_body</em> <span class="token keyword">EXCEPT</span> <span class="token punctuation">[</span><span class="token keyword">ALL</span> <span class="token operator">|</span> <span class="token keyword">DISTINCT</span><span class="token punctuation">]</span> <em class="replaceable">query_expression_body</em>
<span class="token punctuation">[</span><span class="token keyword">EXCEPT</span> <span class="token punctuation">[</span><span class="token keyword">ALL</span> <span class="token operator">|</span> <span class="token keyword">DISTINCT</span><span class="token punctuation">]</span> <em class="replaceable">query_expression_body</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>
<em class="replaceable">query_expression_body</em>:
<em>See Section <span class="token number">15.2</span><span class="token punctuation">.</span><span class="token number">14</span><span class="token punctuation">,</span> “<span class="token keyword">Set</span> Operations <span class="token keyword">with</span> <span class="token keyword">UNION</span><span class="token punctuation">,</span> <span class="token keyword">INTERSECT</span><span class="token punctuation">,</span> <span class="token operator">and</span> <span class="token keyword">EXCEPT</span>”</em></code></pre>
</div>
<p>
<a class="link" href="except.html" title="15.2.4 EXCEPT Clause">
<code class="literal">
EXCEPT
</code>
</a>
limits the result from the
first query block to those rows which are (also) not found in the
second. As with
<a class="link" href="union.html" title="15.2.18 UNION Clause">
<code class="literal">
UNION
</code>
</a>
and
<a class="link" href="intersect.html" title="15.2.8 INTERSECT Clause">
<code class="literal">
INTERSECT
</code>
</a>
, either query block can
make use of any of
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
,
<a class="link" href="table.html" title="15.2.16 TABLE Statement">
<code class="literal">
TABLE
</code>
</a>
, or
<a class="link" href="values.html" title="15.2.19 VALUES Statement">
<code class="literal">
VALUES
</code>
</a>
. An example using the tables
<code class="literal">
a
</code>
,
<code class="literal">
b
</code>
, and
<code class="literal">
c
</code>
defined in
<a class="xref" href="intersect.html" title="15.2.8 INTERSECT Clause">
Section 15.2.8, “INTERSECT Clause”
</a>
, is
shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa93283549"><div class="copy-help left">Press ⌘+C to 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">TABLE</span> a <span class="token keyword">EXCEPT</span> <span class="token keyword">TABLE</span> b<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>
<span class="token output"><span class="token punctuation">|</span> m <span class="token punctuation">|</span> n <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>
<span class="token output"><span class="token punctuation">|</span> 2 <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>
<span class="token output">1 row in set (0.00 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">TABLE</span> a <span class="token keyword">EXCEPT</span> <span class="token keyword">TABLE</span> c<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>
<span class="token output"><span class="token punctuation">|</span> m <span class="token punctuation">|</span> n <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>
<span class="token output"><span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> 2 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 2 <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>
<span class="token output">2 rows in set (0.00 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">TABLE</span> b <span class="token keyword">EXCEPT</span> <span class="token keyword">TABLE</span> c<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>
<span class="token output"><span class="token punctuation">|</span> m <span class="token punctuation">|</span> n <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>
<span class="token output"><span class="token punctuation">|</span> 1 <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>
<span class="token output">1 row in set (0.00 sec)</span></code></pre>
</div>
<p>
As with
<a class="link" href="union.html" title="15.2.18 UNION Clause">
<code class="literal">
UNION
</code>
</a>
and
<a class="link" href="intersect.html" title="15.2.8 INTERSECT Clause">
<code class="literal">
INTERSECT
</code>
</a>
, if neither
<code class="literal">
DISTINCT
</code>
nor
<code class="literal">
ALL
</code>
is
specified, the default is
<code class="literal">
DISTINCT
</code>
.
</p>
<p>
<code class="literal">
DISTINCT
</code>
removes duplicates found on either
side of the relation, as shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa1368316"><div class="copy-help left">Press ⌘+C to 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">TABLE</span> c <span class="token keyword">EXCEPT</span> <span class="token keyword">DISTINCT</span> <span class="token keyword">TABLE</span> a<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>
<span class="token output"><span class="token punctuation">|</span> m <span class="token punctuation">|</span> n <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>
<span class="token output"><span class="token punctuation">|</span> 1 <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>
<span class="token output">1 row in set (0.00 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">TABLE</span> c <span class="token keyword">EXCEPT</span> <span class="token keyword">ALL</span> <span class="token keyword">TABLE</span> a<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>
<span class="token output"><span class="token punctuation">|</span> m <span class="token punctuation">|</span> n <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>
<span class="token output"><span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> 3 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 1 <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>
<span class="token output">2 rows in set (0.00 sec)</span></code></pre>
</div>
<p>
(The first statement has the same effect as
<code class="literal">
TABLE c
EXCEPT TABLE a
</code>
.)
</p>
<p>
Unlike
<code class="literal">
UNION
</code>
or
<code class="literal">
INTERSECT
</code>
,
<code class="literal">
EXCEPT
</code>
is
<span class="emphasis">
<em>
not
</em>
</span>
commutative—that is, the result depends on the order of the
operands, as shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa87194911"><div class="copy-help left">Press ⌘+C to 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">TABLE</span> a <span class="token keyword">EXCEPT</span> <span class="token keyword">TABLE</span> c<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>
<span class="token output"><span class="token punctuation">|</span> m <span class="token punctuation">|</span> n <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>
<span class="token output"><span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> 2 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 2 <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>
<span class="token output">2 rows in set (0.00 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">TABLE</span> c <span class="token keyword">EXCEPT</span> <span class="token keyword">TABLE</span> a<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>
<span class="token output"><span class="token punctuation">|</span> m <span class="token punctuation">|</span> n <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>
<span class="token output"><span class="token punctuation">|</span> 1 <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>
<span class="token output">1 row in set (0.00 sec)</span></code></pre>
</div>
<p>
As with
<code class="literal">
UNION
</code>
, the result sets to be compared
must have the same number of columns. Result set column types are
also determined as for
<code class="literal">
UNION
</code>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/innodb-create-table-external.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="innodb-create-table-external">
</a>
17.6.1.2 Creating Tables Externally
</h4>
</div>
</div>
</div>
<p>
There are different reasons for creating
<code class="literal">
InnoDB
</code>
tables externally; that is, creating tables outside of the data
directory. Those reasons might include space management, I/O
optimization, or placing tables on a storage device with
particular performance or capacity characteristics, for example.
</p>
<p>
<code class="literal">
InnoDB
</code>
supports the following methods for
creating tables externally:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="xref" href="innodb-create-table-external.html#innodb-create-table-external-data-directory" title="Using the DATA DIRECTORY Clause">
Using the DATA DIRECTORY Clause
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="innodb-create-table-external.html#innodb-create-table-external-tablespace-syntax" title="Using CREATE TABLE ... TABLESPACE Syntax">
Using CREATE TABLE ... TABLESPACE Syntax
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="innodb-create-table-external.html#innodb-create-table-external-tablespace" title="Creating a Table in an External General Tablespace">
Creating a Table in an External General Tablespace
</a>
</p>
</li>
</ul>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="innodb-create-table-external-data-directory">
</a>
Using the DATA DIRECTORY Clause
</h5>
</div>
</div>
</div>
<p>
You can create an
<code class="literal">
InnoDB
</code>
table in an external
directory by specifying a
<code class="literal">
DATA DIRECTORY
</code>
clause in the
<code class="literal">
CREATE TABLE
</code>
statement.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa81652656"><div class="copy-help left">Press ⌘+C to 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 keyword">PRIMARY</span> <span class="token keyword">KEY</span><span class="token punctuation">)</span> <span class="token keyword">DATA</span> <span class="token keyword">DIRECTORY</span> <span class="token operator">=</span> <span class="token string">'<em class="replaceable">/external/directory</em>'</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
The
<code class="literal">
DATA DIRECTORY
</code>
clause is supported for
tables created in file-per-table tablespaces. Tables are
implicitly created in file-per-table tablespaces when the
<a class="link" href="innodb-parameters.html#sysvar_innodb_file_per_table">
<code class="literal">
innodb_file_per_table
</code>
</a>
variable
is enabled, which it is by default.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa40542121"><div class="copy-help left">Press ⌘+C to 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 variable">@@innodb_file_per_table</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> @@innodb_file_per_table <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> 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>
For more information about file-per-table tablespaces, see
<a class="xref" href="innodb-file-per-table-tablespaces.html" title="17.6.3.2 File-Per-Table Tablespaces">
Section 17.6.3.2, “File-Per-Table Tablespaces”
</a>
.
</p>
<p>
When you specify a
<code class="literal">
DATA DIRECTORY
</code>
clause in a
<code class="literal">
CREATE TABLE
</code>
statement, the table's data file
(
<code class="filename">
<em class="replaceable">
<code>
table_name
</code>
</em>
.ibd
</code>
)
is created in a schema directory under the specified directory.
</p>
<p>
Tables and table partitions created outside of the data
directory using the
<code class="literal">
DATA DIRECTORY
</code>
clause are
restricted to directories known to
<code class="literal">
InnoDB
</code>
.
This requirement permits database administrators to control
where tablespace data files are created and ensures that data
files can be found during recovery (see
<a class="xref" href="innodb-recovery.html#innodb-recovery-tablespace-discovery" title="Tablespace Discovery During Crash Recovery">
Tablespace Discovery During Crash Recovery
</a>
). 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.
You can use the following statement to check those settings:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa8674343"><div class="copy-help left">Press ⌘+C to 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 variable">@@datadir</span><span class="token punctuation">,</span><span class="token variable">@@innodb_data_home_dir</span><span class="token punctuation">,</span><span class="token variable">@@innodb_directories</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
If the directory you want to use is unknown, add it to the
<a class="link" href="innodb-parameters.html#sysvar_innodb_directories">
<code class="literal">
innodb_directories
</code>
</a>
setting
before you create the table. The
<a class="link" href="innodb-parameters.html#sysvar_innodb_directories">
<code class="literal">
innodb_directories
</code>
</a>
variable is
read-only. Configuring it requires restarting the server. For
general information about setting system variables, see
<a class="xref" href="using-system-variables.html" title="7.1.9 Using System Variables">
Section 7.1.9, “Using System Variables”
</a>
.
</p>
<p>
The following example demonstrates creating a table in an
external directory using the
<code class="literal">
DATA DIRECTORY
</code>
clause. It is assumed that the
<a class="link" href="innodb-parameters.html#sysvar_innodb_file_per_table">
<code class="literal">
innodb_file_per_table
</code>
</a>
variable
is enabled and that the directory is known to
<code class="literal">
InnoDB
</code>
.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa55194128"><div class="copy-help left">Press ⌘+C to 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">USE</span> test<span class="token punctuation">;</span>
<span class="token keyword">Database</span> <span class="token keyword">changed</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">INT</span> <span class="token keyword">PRIMARY</span> <span class="token keyword">KEY</span><span class="token punctuation">)</span> <span class="token keyword">DATA</span> <span class="token keyword">DIRECTORY</span> <span class="token operator">=</span> <span class="token string">'<em class="replaceable">/external/directory</em>'</span><span class="token punctuation">;</span>
<span class="token comment" spellcheck="true"># MySQL creates the table's data file in a schema directory</span>
<span class="token comment" spellcheck="true"># under the external directory</span>
$<span class="token operator">></span> cd <span class="token operator">/</span>external<span class="token operator">/</span><span class="token keyword">directory</span><span class="token operator">/</span>test
$<span class="token operator">></span> ls
t1<span class="token punctuation">.</span>ibd</code></pre>
</div>
<h6>
<a name="idm46045166764688">
</a>
Usage Notes:
</h6>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
MySQL initially holds the tablespace data file open,
preventing you from dismounting the device, but might
eventually close the file if the server is busy. Be careful
not to accidentally dismount an external device while MySQL
is running, or start MySQL while the device is disconnected.
Attempting to access a table when the associated data file
is missing causes a serious error that requires a server
restart.
</p>
<p>
A server restart might fail if the data file is not found at
the expected path. In this case, you can restore the
tablespace data file from a backup or drop the table to
remove the information about it from the
<a class="link" href="glossary.html#glos_data_dictionary" title="data dictionary">
data dictionary
</a>
.
</p>
</li>
<li class="listitem">
<p>
Before placing a table on an NFS-mounted volume, 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>
<li class="listitem">
<p>
If using an LVM snapshot, file copy, or other file-based
mechanism to back up the table's data file, always use the
<a class="link" href="flush.html#flush-tables-for-export-with-list">
<code class="literal">
FLUSH
TABLES ... FOR EXPORT
</code>
</a>
statement first to ensure
that all changes buffered in memory are
<a class="link" href="glossary.html#glos_flush" title="flush">
flushed
</a>
to disk before the
backup occurs.
</p>
</li>
<li class="listitem">
<p>
Using the
<code class="literal">
DATA DIRECTORY
</code>
clause to create
a table in an external directory is an alternative to using
<a class="link" href="symbolic-links.html" title="10.12.2 Using Symbolic Links">
symbolic links
</a>
, which
<code class="literal">
InnoDB
</code>
does not support.
</p>
</li>
<li class="listitem">
<p>
The
<code class="literal">
DATA DIRECTORY
</code>
clause is not
supported in a replication environment where the source and
replica reside on the same host. The
<code class="literal">
DATA
DIRECTORY
</code>
clause requires a full directory path.
Replicating the path in this case would cause the source and
replica to create the table in same location.
</p>
</li>
<li class="listitem">
<p>
Tables created in file-per-table tablespaces cannot be
created in the undo tablespace directory
(
<a class="link" href="innodb-parameters.html#sysvar_innodb_undo_directory">
<code class="literal">
innodb_undo_directory
</code>
</a>
)
unless that directly is known to
<code class="literal">
InnoDB
</code>
.
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.
</p>
</li>
</ul>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="innodb-create-table-external-tablespace-syntax">
</a>
Using CREATE TABLE ... TABLESPACE Syntax
</h5>
</div>
</div>
</div>
<p>
<a class="link" href="create-table.html" title="15.1.20 CREATE TABLE Statement">
<code class="literal">
CREATE TABLE ...
TABLESPACE
</code>
</a>
syntax can be used in combination with the
<code class="literal">
DATA DIRECTORY
</code>
clause to create a table in an
external directory. To do so, specify
<code class="literal">
innodb_file_per_table
</code>
as the tablespace name.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa74236038"><div class="copy-help left">Press ⌘+C to 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">INT</span> <span class="token keyword">PRIMARY</span> <span class="token keyword">KEY</span><span class="token punctuation">)</span> <span class="token keyword">TABLESPACE</span> <span class="token operator">=</span> innodb_file_per_table
<span class="token keyword">DATA</span> <span class="token keyword">DIRECTORY</span> <span class="token operator">=</span> <span class="token string">'/external/directory'</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
This method is supported only for tables created in
file-per-table tablespaces, but does not require the
<a class="link" href="innodb-parameters.html#sysvar_innodb_file_per_table">
<code class="literal">
innodb_file_per_table
</code>
</a>
variable
to be enabled. In all other respects, this method is equivalent
to the
<code class="literal">
CREATE TABLE ... DATA DIRECTORY
</code>
method
described above. The same usage notes apply.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="innodb-create-table-external-tablespace">
</a>
Creating a Table in an External General Tablespace
</h5>
</div>
</div>
</div>
<p>
You can create a table in a general tablespace that resides in
an external directory.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
For information about creating a general tablespace in an
external directory, see
<a class="xref" href="general-tablespaces.html#general-tablespaces-creating" title="Creating a General Tablespace">
Creating a General Tablespace
</a>
.
</p>
</li>
<li class="listitem">
<p>
For information about creating a table in a general
tablespace, see
<a class="xref" href="general-tablespaces.html#general-tablespaces-adding-tables" title="Adding Tables to a General Tablespace">
Adding Tables to a General Tablespace
</a>
.
</p>
</li>
</ul>
</div>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/show-procedure-code.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="show-procedure-code">
</a>
15.7.7.29 SHOW PROCEDURE CODE Statement
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045169989248">
</a>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa91650641"><div class="copy-help left">Press ⌘+C to 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 keyword">PROCEDURE</span> <span class="token keyword">CODE</span> <em class="replaceable">proc_name</em></code></pre>
</div>
<p>
This statement is a MySQL extension that is available only for
servers that have been built with debugging support. It displays
a representation of the internal implementation of the named
stored procedure. A similar statement,
<a class="link" href="show-function-code.html" title="15.7.7.20 SHOW FUNCTION CODE Statement">
<code class="literal">
SHOW
FUNCTION CODE
</code>
</a>
, displays information about stored
functions (see
<a class="xref" href="show-function-code.html" title="15.7.7.20 SHOW FUNCTION CODE Statement">
Section 15.7.7.20, “SHOW FUNCTION CODE Statement”
</a>
).
</p>
<p>
To use either statement, you must be the user named as the
routine
<code class="literal">
DEFINER
</code>
, have the
<a class="link" href="privileges-provided.html#priv_show-routine">
<code class="literal">
SHOW_ROUTINE
</code>
</a>
privilege, or have
the
<a class="link" href="privileges-provided.html#priv_select">
<code class="literal">
SELECT
</code>
</a>
privilege at the
global level.
</p>
<p>
If the named routine is available, each statement produces a
result set. Each row in the result set corresponds to one
<span class="quote">
“
<span class="quote">
instruction
</span>
”
</span>
in the routine. The first column is
<code class="literal">
Pos
</code>
, which is an ordinal number beginning
with 0. The second column is
<code class="literal">
Instruction
</code>
,
which contains an SQL statement (usually changed from the
original source), or a directive which has meaning only to the
stored-routine handler.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa83816071"><div class="copy-help left">Press ⌘+C to 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> p1 <span class="token punctuation">(</span><span class="token punctuation">)</span>
<span class="token keyword">BEGIN</span>
<span class="token keyword">DECLARE</span> fanta <span class="token datatype">INT</span> <span class="token keyword">DEFAULT</span> <span class="token number">55</span><span class="token punctuation">;</span>
<span class="token keyword">DROP</span> <span class="token keyword">TABLE</span> t2<span class="token punctuation">;</span>
<span class="token keyword">LOOP</span>
<span class="token keyword">INSERT</span> <span class="token keyword">INTO</span> t3 <span class="token keyword">VALUES</span> <span class="token punctuation">(</span>fanta<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">END</span> <span class="token keyword">LOOP</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.01 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">SHOW</span> <span class="token keyword">PROCEDURE</span> <span class="token keyword">CODE</span> p1<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 class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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> Pos <span class="token punctuation">|</span> Instruction <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>
<span class="token output"><span class="token punctuation">|</span> 0 <span class="token punctuation">|</span> set fanta@0 55 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> stmt 9 "DROP TABLE t2" <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 2 <span class="token punctuation">|</span> stmt 5 "INSERT INTO t3 VALUES (fanta)" <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 3 <span class="token punctuation">|</span> jump 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>
<span class="token output">4 rows in set (0.00 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">CREATE</span> <span class="token keyword">FUNCTION</span> test<span class="token punctuation">.</span>hello <span class="token punctuation">(</span>s <span class="token datatype">CHAR</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">RETURNS</span> <span class="token datatype">CHAR</span><span class="token punctuation">(</span><span class="token number">50</span><span class="token punctuation">)</span> <span class="token keyword">DETERMINISTIC</span>
<span class="token keyword">RETURN</span> <span class="token function">CONCAT</span><span class="token punctuation">(</span><span class="token string">'Hello, '</span><span class="token punctuation">,</span>s<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, 0 rows affected (0.00 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">SHOW</span> <span class="token keyword">FUNCTION</span> <span class="token keyword">CODE</span> test<span class="token punctuation">.</span>hello<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>
<span class="token output"><span class="token punctuation">|</span> Pos <span class="token punctuation">|</span> Instruction <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>
<span class="token output"><span class="token punctuation">|</span> 0 <span class="token punctuation">|</span> freturn 254 concat('Hello, ',s@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>
<span class="token output">1 row in set (0.00 sec)</span></code></pre>
</div>
<p>
In this example, the nonexecutable
<code class="literal">
BEGIN
</code>
and
<code class="literal">
END
</code>
statements have disappeared, and for the
<code class="literal">
DECLARE
<em class="replaceable">
<code>
variable_name
</code>
</em>
</code>
statement,
only the executable part appears (the part where the default is
assigned). For each statement that is taken from source, there
is a code word
<code class="literal">
stmt
</code>
followed by a type (9
means
<code class="literal">
DROP
</code>
, 5 means
<a class="link" href="insert.html" title="15.2.7 INSERT Statement">
<code class="literal">
INSERT
</code>
</a>
, and so on). The final row
contains an instruction
<code class="literal">
jump 2
</code>
, meaning
<code class="literal">
GOTO instruction #2
</code>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/sys-ps-setup-reset-to-default.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="sys-ps-setup-reset-to-default">
</a>
30.4.4.13 The ps_setup_reset_to_default() Procedure
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045061416880">
</a>
<a class="indexterm" name="idm46045061415424">
</a>
<p>
Resets the Performance Schema configuration to its default
settings.
</p>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="sys-ps-setup-reset-to-default-parameters">
</a>
Parameters
</h5>
</div>
</div>
</div>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
in_verbose BOOLEAN
</code>
: Whether to
display information about each setup stage during
procedure execution. This includes the SQL statements
executed.
</p>
</li>
</ul>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="sys-ps-setup-reset-to-default-example">
</a>
Example
</h5>
</div>
</div>
</div>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa83356933"><div class="copy-help left">Press ⌘+C to 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">CALL</span> sys<span class="token punctuation">.</span>ps_setup_reset_to_default<span class="token punctuation">(</span><span class="token boolean">TRUE</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>
status<span class="token punctuation">:</span> Resetting<span class="token punctuation">:</span> setup_actors
DELETE
FROM performance_schema.setup_actors
WHERE NOT (HOST = '%' AND USER = '%' AND ROLE = '%')
<span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span 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>
status<span class="token punctuation">:</span> Resetting<span class="token punctuation">:</span> setup_actors
INSERT IGNORE INTO performance_schema.setup_actors
VALUES ('%', '%', '%')
...</span></code></pre>
</div>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/binary-log-transaction-compression.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="binary-log-transaction-compression">
</a>
7.4.4.5 Binary Log Transaction Compression
</h4>
</div>
</div>
</div>
<p>
MySQL supports binary log transaction compression; when this is
enabled, transaction payloads are compressed using the
<code class="literal">
zstd
</code>
algorithm, and then written to the
server's binary log file as a single event (a
<code class="literal">
Transaction_payload_event
</code>
).
</p>
<p>
Compressed transaction payloads remain in a compressed state
while they are sent in the replication stream to replicas, other
Group Replication group members, or clients such as
<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>
. They are not decompressed by
receiver threads, and are written to the relay log still in
their compressed state. Binary log transaction compression
therefore saves storage space both on the originator of the
transaction and on the recipient (and for their backups), and
saves network bandwidth when the transactions are sent between
server instances.
</p>
<p>
Compressed transaction payloads are decompressed when the
individual events contained in them need to be inspected. For
example, the
<code class="literal">
Transaction_payload_event
</code>
is
decompressed by an applier thread in order to apply the events
it contains on the recipient. Decompression is also carried out
during recovery, by
<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>
when
replaying transactions, and by the
<a class="link" href="show-binlog-events.html" title="15.7.7.3 SHOW BINLOG EVENTS Statement">
<code class="literal">
SHOW
BINLOG EVENTS
</code>
</a>
and
<a class="link" href="show-relaylog-events.html" title="15.7.7.34 SHOW RELAYLOG EVENTS Statement">
<code class="literal">
SHOW RELAYLOG
EVENTS
</code>
</a>
statements.
</p>
<p>
You can enable binary log transaction compression on a MySQL
server instance using the
<a class="link" href="replication-options-binary-log.html#sysvar_binlog_transaction_compression">
<code class="literal">
binlog_transaction_compression
</code>
</a>
system variable, which defaults to
<code class="literal">
OFF
</code>
. You
can also use the
<a class="link" href="replication-options-binary-log.html#sysvar_binlog_transaction_compression_level_zstd">
<code class="literal">
binlog_transaction_compression_level_zstd
</code>
</a>
system variable to set the level for the zstd algorithm that is
used for compression. This value determines the compression
effort, from 1 (the lowest effort) to 22 (the highest effort).
As the compression level increases, the compression ratio
increases, which reduces the storage space and network bandwidth
required for the transaction payload. However, the effort
required for data compression also increases, taking time and
CPU and memory resources on the originating server. Increases in
the compression effort do not have a linear relationship to
increases in the compression ratio.
</p>
<p>
Setting
<a class="link" href="replication-options-binary-log.html#sysvar_binlog_transaction_compression">
<code class="literal">
binlog_transaction_compression
</code>
</a>
or
<a class="link" href="replication-options-binary-log.html#sysvar_binlog_transaction_compression_level_zstd">
<code class="literal">
binlog_transaction_compression_level_zstd
</code>
</a>
(or both) has no immediate effect but rather applies to all
subsequent
<a class="link" href="start-replica.html" title="15.4.2.4 START REPLICA Statement">
<code class="literal">
START REPLICA
</code>
</a>
statements.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
You can enable binary logging of compressed transactions for
tables using the
<code class="literal">
NDB
</code>
storage engine at run
time using the
<a class="link" href="mysql-cluster-options-variables.html#sysvar_ndb_log_transaction_compression">
<code class="literal">
ndb_log_transaction_compression
</code>
</a>
system variable, and control the level of compression using
<a class="link" href="mysql-cluster-options-variables.html#sysvar_ndb_log_transaction_compression_level_zstd">
<code class="literal">
ndb_log_transaction_compression_level_zstd
</code>
</a>
.
Starting
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
with
<code class="option">
--binlog-transaction-compression
</code>
on the
command line or in a
<code class="filename">
my.cnf
</code>
file causes
<code class="literal">
ndb_log_transaction_compression
</code>
to be
enabled automatically and any setting for the
<code class="option">
--ndb-log-transaction-compression
</code>
option to
be ignored; to disable binary log transaction compression for
the
<code class="literal">
NDB
</code>
storage engine
<span class="emphasis">
<em>
only
</em>
</span>
, set
<code class="literal">
ndb_log_transaction_compression=OFF
</code>
in a
client session after starting
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
.
</p>
</div>
<p>
The following types of event are excluded from binary log
transaction compression, so are always written uncompressed to
the binary log:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Events relating to the GTID for the transaction (including
anonymous GTID events).
</p>
</li>
<li class="listitem">
<p>
Other types of control event, such as view change events and
heartbeat events.
</p>
</li>
<li class="listitem">
<p>
Incident events and the whole of any transactions that
contain them.
</p>
</li>
<li class="listitem">
<p>
Non-transactional events and the whole of any transactions
that contain them. A transaction involving a mix of
non-transactional and transactional storage engines does not
have its payload compressed.
</p>
</li>
<li class="listitem">
<p>
Events that are logged using statement-based binary logging.
Binary log transaction compression is only applied for the
row-based binary logging format.
</p>
</li>
</ul>
</div>
<p>
Binary log encryption can be used on binary log files that
contain compressed transactions.
</p>
<div class="section">
<div class="titlepage">
<div>
<div>
<h5 class="title">
<a name="binary-log-transaction-compression-enabled">
</a>
7.4.4.5.1 Behaviors When Binary Log Transaction Compression is Enabled
</h5>
</div>
</div>
</div>
<p>
Transactions with payloads that are compressed can be rolled
back like any other transaction, and they can also be filtered
out on a replica by the usual filtering options. Binary log
transaction compression can be applied to XA transactions.
</p>
<p>
When binary log transaction compression is enabled, the
<a class="link" href="server-system-variables.html#sysvar_max_allowed_packet">
<code class="literal">
max_allowed_packet
</code>
</a>
and
<a class="link" href="replication-options-replica.html#sysvar_replica_max_allowed_packet">
<code class="literal">
replica_max_allowed_packet
</code>
</a>
limits for the server still apply, and are measured on the
compressed size of the
<code class="literal">
Transaction_payload_event
</code>
, plus the bytes
used for the event header.
</p>
<div class="important" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Important
</div>
<p>
Compressed transaction payloads are sent as a single packet,
rather than each event of the transaction being sent in an
individual packet, as is the case when binary log
transaction compression is not in use. If your replication
topology handles large transactions, be aware that a large
transaction which can be replicated successfully when binary
log transaction compression is not in use, might stop
replication due to its size when binary log transaction
compression is in use.
</p>
</div>
<p>
For multithreaded workers, each transaction (including its
GTID event and
<code class="literal">
Transaction_payload_event
</code>
)
is assigned to a worker thread. The worker thread decompresses
the transaction payload and applies the individual events in
it one by one. If an error is found applying any event within
the
<code class="literal">
Transaction_payload_event
</code>
, the complete
transaction is reported to the co-ordinator as having failed.
When
<a class="link" href="replication-options-replica.html#sysvar_replica_parallel_type">
<code class="literal">
replica_parallel_type
</code>
</a>
or
<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">
DATABASE
</code>
, all the databases affected by
the transaction are mapped before the transaction is
scheduled. The use of binary log transaction compression with
the
<code class="literal">
DATABASE
</code>
policy can reduce parallelism
compared to uncompressed transactions, which are mapped and
scheduled for each event.
</p>
<p>
For semisynchronous replication (see
<a class="xref" href="replication-semisync.html" title="19.4.10 Semisynchronous Replication">
Section 19.4.10, “Semisynchronous Replication”
</a>
), the replica
acknowledges the transaction when the complete
<code class="literal">
Transaction_payload_event
</code>
has been
received.
</p>
<p>
When binary log checksums are enabled (which is the default),
the replication source server does not write checksums for
individual events in a compressed transaction payload.
Instead, a checksum is written for the complete
<code class="literal">
Transaction_payload_event
</code>
, and individual
checksums are written for any events that were not compressed,
such as events relating to GTIDs.
</p>
<p>
For the
<a class="link" href="show-binlog-events.html" title="15.7.7.3 SHOW BINLOG EVENTS Statement">
<code class="literal">
SHOW BINLOG EVENTS
</code>
</a>
and
<a class="link" href="show-relaylog-events.html" title="15.7.7.34 SHOW RELAYLOG EVENTS Statement">
<code class="literal">
SHOW RELAYLOG EVENTS
</code>
</a>
statements, the
<code class="literal">
Transaction_payload_event
</code>
is first printed as a single unit, then it is unpacked and
each event inside it is printed.
</p>
<p>
For operations that reference the end position of an event,
such as
<a class="link" href="start-replica.html" title="15.4.2.4 START REPLICA Statement">
<code class="literal">
START
REPLICA
</code>
</a>
with the
<code class="literal">
UNTIL
</code>
clause,
<a class="link" href="replication-functions-synchronization.html#function_source-pos-wait">
<code class="literal">
SOURCE_POS_WAIT()
</code>
</a>
, and
<a class="link" href="replication-options-replica.html#sysvar_sql_replica_skip_counter">
<code class="literal">
sql_replica_skip_counter
</code>
</a>
, you
must specify the end position of the compressed transaction
payload (the
<code class="literal">
Transaction_payload_event
</code>
).
When skipping events using
<a class="link" href="replication-options-replica.html#sysvar_sql_replica_skip_counter">
<code class="literal">
sql_replica_skip_counter
</code>
</a>
, a
compressed transaction payload is counted as a single counter
value, so all the events inside it are skipped as a unit.
</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h5 class="title">
<a name="binary-log-transaction-compression-uncompressed">
</a>
7.4.4.5.2 Combining Compressed and Uncompressed Transaction Payloads
</h5>
</div>
</div>
</div>
<p>
MySQL Server releases that support binary log transaction
compression can handle a mix of compressed and uncompressed
transaction payloads.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
The system variables relating to binary log transaction
compression do not need to be set the same on all Group
Replication group members, and are not replicated from
sources to replicas in a replication topology. You can
decide whether or not binary log transaction compression
is appropriate for each MySQL Server instance that has a
binary log.
</p>
</li>
<li class="listitem">
<p>
If transaction compression is enabled then disabled on a
server, compression is not applied to future transactions
originated on that server, but transaction payloads that
have been compressed can still be handled and displayed.
</p>
</li>
<li class="listitem">
<p>
If transaction compression is specified for individual
sessions by setting the session value of
<a class="link" href="replication-options-binary-log.html#sysvar_binlog_transaction_compression">
<code class="literal">
binlog_transaction_compression
</code>
</a>
,
the binary log can contain a mix of compressed and
uncompressed transaction payloads.
</p>
</li>
</ul>
</div>
<p>
When a source in a replication topology and its replica both
have binary log transaction compression enabled, the replica
receives compressed transaction payloads and writes them
compressed to its relay log. It decompresses the transaction
payloads to apply the transactions, and then compresses them
again after applying for writing to its binary log. Any
downstream replicas receive the compressed transaction
payloads.
</p>
<p>
When a source in a replication topology has binary log
transaction compression enabled but its replica does not, the
replica receives compressed transaction payloads and writes
them compressed to its relay log. It decompresses the
transaction payloads to apply the transactions, and then
writes them uncompressed to its own binary log, if it has one.
Any downstream replicas receive the uncompressed transaction
payloads.
</p>
<p>
When a source in a replication topology does not have binary
log transaction compression enabled but its replica does, if
the replica has a binary log, it compresses the transaction
payloads after applying them, and writes the compressed
transaction payloads to its binary log. Any downstream
replicas receive the compressed transaction payloads.
</p>
<p>
When a MySQL server instance has no binary log, it can
receive, handle, and display compressed transaction payloads
regardless of its value for
<a class="link" href="replication-options-binary-log.html#sysvar_binlog_transaction_compression">
<code class="literal">
binlog_transaction_compression
</code>
</a>
.
Compressed transaction payloads received by such server
instances are written in their compressed state to the relay
log, so they benefit indirectly from compression that was
carried out by other servers in the replication topology.
</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h5 class="title">
<a name="binary-log-transaction-compression-monitoring">
</a>
7.4.4.5.3 Monitoring Binary Log Transaction Compression
</h5>
</div>
</div>
</div>
<p>
You can monitor the effects of binary log transaction
compression using the Performance Schema table
<a class="link" href="performance-schema-binary-log-transaction-compression-stats-table.html" title="29.12.11.1 The binary_log_transaction_compression_stats Table">
<code class="literal">
binary_log_transaction_compression_stats
</code>
</a>
.
The statistics include the data compression ratio for the
monitored period, and you can also view the effect of
compression on the last transaction on the server. You can
reset the statistics by truncating the table. Statistics for
binary logs and relay logs are split out so you can see the
impact of compression for each log type. The MySQL server
instance must have a binary log to produce these statistics.
</p>
<p>
The Performance Schema table
<a class="link" href="performance-schema-events-stages-current-table.html" title="29.12.5.1 The events_stages_current Table">
<code class="literal">
events_stages_current
</code>
</a>
shows when
a transaction is in the stage of decompression or compression
for its transaction payload, and displays its progress for
this stage. Compression is carried out by the worker thread
handling the transaction, just before the transaction is
committed, provided that there are no events in the finalized
capture cache that exclude the transaction from binary log
transaction compression (for example, incident events). When
decompression is required, it is carried out for one event
from the payload at a time.
</p>
<p>
<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>
with the
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_verbose">
<code class="option">
--verbose
</code>
</a>
option includes
comments stating the compressed size and the uncompressed size
for compressed transaction payloads, and the compression
algorithm that was used.
</p>
<p>
You can enable connection compression at the protocol level
for replication connections, using the
<code class="literal">
SOURCE_COMPRESSION_ALGORITHMS
</code>
and
<code class="literal">
SOURCE_ZSTD_COMPRESSION_LEVEL
</code>
options of
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, or the
<a class="link" href="replication-options-replica.html#sysvar_replica_compressed_protocol">
<code class="literal">
replica_compressed_protocol
</code>
</a>
system variable. If you enable binary log transaction
compression in a system where connection compression is also
enabled, the impact of connection compression is reduced, as
there might be little opportunity to further compress the
compressed transaction payloads. However, connection
compression can still operate on uncompressed events and on
message headers. Binary log transaction compression can be
enabled in combination with connection compression if you need
to save storage space as well as network bandwidth. For more
information on connection compression for replication
connections, 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>
<p>
For Group Replication, compression is enabled by default for
messages that exceed the threshold set by the
<a class="link" href="group-replication-system-variables.html#sysvar_group_replication_compression_threshold">
<code class="literal">
group_replication_compression_threshold
</code>
</a>
system variable. You can also configure compression for
messages sent for distributed recovery by the method of state
transfer from a donor's binary log, using the
<a class="link" href="group-replication-system-variables.html#sysvar_group_replication_recovery_compression_algorithms">
<code class="literal">
group_replication_recovery_compression_algorithms
</code>
</a>
and
<a class="link" href="group-replication-system-variables.html#sysvar_group_replication_recovery_zstd_compression_level">
<code class="literal">
group_replication_recovery_zstd_compression_level
</code>
</a>
system variables. If you enable binary log transaction
compression in a system where these are configured, Group
Replication's message compression can still operate on
uncompressed events and on message headers, but its impact is
reduced. For more information on message compression for Group
Replication, see
<a class="xref" href="group-replication-message-compression.html" title="20.7.4 Message Compression">
Section 20.7.4, “Message Compression”
</a>
.
</p>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/mysql-cluster-programs-ndb-blob-tool.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="mysql-cluster-programs-ndb-blob-tool">
</a>
25.5.6 ndb_blob_tool — Check and Repair BLOB and TEXT columns of NDB Cluster
Tables
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045105979200">
</a>
<p>
This tool can be used to check for and remove orphaned BLOB
column parts from
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
tables, as
well as to generate a file listing any orphaned parts. It is
sometimes useful in diagnosing and repairing corrupted or
damaged
<code class="literal">
NDB
</code>
tables containing
<a class="link" href="blob.html" title="13.3.4 The BLOB and TEXT Types">
<code class="literal">
BLOB
</code>
</a>
or
<a class="link" href="blob.html" title="13.3.4 The BLOB and TEXT Types">
<code class="literal">
TEXT
</code>
</a>
columns.
</p>
<p>
The basic syntax for
<a class="link" href="mysql-cluster-programs-ndb-blob-tool.html" title="25.5.6 ndb_blob_tool — Check and Repair BLOB and TEXT columns of NDB Cluster Tables">
<span class="command">
<strong>
ndb_blob_tool
</strong>
</span>
</a>
is shown
here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-simple"><div class="docs-select-all right" id="sa88010659"><div class="copy-help left">Press ⌘+C to 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">ndb_blob_tool <span class="token punctuation">[</span><em class="replaceable">options</em><span class="token punctuation">]</span> <em class="replaceable">table</em> <span class="token punctuation">[</span><em class="replaceable">column</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></code></pre>
</div>
<p>
Unless you use the
<a class="link" href="mysql-cluster-programs-ndb-blob-tool.html#option_ndb_blob_tool_help">
<code class="option">
--help
</code>
</a>
option, you must specify an action to be performed by including
one or more of the options
<a class="link" href="mysql-cluster-programs-ndb-blob-tool.html#option_ndb_blob_tool_check-orphans">
<code class="option">
--check-orphans
</code>
</a>
,
<a class="link" href="mysql-cluster-programs-ndb-blob-tool.html#option_ndb_blob_tool_delete-orphans">
<code class="option">
--delete-orphans
</code>
</a>
, or
<a class="link" href="mysql-cluster-programs-ndb-blob-tool.html#option_ndb_blob_tool_dump-file">
<code class="option">
--dump-file
</code>
</a>
. These options
cause
<a class="link" href="mysql-cluster-programs-ndb-blob-tool.html" title="25.5.6 ndb_blob_tool — Check and Repair BLOB and TEXT columns of NDB Cluster Tables">
<span class="command">
<strong>
ndb_blob_tool
</strong>
</span>
</a>
to check for orphaned
BLOB parts, remove any orphaned BLOB parts, and generate a dump
file listing orphaned BLOB parts, respectively, and are
described in more detail later in this section.
</p>
<p>
You must also specify the name of a table when invoking
<a class="link" href="mysql-cluster-programs-ndb-blob-tool.html" title="25.5.6 ndb_blob_tool — Check and Repair BLOB and TEXT columns of NDB Cluster Tables">
<span class="command">
<strong>
ndb_blob_tool
</strong>
</span>
</a>
. In addition, you can
optionally follow the table name with the (comma-separated)
names of one or more
<a class="link" href="blob.html" title="13.3.4 The BLOB and TEXT Types">
<code class="literal">
BLOB
</code>
</a>
or
<a class="link" href="blob.html" title="13.3.4 The BLOB and TEXT Types">
<code class="literal">
TEXT
</code>
</a>
columns from that table. If
no columns are listed, the tool works on all of the table's
<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. If you need to
specify a database, use the
<a class="link" href="mysql-cluster-programs-ndb-blob-tool.html#option_ndb_blob_tool_database">
<code class="option">
--database
</code>
</a>
(
<code class="option">
-d
</code>
) option.
</p>
<p>
The
<a class="link" href="mysql-cluster-programs-ndb-blob-tool.html#option_ndb_blob_tool_verbose">
<code class="option">
--verbose
</code>
</a>
option
provides additional information in the output about the
tool's progress.
</p>
<p>
All options that can be used 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
</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_blob_tool_add-missing">
</a>
<a class="link" href="mysql-cluster-programs-ndb-blob-tool.html#option_ndb_blob_tool_add-missing">
<code class="option">
--add-missing
</code>
</a>
</p>
<a class="indexterm" name="idm46045105947712">
</a>
<a class="indexterm" name="idm46045105946224">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for add-missing">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--add-missing
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
For each inline part in NDB Cluster tables which has no
corresponding BLOB part, write a dummy BLOB part of the
required length, consisting of spaces.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_blob_tool_character-sets-dir">
</a>
<a class="link" href="mysql-cluster-programs-ndb-blob-tool.html#option_ndb_blob_tool_character-sets-dir">
<code class="option">
--character-sets-dir
</code>
</a>
</p>
<a class="indexterm" name="idm46045105936384">
</a>
<a class="indexterm" name="idm46045105934928">
</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_blob_tool_check-missing">
</a>
<a class="link" href="mysql-cluster-programs-ndb-blob-tool.html#option_ndb_blob_tool_check-missing">
<code class="option">
--check-missing
</code>
</a>
</p>
<a class="indexterm" name="idm46045105925072">
</a>
<a class="indexterm" name="idm46045105923584">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for check-missing">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--check-missing
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Check for inline parts in NDB Cluster tables which have no
corresponding BLOB parts.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_blob_tool_check-orphans">
</a>
<a class="link" href="mysql-cluster-programs-ndb-blob-tool.html#option_ndb_blob_tool_check-orphans">
<code class="option">
--check-orphans
</code>
</a>
</p>
<a class="indexterm" name="idm46045105913920">
</a>
<a class="indexterm" name="idm46045105912432">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for check-orphans">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--check-orphans
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Check for BLOB parts in NDB Cluster tables which have no
corresponding inline parts.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_blob_tool_connect-retries">
</a>
<a class="link" href="mysql-cluster-programs-ndb-blob-tool.html#option_ndb_blob_tool_connect-retries">
<code class="option">
--connect-retries
</code>
</a>
</p>
<a class="indexterm" name="idm46045105902656">
</a>
<a class="indexterm" name="idm46045105901168">
</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_blob_tool_connect-retry-delay">
</a>
<a class="link" href="mysql-cluster-programs-ndb-blob-tool.html#option_ndb_blob_tool_connect-retry-delay">
<code class="option">
--connect-retry-delay
</code>
</a>
</p>
<a class="indexterm" name="idm46045105882000">
</a>
<a class="indexterm" name="idm46045105880496">
</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_blob_tool_connect-string">
</a>
<a class="link" href="mysql-cluster-programs-ndb-blob-tool.html#option_ndb_blob_tool_connect-string">
<code class="option">
--connect-string
</code>
</a>
</p>
<a class="indexterm" name="idm46045105861376">
</a>
<a class="indexterm" name="idm46045105859888">
</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-blob-tool.html#option_ndb_blob_tool_ndb-connectstring">
<code class="option">
--ndb-connectstring
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_blob_tool_core-file">
</a>
<a class="link" href="mysql-cluster-programs-ndb-blob-tool.html#option_ndb_blob_tool_core-file">
<code class="option">
--core-file
</code>
</a>
</p>
<a class="indexterm" name="idm46045105844576">
</a>
<a class="indexterm" name="idm46045105843088">
</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_blob_tool_database">
</a>
<a class="link" href="mysql-cluster-programs-ndb-blob-tool.html#option_ndb_blob_tool_database">
<code class="option">
--database=
<em class="replaceable">
<code>
db_name
</code>
</em>
</code>
</a>
,
<code class="option">
-d
</code>
</p>
<a class="indexterm" name="idm46045105832784">
</a>
<a class="indexterm" name="idm46045105831296">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for database">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--database=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>
<p>
Specify the database to find the table in.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_blob_tool_defaults-extra-file">
</a>
<a class="link" href="mysql-cluster-programs-ndb-blob-tool.html#option_ndb_blob_tool_defaults-extra-file">
<code class="option">
--defaults-extra-file
</code>
</a>
</p>
<a class="indexterm" name="idm46045105816960">
</a>
<a class="indexterm" name="idm46045105815456">
</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_blob_tool_defaults-file">
</a>
<a class="link" href="mysql-cluster-programs-ndb-blob-tool.html#option_ndb_blob_tool_defaults-file">
<code class="option">
--defaults-file
</code>
</a>
</p>
<a class="indexterm" name="idm46045105801104">
</a>
<a class="indexterm" name="idm46045105799616">
</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_blob_tool_defaults-group-suffix">
</a>
<a class="link" href="mysql-cluster-programs-ndb-blob-tool.html#option_ndb_blob_tool_defaults-group-suffix">
<code class="option">
--defaults-group-suffix
</code>
</a>
</p>
<a class="indexterm" name="idm46045105785328">
</a>
<a class="indexterm" name="idm46045105783824">
</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_blob_tool_delete-orphans">
</a>
<a class="link" href="mysql-cluster-programs-ndb-blob-tool.html#option_ndb_blob_tool_delete-orphans">
<code class="option">
--delete-orphans
</code>
</a>
</p>
<a class="indexterm" name="idm46045105769648">
</a>
<a class="indexterm" name="idm46045105768160">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for delete-orphans">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--delete-orphans
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Remove BLOB parts from NDB Cluster tables which have no
corresponding inline parts.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_blob_tool_dump-file">
</a>
<a class="link" href="mysql-cluster-programs-ndb-blob-tool.html#option_ndb_blob_tool_dump-file">
<code class="option">
--dump-file=
<em class="replaceable">
<code>
file
</code>
</em>
</code>
</a>
</p>
<a class="indexterm" name="idm46045105758160">
</a>
<a class="indexterm" name="idm46045105756672">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for dump-file">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--dump-file=file
</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>
<p>
Writes a list of orphaned BLOB column parts to
<em class="replaceable">
<code>
file
</code>
</em>
. The information written to
the file includes the table key and BLOB part number for
each orphaned BLOB part.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_blob_tool_help">
</a>
<a class="link" href="mysql-cluster-programs-ndb-blob-tool.html#option_ndb_blob_tool_help">
<code class="option">
--help
</code>
</a>
</p>
<a class="indexterm" name="idm46045105741920">
</a>
<a class="indexterm" name="idm46045105740432">
</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_blob_tool_login-path">
</a>
<a class="link" href="mysql-cluster-programs-ndb-blob-tool.html#option_ndb_blob_tool_login-path">
<code class="option">
--login-path
</code>
</a>
</p>
<a class="indexterm" name="idm46045105730752">
</a>
<a class="indexterm" name="idm46045105729264">
</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_blob_tool_no-login-paths">
</a>
<a class="link" href="mysql-cluster-programs-ndb-blob-tool.html#option_ndb_blob_tool_no-login-paths">
<code class="option">
--no-login-paths
</code>
</a>
</p>
<a class="indexterm" name="idm46045105714992">
</a>
<a class="indexterm" name="idm46045105713504">
</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_blob_tool_ndb-connectstring">
</a>
<a class="link" href="mysql-cluster-programs-ndb-blob-tool.html#option_ndb_blob_tool_ndb-connectstring">
<code class="option">
--ndb-connectstring
</code>
</a>
</p>
<a class="indexterm" name="idm46045105703840">
</a>
<a class="indexterm" name="idm46045105702384">
</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_blob_tool_ndb-mgm-tls">
</a>
<a class="link" href="mysql-cluster-programs-ndb-blob-tool.html#option_ndb_blob_tool_ndb-mgm-tls">
<code class="option">
--ndb-mgm-tls
</code>
</a>
</p>
<a class="indexterm" name="idm46045105683408">
</a>
<a class="indexterm" name="idm46045105681920">
</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_blob_tool_ndb-mgmd-host">
</a>
<a class="link" href="mysql-cluster-programs-ndb-blob-tool.html#option_ndb_blob_tool_ndb-mgmd-host">
<code class="option">
--ndb-mgmd-host
</code>
</a>
</p>
<a class="indexterm" name="idm46045105660800">
</a>
<a class="indexterm" name="idm46045105659312">
</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-blob-tool.html#option_ndb_blob_tool_ndb-connectstring">
<code class="option">
--ndb-connectstring
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_blob_tool_ndb-nodeid">
</a>
<a class="link" href="mysql-cluster-programs-ndb-blob-tool.html#option_ndb_blob_tool_ndb-nodeid">
<code class="option">
--ndb-nodeid
</code>
</a>
</p>
<a class="indexterm" name="idm46045105644128">
</a>
<a class="indexterm" name="idm46045105642640">
</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
--ndb-connectstring.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_blob_tool_ndb-optimized-node-selection">
</a>
<a class="link" href="mysql-cluster-programs-ndb-blob-tool.html#option_ndb_blob_tool_ndb-optimized-node-selection">
<code class="option">
--ndb-optimized-node-selection
</code>
</a>
</p>
<a class="indexterm" name="idm46045105628224">
</a>
<a class="indexterm" name="idm46045105626720">
</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_blob_tool_ndb-tls-search-path">
</a>
<a class="link" href="mysql-cluster-programs-ndb-blob-tool.html#option_ndb_blob_tool_ndb-tls-search-path">
<code class="option">
--ndb-tls-search-path
</code>
</a>
</p>
<a class="indexterm" name="idm46045105616352">
</a>
<a class="indexterm" name="idm46045105614848">
</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_blob_tool_no-defaults">
</a>
<a class="link" href="mysql-cluster-programs-ndb-blob-tool.html#option_ndb_blob_tool_no-defaults">
<code class="option">
--no-defaults
</code>
</a>
</p>
<a class="indexterm" name="idm46045105591152">
</a>
<a class="indexterm" name="idm46045105589664">
</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_blob_tool_print-defaults">
</a>
<a class="link" href="mysql-cluster-programs-ndb-blob-tool.html#option_ndb_blob_tool_print-defaults">
<code class="option">
--print-defaults
</code>
</a>
</p>
<a class="indexterm" name="idm46045105579776">
</a>
<a class="indexterm" name="idm46045105578288">
</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_blob_tool_usage">
</a>
<a class="link" href="mysql-cluster-programs-ndb-blob-tool.html#option_ndb_blob_tool_usage">
<code class="option">
--usage
</code>
</a>
</p>
<a class="indexterm" name="idm46045105568448">
</a>
<a class="indexterm" name="idm46045105566960">
</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 --help.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_blob_tool_verbose">
</a>
<a class="link" href="mysql-cluster-programs-ndb-blob-tool.html#option_ndb_blob_tool_verbose">
<code class="option">
--verbose
</code>
</a>
</p>
<a class="indexterm" name="idm46045105557376">
</a>
<a class="indexterm" name="idm46045105555888">
</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>
Provide extra information in the tool's output
regarding its progress.
</p>
</li>
<li class="listitem">
<p>
<a name="option_ndb_blob_tool_version">
</a>
<a class="link" href="mysql-cluster-programs-ndb-blob-tool.html#option_ndb_blob_tool_version">
<code class="option">
--version
</code>
</a>
</p>
<a class="indexterm" name="idm46045105546080">
</a>
<a class="indexterm" name="idm46045105544592">
</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="idm46045105536880">
</a>
Example
</h4>
<p>
First we create an
<code class="literal">
NDB
</code>
table in the
<code class="literal">
test
</code>
database, using the
<a class="link" href="create-table.html" title="15.1.20 CREATE TABLE Statement">
<code class="literal">
CREATE TABLE
</code>
</a>
statement shown
here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa34186763"><div class="copy-help left">Press ⌘+C to 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">USE</span> test<span class="token punctuation">;</span>
<span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> btest <span class="token punctuation">(</span>
c0 <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 keyword">AUTO_INCREMENT</span> <span class="token keyword">PRIMARY</span> <span class="token keyword">KEY</span><span class="token punctuation">,</span>
c1 <span class="token datatype">TEXT</span><span class="token punctuation">,</span>
c2 <span class="token datatype">BLOB</span>
<span class="token punctuation">)</span> <span class="token keyword">ENGINE</span><span class="token operator">=</span><span class="token keyword">NDB</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Then we insert a few rows into this table, using a series of
statements similar to this one:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa25950062"><div class="copy-help left">Press ⌘+C to 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> btest <span class="token keyword">VALUES</span> <span class="token punctuation">(</span><span class="token boolean">NULL</span><span class="token punctuation">,</span> <span class="token string">'x'</span><span class="token punctuation">,</span> <span class="token function">REPEAT</span><span class="token punctuation">(</span><span class="token string">'x'</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 punctuation">;</span></code></pre>
</div>
<p>
When run with
<a class="link" href="mysql-cluster-programs-ndb-blob-tool.html#option_ndb_blob_tool_check-orphans">
<code class="option">
--check-orphans
</code>
</a>
against
this table,
<a class="link" href="mysql-cluster-programs-ndb-blob-tool.html" title="25.5.6 ndb_blob_tool — Check and Repair BLOB and TEXT columns of NDB Cluster Tables">
<span class="command">
<strong>
ndb_blob_tool
</strong>
</span>
</a>
generates the
following output:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa78271507"><div class="copy-help left">Press ⌘+C to 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_blob_tool</span> <span class="token property">--check-orphans</span> <span class="token property">--verbose</span> <span class="token property">-d</span> test btest
connected
processing 2 blobs
processing blob <span class="token comment" spellcheck="true">#0 c1 NDB$BLOB_19_1</span>
NDB$BLOB_19_1<span class="token punctuation">:</span> nextResult<span class="token punctuation">:</span> res<span class="token attr-value"><span class="token punctuation">=</span>1</span>
total parts<span class="token punctuation">:</span> 0
orphan parts<span class="token punctuation">:</span> 0
processing blob <span class="token comment" spellcheck="true">#1 c2 NDB$BLOB_19_2</span>
NDB$BLOB_19_2<span class="token punctuation">:</span> nextResult<span class="token punctuation">:</span> res<span class="token attr-value"><span class="token punctuation">=</span>0</span>
NDB$BLOB_19_2<span class="token punctuation">:</span> nextResult<span class="token punctuation">:</span> res<span class="token attr-value"><span class="token punctuation">=</span>0</span>
NDB$BLOB_19_2<span class="token punctuation">:</span> nextResult<span class="token punctuation">:</span> res<span class="token attr-value"><span class="token punctuation">=</span>0</span>
NDB$BLOB_19_2<span class="token punctuation">:</span> nextResult<span class="token punctuation">:</span> res<span class="token attr-value"><span class="token punctuation">=</span>0</span>
NDB$BLOB_19_2<span class="token punctuation">:</span> nextResult<span class="token punctuation">:</span> res<span class="token attr-value"><span class="token punctuation">=</span>0</span>
NDB$BLOB_19_2<span class="token punctuation">:</span> nextResult<span class="token punctuation">:</span> res<span class="token attr-value"><span class="token punctuation">=</span>0</span>
NDB$BLOB_19_2<span class="token punctuation">:</span> nextResult<span class="token punctuation">:</span> res<span class="token attr-value"><span class="token punctuation">=</span>0</span>
NDB$BLOB_19_2<span class="token punctuation">:</span> nextResult<span class="token punctuation">:</span> res<span class="token attr-value"><span class="token punctuation">=</span>0</span>
NDB$BLOB_19_2<span class="token punctuation">:</span> nextResult<span class="token punctuation">:</span> res<span class="token attr-value"><span class="token punctuation">=</span>0</span>
NDB$BLOB_19_2<span class="token punctuation">:</span> nextResult<span class="token punctuation">:</span> res<span class="token attr-value"><span class="token punctuation">=</span>0</span>
NDB$BLOB_19_2<span class="token punctuation">:</span> nextResult<span class="token punctuation">:</span> res<span class="token attr-value"><span class="token punctuation">=</span>1</span>
total parts<span class="token punctuation">:</span> 10
orphan parts<span class="token punctuation">:</span> 0
disconnected</code></pre>
</div>
<p>
The tool reports that there are no
<code class="literal">
NDB
</code>
BLOB
column parts associated with column
<code class="literal">
c1
</code>
, even
though
<code class="literal">
c1
</code>
is a
<a class="link" href="blob.html" title="13.3.4 The BLOB and TEXT Types">
<code class="literal">
TEXT
</code>
</a>
column. This is due to the
fact that, in an
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
table, only
the first 256 bytes of a
<a class="link" href="blob.html" title="13.3.4 The BLOB and TEXT Types">
<code class="literal">
BLOB
</code>
</a>
or
<a class="link" href="blob.html" title="13.3.4 The BLOB and TEXT Types">
<code class="literal">
TEXT
</code>
</a>
column value are stored
inline, and only the excess, if any, is stored separately; thus,
if there are no values using more than 256 bytes in a given
column of one of these types, no
<code class="literal">
BLOB
</code>
column
parts are created by
<code class="literal">
NDB
</code>
for this column. See
<a class="xref" href="storage-requirements.html" title="13.7 Data Type Storage Requirements">
Section 13.7, “Data Type Storage Requirements”
</a>
, for more information.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/audit-log-elements.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="audit-log-elements">
</a>
8.4.5.1 Elements of MySQL Enterprise Audit
</h4>
</div>
</div>
</div>
<p>
MySQL Enterprise Audit is based on the audit log plugin and related elements:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
A server-side plugin named
<code class="literal">
audit_log
</code>
examines auditable events and determines whether to write
them to the audit log.
</p>
</li>
<li class="listitem">
<p>
A set of functions enables manipulation of filtering
definitions that control logging behavior, the encryption
password, and log file reading.
</p>
</li>
<li class="listitem">
<p>
Tables in the
<code class="literal">
mysql
</code>
system database
provide persistent storage of filter and user account data,
unless you set the
<a class="link" href="audit-log-reference.html#sysvar_audit_log_database">
<code class="literal">
audit_log_database
</code>
</a>
system
variable at server startup to specify a different database.
</p>
</li>
<li class="listitem">
<p>
System variables enable audit log configuration and status
variables provide runtime operational information.
</p>
</li>
<li class="listitem">
<p>
The
<a class="link" href="privileges-provided.html#priv_audit-admin">
<code class="literal">
AUDIT_ADMIN
</code>
</a>
privilege
enable users to administer the audit log, and the
<a class="link" href="privileges-provided.html#priv_audit-abort-exempt">
<code class="literal">
AUDIT_ABORT_EXEMPT
</code>
</a>
privilege
enables system users to execute queries that would otherwise
be blocked by an
<span class="quote">
“
<span class="quote">
abort
</span>
”
</span>
item in the audit log
filter.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/load-index.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="load-index">
</a>
15.7.8.5 LOAD INDEX INTO CACHE Statement
</h4>
</div>
</div>
</div>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa14248093"><div class="copy-help left">Press ⌘+C to 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">LOAD</span> <span class="token keyword">INDEX</span> <span class="token keyword">INTO</span> <span class="token keyword">CACHE</span>
<em class="replaceable">tbl_index_list</em> <span class="token punctuation">[</span><span class="token punctuation">,</span> <em class="replaceable">tbl_index_list</em><span class="token punctuation">]</span> <span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span>
<em class="replaceable">tbl_index_list</em>:
<em class="replaceable">tbl_name</em>
<span class="token punctuation">[</span><span class="token keyword">PARTITION</span> <span class="token punctuation">(</span><em class="replaceable">partition_list</em><span class="token punctuation">)</span><span class="token punctuation">]</span>
<span class="token punctuation">[</span>{<span class="token keyword">INDEX</span><span class="token operator">|</span><span class="token keyword">KEY</span>} <span class="token punctuation">(</span><em class="replaceable">index_name</em><span class="token punctuation">[</span><span class="token punctuation">,</span> <em class="replaceable">index_name</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 keyword">IGNORE</span> <span class="token keyword">LEAVES</span><span class="token punctuation">]</span>
<em class="replaceable">partition_list</em>: {
<em class="replaceable">partition_name</em><span class="token punctuation">[</span><span class="token punctuation">,</span> <em class="replaceable">partition_name</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 keyword">ALL</span>
}</code></pre>
</div>
<p>
The
<a class="link" href="load-index.html" title="15.7.8.5 LOAD INDEX INTO CACHE Statement">
<code class="literal">
LOAD INDEX INTO
CACHE
</code>
</a>
statement preloads a table index into the key
cache to which it has been assigned by an explicit
<a class="link" href="cache-index.html" title="15.7.8.2 CACHE INDEX Statement">
<code class="literal">
CACHE INDEX
</code>
</a>
statement, or into
the default key cache otherwise.
</p>
<p>
<a class="link" href="load-index.html" title="15.7.8.5 LOAD INDEX INTO CACHE Statement">
<code class="literal">
LOAD INDEX INTO
CACHE
</code>
</a>
applies only to
<code class="literal">
MyISAM
</code>
tables, including partitioned
<code class="literal">
MyISAM
</code>
tables.
In addition, indexes on partitioned tables can be preloaded for
one, several, or all partitions.
</p>
<p>
The
<code class="literal">
IGNORE LEAVES
</code>
modifier causes only blocks
for the nonleaf nodes of the index to be preloaded.
</p>
<p>
<code class="literal">
IGNORE LEAVES
</code>
is also supported for
partitioned
<code class="literal">
MyISAM
</code>
tables.
</p>
<p>
The following statement preloads nodes (index blocks) of indexes
for the tables
<code class="literal">
t1
</code>
and
<code class="literal">
t2
</code>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa95045449"><div class="copy-help left">Press ⌘+C to 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">LOAD</span> <span class="token keyword">INDEX</span> <span class="token keyword">INTO</span> <span class="token keyword">CACHE</span> t1<span class="token punctuation">,</span> t2 <span class="token keyword">IGNORE</span> <span class="token keyword">LEAVES</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>
<span class="token output"><span class="token punctuation">|</span> Table <span class="token punctuation">|</span> Op <span class="token punctuation">|</span> Msg_type <span class="token punctuation">|</span> Msg_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>
<span class="token output"><span class="token punctuation">|</span> test.t1 <span class="token punctuation">|</span> preload_keys <span class="token punctuation">|</span> status <span class="token punctuation">|</span> OK <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> test.t2 <span class="token punctuation">|</span> preload_keys <span class="token punctuation">|</span> status <span class="token punctuation">|</span> OK <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></code></pre>
</div>
<p>
This statement preloads all index blocks from
<code class="literal">
t1
</code>
. It preloads only blocks for the nonleaf
nodes from
<code class="literal">
t2
</code>
.
</p>
<p>
The syntax of
<a class="link" href="load-index.html" title="15.7.8.5 LOAD INDEX INTO CACHE Statement">
<code class="literal">
LOAD
INDEX INTO CACHE
</code>
</a>
enables you to specify that only
particular indexes from a table should be preloaded. However,
the implementation preloads all the table's indexes into the
cache, so there is no reason to specify anything other than the
table name.
</p>
<p>
It is possible to preload indexes on specific partitions of
partitioned
<code class="literal">
MyISAM
</code>
tables. For example, of
the following 2 statements, the first preloads indexes for
partition
<code class="literal">
p0
</code>
of a partitioned table
<code class="literal">
pt
</code>
, while the second preloads the indexes for
partitions
<code class="literal">
p1
</code>
and
<code class="literal">
p3
</code>
of
the same table:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa81793512"><div class="copy-help left">Press ⌘+C to 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">LOAD</span> <span class="token keyword">INDEX</span> <span class="token keyword">INTO</span> <span class="token keyword">CACHE</span> pt <span class="token keyword">PARTITION</span> <span class="token punctuation">(</span>p0<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">LOAD</span> <span class="token keyword">INDEX</span> <span class="token keyword">INTO</span> <span class="token keyword">CACHE</span> pt <span class="token keyword">PARTITION</span> <span class="token punctuation">(</span>p1<span class="token punctuation">,</span> p3<span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
To preload the indexes for all partitions in table
<code class="literal">
pt
</code>
, you can use either of the following two
statements:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa84609747"><div class="copy-help left">Press ⌘+C to 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">LOAD</span> <span class="token keyword">INDEX</span> <span class="token keyword">INTO</span> <span class="token keyword">CACHE</span> pt <span class="token keyword">PARTITION</span> <span class="token punctuation">(</span><span class="token keyword">ALL</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">LOAD</span> <span class="token keyword">INDEX</span> <span class="token keyword">INTO</span> <span class="token keyword">CACHE</span> pt<span class="token punctuation">;</span></code></pre>
</div>
<p>
The two statements just shown are equivalent, and issuing either
one has exactly the same effect. In other words, if you wish to
preload indexes for all partitions of a partitioned table, the
<code class="literal">
PARTITION (ALL)
</code>
clause is optional.
</p>
<p>
When preloading indexes for multiple partitions, the partitions
need not be contiguous, and you need not list their names in any
particular order.
</p>
<p>
<a class="link" href="load-index.html" title="15.7.8.5 LOAD INDEX INTO CACHE Statement">
<code class="literal">
LOAD INDEX INTO
CACHE ... IGNORE LEAVES
</code>
</a>
fails unless all indexes in a
table have the same block size. To determine index block sizes
for a table, use
<a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
<span class="command">
<strong>
myisamchk -dv
</strong>
</span>
</a>
and check the
<code class="literal">
Blocksize
</code>
column.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/optimizing-server.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title">
<a name="optimizing-server">
</a>
10.12 Optimizing the MySQL Server
</h2>
</div>
</div>
</div>
<div class="toc">
<dl class="toc">
<dt>
<span class="section">
<a href="disk-issues.html">
10.12.1 Optimizing Disk I/O
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="symbolic-links.html">
10.12.2 Using Symbolic Links
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="optimizing-memory.html">
10.12.3 Optimizing Memory Use
</a>
</span>
</dt>
</dl>
</div>
<p>
This section discusses optimization techniques for the database
server, primarily dealing with system configuration rather than
tuning SQL statements. The information in this section is
appropriate for DBAs who want to ensure performance and
scalability across the servers they manage; for developers
constructing installation scripts that include setting up the
database; and people running MySQL themselves for development,
testing, and so on who want to maximize their own productivity.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/group-replication-single-consensus-leader.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="group-replication-single-consensus-leader">
</a>
20.7.3 Single Consensus Leader
</h3>
</div>
</div>
</div>
<p>
By default, the group communication engine for Group Replication
(XCom, a Paxos variant) operates using every member of the
replication group as a leader. The group communication engine can
use a single leader to drive consensus when the group is in
single-primary mode. Operating with a single consensus leader
improves performance and resilience in single-primary mode,
particularly when some of the group’s secondary members are
currently unreachable.
</p>
<p>
To use a single consensus leader, the group must be configured as
follows:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
The group must be in single-primary mode.
</p>
</li>
<li class="listitem">
<p>
The
<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>
system variable must be set to
<code class="literal">
ON
</code>
. With the
default setting
<code class="literal">
OFF
</code>
, the behavior is
disabled. You must carry out a full reboot of the replication
group (bootstrap) for Group Replication to pick up a change to
this setting.
</p>
</li>
<li class="listitem">
<p>
The Group Replication communication protocol version must be
set to 8.0.27 or later. Use 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 to view the group's communication protocol version.
If a lower version is in use, the group cannot use this
behavior. 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 group's communication protocol to a higher
version if all group members support it. MySQL InnoDB Cluster
manages the communication protocol version automatically. For
more information, see
<a class="xref" href="group-replication-communication-protocol.html" title="20.5.1.4 Setting a Group's Communication Protocol Version">
Section 20.5.1.4, “Setting a Group's Communication Protocol Version”
</a>
.
</p>
</li>
</ul>
</div>
<p>
When this configuration is in place, Group Replication instructs
the group communication engine to use the group’s primary as the
single leader to drive consensus. When a new primary is elected,
Group Replication tells the group communication engine to use it
instead. If the primary is currently unhealthy, the group
communication engine uses an alternative member as the consensus
leader. The Performance Schema table
<a class="link" href="performance-schema-replication-group-communication-information-table.html" title="29.12.11.10 The replication_group_communication_information Table">
<code class="literal">
replication_group_communication_information
</code>
</a>
shows the current preferred and actual consensus leader, with the
preferred leader being Group Replication’s choice, and the
actual leader being the one selected by the group communication
engine.
</p>
<p>
If the group is in multi-primary mode, has a lower communication
protocol version, or the behavior is disabled by the
<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>
setting, all members are used as leaders to drive consensus. In
this situation, the Performance Schema table
<a class="link" href="performance-schema-replication-group-communication-information-table.html" title="29.12.11.10 The replication_group_communication_information Table">
<code class="literal">
replication_group_communication_information
</code>
</a>
shows all of the members as both the preferred and actual leaders.
</p>
<p>
The
<code class="literal">
WRITE_CONSENSUS_SINGLE_LEADER_CAPABLE
</code>
column of the Performance Schema table
<a class="link" href="performance-schema-replication-group-communication-information-table.html" title="29.12.11.10 The replication_group_communication_information Table">
<code class="literal">
replication_group_communication_information
</code>
</a>
shows whether the group supports the use of a single leader, even
if
<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 currently set to
<code class="literal">
OFF
</code>
on the queried member.
The column value is 1 if the group was started with
<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>
set to
<code class="literal">
ON
</code>
, and its communication protocol
version is MySQL 8.0.27 or above. This information is returned
only for group members in
<code class="literal">
ONLINE
</code>
or
<code class="literal">
RECOVERING
</code>
state.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/x-plugin-connection-compression.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="x-plugin-connection-compression">
</a>
22.5.5 Connection Compression with X Plugin
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045126647216">
</a>
<a class="indexterm" name="idm46045126645728">
</a>
<p>
X Plugin supports compression of messages sent over X Protocol
connections. Connections can be compressed if the server and the
client agree on a mutually supported compression algorithm.
Enabling compression reduces the number of bytes sent over the
network, but adds to the server and client an additional CPU cost
for compression and decompression operations. The benefits of
compression therefore occur primarily when there is low network
bandwidth, network transfer time dominates the cost of compression
and decompression operations, and result sets are large.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
Different MySQL clients implement support for connection
compression differently; consult your client documentation for
details. For example, for classic MySQL protocol connections, 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>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="xref" href="x-plugin-connection-compression.html#x-plugin-connection-compression-configuration" title="Configuring Connection Compression for X Plugin">
Configuring Connection Compression for X Plugin
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="x-plugin-connection-compression.html#x-plugin-connection-compression-characteristics" title="Compressed Connection Characteristics for X Plugin">
Compressed Connection Characteristics for X Plugin
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="x-plugin-connection-compression.html#x-plugin-connection-compression-monitoring" title="Monitoring Connection Compression for X Plugin">
Monitoring Connection Compression for X Plugin
</a>
</p>
</li>
</ul>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="x-plugin-connection-compression-configuration">
</a>
Configuring Connection Compression for X Plugin
</h4>
</div>
</div>
</div>
<p>
By default, X Plugin supports the zstd, LZ4, and Deflate
compression algorithms. Compression with the Deflate algorithm
is carried out using the zlib software library, so the
<code class="literal">
deflate_stream
</code>
compression algorithm setting
for X Protocol connections is equivalent to the
<code class="literal">
zlib
</code>
setting for classic MySQL protocol
connections.
</p>
<p>
On the server side, you can disallow any of the compression
algorithms by setting the
<a class="link" href="x-plugin-options-system-variables.html#sysvar_mysqlx_compression_algorithms">
<code class="literal">
mysqlx_compression_algorithms
</code>
</a>
system variable to include only those permitted. The algorithm
names
<code class="literal">
zstd_stream
</code>
,
<code class="literal">
lz4_message
</code>
, and
<code class="literal">
deflate_stream
</code>
can be specified in any
combination, and the order and lettercase are not important. If
the system variable value is the empty string, no compression
algorithms are permitted and connections are uncompressed.
</p>
<p>
The following table compares the characteristics of the
different compression algorithms and shows their assigned
priorities. By default, the server chooses the highest-priority
algorithm permitted in common by the server and the client;
clients may change the priorities as described later. The short
form alias for the algorithms can be used by clients when
specifying them.
</p>
<div class="table">
<a name="x-plugin-connection-compression-algorithms">
</a>
<p class="title">
<b>
Table 22.1 X Protocol Compression Algorithm Characteristics
</b>
</p>
<div class="table-contents">
<table frame="void">
<colgroup>
<col align="center" style="width: 18%"/>
<col align="center" style="width: 14%"/>
<col align="center" style="width: 18%"/>
<col align="center" style="width: 17%"/>
<col align="center" style="width: 16%"/>
<col align="center" style="width: 16%"/>
</colgroup>
<thead>
<tr>
<th scope="col">
Algorithm
</th>
<th scope="col">
Alias
</th>
<th scope="col">
Compression Ratio
</th>
<th scope="col">
Throughput
</th>
<th scope="col">
CPU Cost
</th>
<th scope="col">
Default Priority
</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">
<code class="literal">
zsth_stream
</code>
</th>
<td>
<code class="literal">
zstd
</code>
</td>
<td>
High
</td>
<td>
High
</td>
<td>
Medium
</td>
<td>
First
</td>
</tr>
<tr>
<th scope="row">
<code class="literal">
lz4_message
</code>
</th>
<td>
<code class="literal">
lz4
</code>
</td>
<td>
Low
</td>
<td>
High
</td>
<td>
Lowest
</td>
<td>
Second
</td>
</tr>
<tr>
<th scope="row">
<code class="literal">
deflate_stream
</code>
</th>
<td>
<code class="literal">
deflate
</code>
</td>
<td>
High
</td>
<td>
Low
</td>
<td>
Highest
</td>
<td>
Third
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br class="table-break"/>
<p>
The X Protocol set of permitted compression algorithms (whether
user-specified or default) is independent of the set of
compression algorithms permitted by MySQL Server for
classic MySQL protocol connections, which is specified by the
<a class="link" href="server-system-variables.html#sysvar_protocol_compression_algorithms">
<code class="literal">
protocol_compression_algorithms
</code>
</a>
server system variable. If you do not specify the
<a class="link" href="x-plugin-options-system-variables.html#sysvar_mysqlx_compression_algorithms">
<code class="literal">
mysqlx_compression_algorithms
</code>
</a>
system variable, X Plugin does not fall back to using
compression settings for classic MySQL protocol connections. Instead,
its default is to permit all algorithms shown in
<a class="xref" href="x-plugin-connection-compression.html#x-plugin-connection-compression-algorithms" title="Table 22.1 X Protocol Compression Algorithm Characteristics">
Table 22.1, “X Protocol Compression Algorithm Characteristics”
</a>
.
This is unlike the situation for the TLS context, where MySQL
Server settings are used if the X Plugin system variables are
not set, as described in
<a class="xref" href="x-plugin-encrypted-connections.html" title="22.5.3 Using Encrypted Connections with X Plugin">
Section 22.5.3, “Using Encrypted Connections with X Plugin”
</a>
. For
information about compression for classic MySQL protocol connections,
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>
<p>
On the client side, an X Protocol connection request can
specify several parameters for compression control:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
The compression mode.
</p>
</li>
<li class="listitem">
<p>
The compression level.
</p>
</li>
<li class="listitem">
<p>
The list of permitted compression algorithms in priority
order.
</p>
</li>
</ul>
</div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
Some clients or Connectors might not support a given
compression-control feature. For example, specifying
compression level for X Protocol connections is supported
only by MySQL Shell, not by other MySQL clients or
Connectors. See the documentation for specific products for
details about supported features and how to use them.
</p>
</div>
<p>
The connection mode has these permitted values:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
disabled
</code>
: The connection is uncompressed.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
preferred
</code>
: The server and client
negotiate to find a compression algorithm they both permit.
If no common algorithm is available, the connection is
uncompressed. This is the default mode if not specified
explicitly.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
required
</code>
: Compression algorithm
negotiation occurs as for
<code class="literal">
preferred
</code>
mode,
but if no common algorithm is available, the connection
request terminates with an error.
</p>
</li>
</ul>
</div>
<p>
In addition to agreeing on a compression algorithm for each
connection, the server and client can agree on a compression
level from the numeric range that applies to the agreed
algorithm. As the compression level for an algorithm increases,
the data compression ratio increases, which reduces the network
bandwidth and transfer time needed to send the message to the
client. However, the effort required for data compression also
increases, taking up time and CPU and memory resources on the
server. Increases in the compression effort do not have a linear
relationship to increases in the compression ratio.
</p>
<p>
The client can request a specific compression level during
capability negotiations with the server for an X Protocol
connection.
</p>
<p>
The default compression levels used by X Plugin in MySQL
8.4 have been selected through performance testing
as being a good trade-off between compression time and network
transit time. These defaults are not necessarily the same as the
library default for each algorithm. They apply if the client
does not request a compression level for the algorithm. The
default compression levels are initially set to 3 for zstd, 2
for LZ4, and 3 for Deflate. You can adjust these settings using
the
<a class="link" href="x-plugin-options-system-variables.html#sysvar_mysqlx_zstd_default_compression_level">
<code class="literal">
mysqlx_zstd_default_compression_level
</code>
</a>
,
<a class="link" href="x-plugin-options-system-variables.html#sysvar_mysqlx_lz4_default_compression_level">
<code class="literal">
mysqlx_lz4_default_compression_level
</code>
</a>
,
and
<a class="link" href="x-plugin-options-system-variables.html#sysvar_mysqlx_deflate_default_compression_level">
<code class="literal">
mysqlx_deflate_default_compression_level
</code>
</a>
system variables.
</p>
<p>
To prevent excessive resource consumption on the server,
X Plugin sets a maximum compression level that the server
permits for each algorithm. If a client requests a compression
level that exceeds this setting, the server uses its maximum
permitted compression level (compression level requests by a
client are supported only by MySQL Shell). The maximum
compression levels are initially set to 11 for zstd, 8 for LZ4,
and 5 for Deflate. You can adjust these settings using the
<a class="link" href="x-plugin-options-system-variables.html#sysvar_mysqlx_zstd_max_client_compression_level">
<code class="literal">
mysqlx_zstd_max_client_compression_level
</code>
</a>
,
<a class="link" href="x-plugin-options-system-variables.html#sysvar_mysqlx_lz4_max_client_compression_level">
<code class="literal">
mysqlx_lz4_max_client_compression_level
</code>
</a>
,
and
<a class="link" href="x-plugin-options-system-variables.html#sysvar_mysqlx_deflate_max_client_compression_level">
<code class="literal">
mysqlx_deflate_max_client_compression_level
</code>
</a>
system variables.
</p>
<p>
If the server and client permit more than one algorithm in
common, the default priority order for choosing an algorithm
during negotiation is shown in
<a class="xref" href="x-plugin-connection-compression.html#x-plugin-connection-compression-algorithms" title="Table 22.1 X Protocol Compression Algorithm Characteristics">
Table 22.1, “X Protocol Compression Algorithm Characteristics”
</a>
.
For clients that support specifying compression algorithms, the
connection request can include a list of algorithms permitted by
the client, specified using the algorithm name or its alias. The
order of these algorithms in the list is taken as a priority
order by the server. The algorithm used in this case is the
first of those in the client list that is also permitted on the
server side. However, the option for compression algorithms is
subject to the compression mode:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
If the compression mode is
<code class="literal">
disabled
</code>
, the
compression algorithms option is ignored.
</p>
</li>
<li class="listitem">
<p>
If the compression mode is
<code class="literal">
preferred
</code>
but
no algorithm permitted on the client side is permitted on
the server side, the connection is uncompressed.
</p>
</li>
<li class="listitem">
<p>
If the compression mode is
<code class="literal">
required
</code>
but
no algorithm permitted on the client side is permitted on
the server side, an error occurs.
</p>
</li>
</ul>
</div>
<p>
To monitor the effects of message compression, use the X Plugin
status variables described in
<a class="xref" href="x-plugin-connection-compression.html#x-plugin-connection-compression-monitoring" title="Monitoring Connection Compression for X Plugin">
Monitoring Connection Compression for X Plugin
</a>
.
You can use these status variables to calculate the benefit of
message compression with your current settings, and use that
information to tune your settings.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="x-plugin-connection-compression-characteristics">
</a>
Compressed Connection Characteristics for X Plugin
</h4>
</div>
</div>
</div>
<p>
X Protocol connection compression operates with the following
behaviors and boundaries:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
The
<code class="literal">
_stream
</code>
and
<code class="literal">
_message
</code>
suffixes in algorithm names
refer to two different operational modes: In stream mode,
all X Protocol messages in a single connection are
compressed into a continuous stream and must be decompressed
in the same manner—following the order they were
compressed and without skipping any messages. In message
mode, each message is compressed individually and
independently, and need not be decompressed in the order in
which they were compressed. Also, message mode does not
require all compressed messages to be decompressed.
</p>
</li>
<li class="listitem">
<p>
Compression is not applied to any messages that are sent
before authentication succeeds.
</p>
</li>
<li class="listitem">
<p>
Compression is not applied to control flow messages such as
<code class="literal">
Mysqlx.Ok
</code>
,
<code class="literal">
Mysqlx.Error
</code>
, and
<code class="literal">
Mysqlx.Sql.StmtExecuteOk
</code>
messages.
</p>
</li>
<li class="listitem">
<p>
All other X Protocol messages can be compressed if the
server and client agree on a mutually permitted compression
algorithm during capability negotiation. If the client does
not request compression at that stage, neither the client
nor the server applies compression to messages.
</p>
</li>
<li class="listitem">
<p>
When messages sent over X Protocol connections are
compressed, the limit specified by the
<a class="link" href="x-plugin-options-system-variables.html#sysvar_mysqlx_max_allowed_packet">
<code class="literal">
mysqlx_max_allowed_packet
</code>
</a>
system variable still applies. The network packet must be
smaller than this limit after the message payload has been
decompressed. If the limit is exceeded, X Plugin returns a
decompression error and closes the connection.
</p>
</li>
<li class="listitem">
<p>
The following points pertain to compression level requests
by clients, which is supported only by MySQL Shell:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
Compression levels must be specified by the client as an
integer. If any other type of value is supplied, the
connection closes with an error.
</p>
</li>
<li class="listitem">
<p>
If a client specifies an algorithm but not a compression
level, the server uses its default compression level for
the algorithm.
</p>
</li>
<li class="listitem">
<p>
If a client requests an algorithm compression level that
exceeds the server maximum permitted level, the server
uses the maximum permitted level.
</p>
</li>
<li class="listitem">
<p>
If a client requests an algorithm compression level that
is less than the server minimum permitted level, the
server uses the minimum permitted level.
</p>
</li>
</ul>
</div>
</li>
</ul>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="x-plugin-connection-compression-monitoring">
</a>
Monitoring Connection Compression for X Plugin
</h4>
</div>
</div>
</div>
<p>
You can monitor the effects of message compression using the
X Plugin status variables. When message compression is in use,
the session
<a class="link" href="x-plugin-status-variables.html#statvar_Mysqlx_compression_algorithm">
<code class="literal">
Mysqlx_compression_algorithm
</code>
</a>
status variable shows which compression algorithm is in use for
the current X Protocol connection, and
<a class="link" href="x-plugin-status-variables.html#statvar_Mysqlx_compression_level">
<code class="literal">
Mysqlx_compression_level
</code>
</a>
shows
the compression level that was selected.
</p>
<p>
X Plugin status variables can be used to calculate the
efficiency of the compression algorithms that are selected (the
data compression ratio), and the overall effect of using message
compression. Use the session value of the status variables in
the following calculations to see what the benefit of message
compression was for a specific session with a known compression
algorithm. Or use the global value of the status variables to
check the overall benefit of message compression for your server
across all sessions using X Protocol connections, including all
the compression algorithms that have been used for those
sessions, and all sessions that did not use message compression.
You can then tune message compression by adjusting the permitted
compression algorithms, maximum compression level, and default
compression level, as described in
<a class="xref" href="x-plugin-connection-compression.html#x-plugin-connection-compression-configuration" title="Configuring Connection Compression for X Plugin">
Configuring Connection Compression for X Plugin
</a>
.
</p>
<p>
When message compression is in use, the
<a class="link" href="x-plugin-status-variables.html#statvar_Mysqlx_bytes_sent">
<code class="literal">
Mysqlx_bytes_sent
</code>
</a>
status
variable shows the total number of bytes sent out from the
server, including compressed message payloads measured after
compression, any items in compressed messages that were not
compressed such as X Protocol headers, and any uncompressed
messages. The
<a class="link" href="x-plugin-status-variables.html#statvar_Mysqlx_bytes_sent_compressed_payload">
<code class="literal">
Mysqlx_bytes_sent_compressed_payload
</code>
</a>
status variable shows the total number of bytes sent as
compressed message payloads, measured after compression, and the
<a class="link" href="x-plugin-status-variables.html#statvar_Mysqlx_bytes_sent_uncompressed_frame">
<code class="literal">
Mysqlx_bytes_sent_uncompressed_frame
</code>
</a>
status variable shows the total number of bytes for those same
message payloads but measured before compression. The
compression ratio, which shows the efficiency of the compression
algorithm, can therefore be calculated using the following
expression:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-simple"><div class="docs-select-all right" id="sa73312766"><div class="copy-help left">Press ⌘+C to 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">mysqlx_bytes_sent_uncompressed_frame <span class="token operator">/</span> mysqlx_bytes_sent_compressed_payload</code></pre>
</div>
<p>
The effectiveness of compression for X Protocol messages sent
by the server can be calculated using the following expression:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-simple"><div class="docs-select-all right" id="sa71069708"><div class="copy-help left">Press ⌘+C to 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"><span class="token punctuation">(</span>mysqlx_bytes_sent <span class="token operator">-</span> mysqlx_bytes_sent_compressed_payload <span class="token operator">+</span> mysqlx_bytes_sent_uncompressed_frame<span class="token punctuation">)</span> <span class="token operator">/</span> mysqlx_bytes_sent</code></pre>
</div>
<p>
For messages received by the server from clients, the
<a class="link" href="x-plugin-status-variables.html#statvar_Mysqlx_bytes_received_compressed_payload">
<code class="literal">
Mysqlx_bytes_received_compressed_payload
</code>
</a>
status variable shows the total number of bytes received as
compressed message payloads, measured before decompression, and
the
<a class="link" href="x-plugin-status-variables.html#statvar_Mysqlx_bytes_received_uncompressed_frame">
<code class="literal">
Mysqlx_bytes_received_uncompressed_frame
</code>
</a>
status variable shows the total number of bytes for those same
message payloads but measured after decompression. The
<a class="link" href="x-plugin-status-variables.html#statvar_Mysqlx_bytes_received">
<code class="literal">
Mysqlx_bytes_received
</code>
</a>
status
variable includes compressed message payloads measured before
decompression, any uncompressed items in compressed messages,
and any uncompressed messages.
</p>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/performance-schema-table-wait-summary-tables.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="performance-schema-table-wait-summary-tables">
</a>
29.12.20.8 Table I/O and Lock Wait Summary Tables
</h4>
</div>
</div>
</div>
<p>
The following sections describe the table I/O and lock wait
summary tables:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="link" href="performance-schema-table-wait-summary-tables.html#performance-schema-table-io-waits-summary-by-index-usage-table" title="29.12.20.8.2 The table_io_waits_summary_by_index_usage Table">
<code class="literal">
table_io_waits_summary_by_index_usage
</code>
</a>
:
Table I/O waits per index
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="performance-schema-table-wait-summary-tables.html#performance-schema-table-io-waits-summary-by-table-table" title="29.12.20.8.1 The table_io_waits_summary_by_table Table">
<code class="literal">
table_io_waits_summary_by_table
</code>
</a>
:
Table I/O waits per table
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="performance-schema-table-wait-summary-tables.html#performance-schema-table-lock-waits-summary-by-table-table" title="29.12.20.8.3 The table_lock_waits_summary_by_table Table">
<code class="literal">
table_lock_waits_summary_by_table
</code>
</a>
:
Table lock waits per table
</p>
</li>
</ul>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h5 class="title">
<a name="performance-schema-table-io-waits-summary-by-table-table">
</a>
29.12.20.8.1 The table_io_waits_summary_by_table Table
</h5>
</div>
</div>
</div>
<a class="indexterm" name="idm46045068447680">
</a>
<a class="indexterm" name="idm46045068446176">
</a>
<p>
The
<a class="link" href="performance-schema-table-wait-summary-tables.html#performance-schema-table-io-waits-summary-by-table-table" title="29.12.20.8.1 The table_io_waits_summary_by_table Table">
<code class="literal">
table_io_waits_summary_by_table
</code>
</a>
table aggregates all table I/O wait events, as generated by
the
<code class="literal">
wait/io/table/sql/handler
</code>
instrument.
The grouping is by table.
</p>
<p>
The
<a class="link" href="performance-schema-table-wait-summary-tables.html#performance-schema-table-io-waits-summary-by-table-table" title="29.12.20.8.1 The table_io_waits_summary_by_table Table">
<code class="literal">
table_io_waits_summary_by_table
</code>
</a>
table has these grouping columns to indicate how the table
aggregates events:
<code class="literal">
OBJECT_TYPE
</code>
,
<code class="literal">
OBJECT_SCHEMA
</code>
, and
<code class="literal">
OBJECT_NAME
</code>
. These columns have the same
meaning as in the
<a class="link" href="performance-schema-events-waits-current-table.html" title="29.12.4.1 The events_waits_current Table">
<code class="literal">
events_waits_current
</code>
</a>
table.
They identify the table to which the row applies.
</p>
<p>
<a class="link" href="performance-schema-table-wait-summary-tables.html#performance-schema-table-io-waits-summary-by-table-table" title="29.12.20.8.1 The table_io_waits_summary_by_table Table">
<code class="literal">
table_io_waits_summary_by_table
</code>
</a>
has the following summary columns containing aggregated
values. As indicated in the column descriptions, some
columns are more general and have values that are the same
as the sum of the values of more fine-grained columns. For
example, columns that aggregate all writes hold the sum of
the corresponding columns that aggregate inserts, updates,
and deletes. In this way, aggregations at higher levels are
available directly without the need for user-defined views
that sum lower-level columns.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
COUNT_STAR
</code>
,
<code class="literal">
SUM_TIMER_WAIT
</code>
,
<code class="literal">
MIN_TIMER_WAIT
</code>
,
<code class="literal">
AVG_TIMER_WAIT
</code>
,
<code class="literal">
MAX_TIMER_WAIT
</code>
</p>
<p>
These columns aggregate all I/O operations. They are the
same as the sum of the corresponding
<code class="literal">
<em class="replaceable">
<code>
xxx
</code>
</em>
_READ
</code>
and
<code class="literal">
<em class="replaceable">
<code>
xxx
</code>
</em>
_WRITE
</code>
columns.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
COUNT_READ
</code>
,
<code class="literal">
SUM_TIMER_READ
</code>
,
<code class="literal">
MIN_TIMER_READ
</code>
,
<code class="literal">
AVG_TIMER_READ
</code>
,
<code class="literal">
MAX_TIMER_READ
</code>
</p>
<p>
These columns aggregate all read operations. They are
the same as the sum of the corresponding
<code class="literal">
<em class="replaceable">
<code>
xxx
</code>
</em>
_FETCH
</code>
columns.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
COUNT_WRITE
</code>
,
<code class="literal">
SUM_TIMER_WRITE
</code>
,
<code class="literal">
MIN_TIMER_WRITE
</code>
,
<code class="literal">
AVG_TIMER_WRITE
</code>
,
<code class="literal">
MAX_TIMER_WRITE
</code>
</p>
<p>
These columns aggregate all write operations. They are
the same as the sum of the corresponding
<code class="literal">
<em class="replaceable">
<code>
xxx
</code>
</em>
_INSERT
</code>
,
<code class="literal">
<em class="replaceable">
<code>
xxx
</code>
</em>
_UPDATE
</code>
,
and
<code class="literal">
<em class="replaceable">
<code>
xxx
</code>
</em>
_DELETE
</code>
columns.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
COUNT_FETCH
</code>
,
<code class="literal">
SUM_TIMER_FETCH
</code>
,
<code class="literal">
MIN_TIMER_FETCH
</code>
,
<code class="literal">
AVG_TIMER_FETCH
</code>
,
<code class="literal">
MAX_TIMER_FETCH
</code>
</p>
<p>
These columns aggregate all fetch operations.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
COUNT_INSERT
</code>
,
<code class="literal">
SUM_TIMER_INSERT
</code>
,
<code class="literal">
MIN_TIMER_INSERT
</code>
,
<code class="literal">
AVG_TIMER_INSERT
</code>
,
<code class="literal">
MAX_TIMER_INSERT
</code>
</p>
<p>
These columns aggregate all insert operations.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
COUNT_UPDATE
</code>
,
<code class="literal">
SUM_TIMER_UPDATE
</code>
,
<code class="literal">
MIN_TIMER_UPDATE
</code>
,
<code class="literal">
AVG_TIMER_UPDATE
</code>
,
<code class="literal">
MAX_TIMER_UPDATE
</code>
</p>
<p>
These columns aggregate all update operations.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
COUNT_DELETE
</code>
,
<code class="literal">
SUM_TIMER_DELETE
</code>
,
<code class="literal">
MIN_TIMER_DELETE
</code>
,
<code class="literal">
AVG_TIMER_DELETE
</code>
,
<code class="literal">
MAX_TIMER_DELETE
</code>
</p>
<p>
These columns aggregate all delete operations.
</p>
</li>
</ul>
</div>
<p>
The
<a class="link" href="performance-schema-table-wait-summary-tables.html#performance-schema-table-io-waits-summary-by-table-table" title="29.12.20.8.1 The table_io_waits_summary_by_table Table">
<code class="literal">
table_io_waits_summary_by_table
</code>
</a>
table has these indexes:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Unique index on (
<code class="literal">
OBJECT_TYPE
</code>
,
<code class="literal">
OBJECT_SCHEMA
</code>
,
<code class="literal">
OBJECT_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 permitted
for table I/O summary tables. It resets the summary columns
to zero rather than removing rows. Truncating this table
also truncates the
<a class="link" href="performance-schema-table-wait-summary-tables.html#performance-schema-table-io-waits-summary-by-index-usage-table" title="29.12.20.8.2 The table_io_waits_summary_by_index_usage Table">
<code class="literal">
table_io_waits_summary_by_index_usage
</code>
</a>
table.
</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h5 class="title">
<a name="performance-schema-table-io-waits-summary-by-index-usage-table">
</a>
29.12.20.8.2 The table_io_waits_summary_by_index_usage Table
</h5>
</div>
</div>
</div>
<a class="indexterm" name="idm46045068384320">
</a>
<a class="indexterm" name="idm46045068382800">
</a>
<p>
The
<a class="link" href="performance-schema-table-wait-summary-tables.html#performance-schema-table-io-waits-summary-by-index-usage-table" title="29.12.20.8.2 The table_io_waits_summary_by_index_usage Table">
<code class="literal">
table_io_waits_summary_by_index_usage
</code>
</a>
table aggregates all table index I/O wait events, as
generated by the
<code class="literal">
wait/io/table/sql/handler
</code>
instrument. The
grouping is by table index.
</p>
<p>
The columns of
<a class="link" href="performance-schema-table-wait-summary-tables.html#performance-schema-table-io-waits-summary-by-index-usage-table" title="29.12.20.8.2 The table_io_waits_summary_by_index_usage Table">
<code class="literal">
table_io_waits_summary_by_index_usage
</code>
</a>
are nearly identical to
<a class="link" href="performance-schema-table-wait-summary-tables.html#performance-schema-table-io-waits-summary-by-table-table" title="29.12.20.8.1 The table_io_waits_summary_by_table Table">
<code class="literal">
table_io_waits_summary_by_table
</code>
</a>
.
The only difference is the additional group column,
<code class="literal">
INDEX_NAME
</code>
, which corresponds to the name
of the index that was used when the table I/O wait event was
recorded:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
A value of
<code class="literal">
PRIMARY
</code>
indicates that
table I/O used the primary index.
</p>
</li>
<li class="listitem">
<p>
A value of
<code class="literal">
NULL
</code>
means that table I/O
used no index.
</p>
</li>
<li class="listitem">
<p>
Inserts are counted against
<code class="literal">
INDEX_NAME =
NULL
</code>
.
</p>
</li>
</ul>
</div>
<p>
The
<a class="link" href="performance-schema-table-wait-summary-tables.html#performance-schema-table-io-waits-summary-by-index-usage-table" title="29.12.20.8.2 The table_io_waits_summary_by_index_usage Table">
<code class="literal">
table_io_waits_summary_by_index_usage
</code>
</a>
table has these indexes:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Unique index on (
<code class="literal">
OBJECT_TYPE
</code>
,
<code class="literal">
OBJECT_SCHEMA
</code>
,
<code class="literal">
OBJECT_NAME
</code>
,
<code class="literal">
INDEX_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 permitted
for table I/O summary tables. It resets the summary columns
to zero rather than removing rows. This table is also
truncated by truncation of the
<a class="link" href="performance-schema-table-wait-summary-tables.html#performance-schema-table-io-waits-summary-by-table-table" title="29.12.20.8.1 The table_io_waits_summary_by_table Table">
<code class="literal">
table_io_waits_summary_by_table
</code>
</a>
table. A DDL operation that changes the index structure of a
table may cause the per-index statistics to be reset.
</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h5 class="title">
<a name="performance-schema-table-lock-waits-summary-by-table-table">
</a>
29.12.20.8.3 The table_lock_waits_summary_by_table Table
</h5>
</div>
</div>
</div>
<a class="indexterm" name="idm46045068358944">
</a>
<a class="indexterm" name="idm46045068357440">
</a>
<p>
The
<a class="link" href="performance-schema-table-wait-summary-tables.html#performance-schema-table-lock-waits-summary-by-table-table" title="29.12.20.8.3 The table_lock_waits_summary_by_table Table">
<code class="literal">
table_lock_waits_summary_by_table
</code>
</a>
table aggregates all table lock wait events, as generated by
the
<code class="literal">
wait/lock/table/sql/handler
</code>
instrument. The grouping is by table.
</p>
<p>
This table contains information about internal and external
locks:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
An internal lock corresponds to a lock in the SQL layer.
This is currently implemented by a call to
<code class="literal">
thr_lock()
</code>
. In event rows, these
locks are distinguished by the
<code class="literal">
OPERATION
</code>
column, which has one of
these values:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-none"><div class="docs-select-all right" id="sa37231800"><div class="copy-help left">Press ⌘+C to 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">read normal
read with shared locks
read high priority
read no insert
write allow write
write concurrent insert
write delayed
write low priority
write normal</code></pre>
</div>
</li>
<li class="listitem">
<p>
An external lock corresponds to a lock in the storage
engine layer. This is currently implemented by a call to
<code class="literal">
handler::external_lock()
</code>
. In event
rows, these locks are distinguished by the
<code class="literal">
OPERATION
</code>
column, which has one of
these values:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-none"><div class="docs-select-all right" id="sa76827330"><div class="copy-help left">Press ⌘+C to 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">read external
write external</code></pre>
</div>
</li>
</ul>
</div>
<p>
The
<a class="link" href="performance-schema-table-wait-summary-tables.html#performance-schema-table-lock-waits-summary-by-table-table" title="29.12.20.8.3 The table_lock_waits_summary_by_table Table">
<code class="literal">
table_lock_waits_summary_by_table
</code>
</a>
table has these grouping columns to indicate how the table
aggregates events:
<code class="literal">
OBJECT_TYPE
</code>
,
<code class="literal">
OBJECT_SCHEMA
</code>
, and
<code class="literal">
OBJECT_NAME
</code>
. These columns have the same
meaning as in the
<a class="link" href="performance-schema-events-waits-current-table.html" title="29.12.4.1 The events_waits_current Table">
<code class="literal">
events_waits_current
</code>
</a>
table.
They identify the table to which the row applies.
</p>
<p>
<a class="link" href="performance-schema-table-wait-summary-tables.html#performance-schema-table-lock-waits-summary-by-table-table" title="29.12.20.8.3 The table_lock_waits_summary_by_table Table">
<code class="literal">
table_lock_waits_summary_by_table
</code>
</a>
has the following summary columns containing aggregated
values. As indicated in the column descriptions, some
columns are more general and have values that are the same
as the sum of the values of more fine-grained columns. For
example, columns that aggregate all locks hold the sum of
the corresponding columns that aggregate read and write
locks. In this way, aggregations at higher levels are
available directly without the need for user-defined views
that sum lower-level columns.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
COUNT_STAR
</code>
,
<code class="literal">
SUM_TIMER_WAIT
</code>
,
<code class="literal">
MIN_TIMER_WAIT
</code>
,
<code class="literal">
AVG_TIMER_WAIT
</code>
,
<code class="literal">
MAX_TIMER_WAIT
</code>
</p>
<p>
These columns aggregate all lock operations. They are
the same as the sum of the corresponding
<code class="literal">
<em class="replaceable">
<code>
xxx
</code>
</em>
_READ
</code>
and
<code class="literal">
<em class="replaceable">
<code>
xxx
</code>
</em>
_WRITE
</code>
columns.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
COUNT_READ
</code>
,
<code class="literal">
SUM_TIMER_READ
</code>
,
<code class="literal">
MIN_TIMER_READ
</code>
,
<code class="literal">
AVG_TIMER_READ
</code>
,
<code class="literal">
MAX_TIMER_READ
</code>
</p>
<p>
These columns aggregate all read-lock operations. They
are the same as the sum of the corresponding
<code class="literal">
<em class="replaceable">
<code>
xxx
</code>
</em>
_READ_NORMAL
</code>
,
<code class="literal">
<em class="replaceable">
<code>
xxx
</code>
</em>
_READ_WITH_SHARED_LOCKS
</code>
,
<code class="literal">
<em class="replaceable">
<code>
xxx
</code>
</em>
_READ_HIGH_PRIORITY
</code>
,
and
<code class="literal">
<em class="replaceable">
<code>
xxx
</code>
</em>
_READ_NO_INSERT
</code>
columns.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
COUNT_WRITE
</code>
,
<code class="literal">
SUM_TIMER_WRITE
</code>
,
<code class="literal">
MIN_TIMER_WRITE
</code>
,
<code class="literal">
AVG_TIMER_WRITE
</code>
,
<code class="literal">
MAX_TIMER_WRITE
</code>
</p>
<p>
These columns aggregate all write-lock operations. They
are the same as the sum of the corresponding
<code class="literal">
<em class="replaceable">
<code>
xxx
</code>
</em>
_WRITE_ALLOW_WRITE
</code>
,
<code class="literal">
<em class="replaceable">
<code>
xxx
</code>
</em>
_WRITE_CONCURRENT_INSERT
</code>
,
<code class="literal">
<em class="replaceable">
<code>
xxx
</code>
</em>
_WRITE_LOW_PRIORITY
</code>
,
and
<code class="literal">
<em class="replaceable">
<code>
xxx
</code>
</em>
_WRITE_NORMAL
</code>
columns.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
COUNT_READ_NORMAL
</code>
,
<code class="literal">
SUM_TIMER_READ_NORMAL
</code>
,
<code class="literal">
MIN_TIMER_READ_NORMAL
</code>
,
<code class="literal">
AVG_TIMER_READ_NORMAL
</code>
,
<code class="literal">
MAX_TIMER_READ_NORMAL
</code>
</p>
<p>
These columns aggregate internal read locks.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
COUNT_READ_WITH_SHARED_LOCKS
</code>
,
<code class="literal">
SUM_TIMER_READ_WITH_SHARED_LOCKS
</code>
,
<code class="literal">
MIN_TIMER_READ_WITH_SHARED_LOCKS
</code>
,
<code class="literal">
AVG_TIMER_READ_WITH_SHARED_LOCKS
</code>
,
<code class="literal">
MAX_TIMER_READ_WITH_SHARED_LOCKS
</code>
</p>
<p>
These columns aggregate internal read locks.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
COUNT_READ_HIGH_PRIORITY
</code>
,
<code class="literal">
SUM_TIMER_READ_HIGH_PRIORITY
</code>
,
<code class="literal">
MIN_TIMER_READ_HIGH_PRIORITY
</code>
,
<code class="literal">
AVG_TIMER_READ_HIGH_PRIORITY
</code>
,
<code class="literal">
MAX_TIMER_READ_HIGH_PRIORITY
</code>
</p>
<p>
These columns aggregate internal read locks.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
COUNT_READ_NO_INSERT
</code>
,
<code class="literal">
SUM_TIMER_READ_NO_INSERT
</code>
,
<code class="literal">
MIN_TIMER_READ_NO_INSERT
</code>
,
<code class="literal">
AVG_TIMER_READ_NO_INSERT
</code>
,
<code class="literal">
MAX_TIMER_READ_NO_INSERT
</code>
</p>
<p>
These columns aggregate internal read locks.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
COUNT_READ_EXTERNAL
</code>
,
<code class="literal">
SUM_TIMER_READ_EXTERNAL
</code>
,
<code class="literal">
MIN_TIMER_READ_EXTERNAL
</code>
,
<code class="literal">
AVG_TIMER_READ_EXTERNAL
</code>
,
<code class="literal">
MAX_TIMER_READ_EXTERNAL
</code>
</p>
<p>
These columns aggregate external read locks.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
COUNT_WRITE_ALLOW_WRITE
</code>
,
<code class="literal">
SUM_TIMER_WRITE_ALLOW_WRITE
</code>
,
<code class="literal">
MIN_TIMER_WRITE_ALLOW_WRITE
</code>
,
<code class="literal">
AVG_TIMER_WRITE_ALLOW_WRITE
</code>
,
<code class="literal">
MAX_TIMER_WRITE_ALLOW_WRITE
</code>
</p>
<p>
These columns aggregate internal write locks.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
COUNT_WRITE_CONCURRENT_INSERT
</code>
,
<code class="literal">
SUM_TIMER_WRITE_CONCURRENT_INSERT
</code>
,
<code class="literal">
MIN_TIMER_WRITE_CONCURRENT_INSERT
</code>
,
<code class="literal">
AVG_TIMER_WRITE_CONCURRENT_INSERT
</code>
,
<code class="literal">
MAX_TIMER_WRITE_CONCURRENT_INSERT
</code>
</p>
<p>
These columns aggregate internal write locks.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
COUNT_WRITE_LOW_PRIORITY
</code>
,
<code class="literal">
SUM_TIMER_WRITE_LOW_PRIORITY
</code>
,
<code class="literal">
MIN_TIMER_WRITE_LOW_PRIORITY
</code>
,
<code class="literal">
AVG_TIMER_WRITE_LOW_PRIORITY
</code>
,
<code class="literal">
MAX_TIMER_WRITE_LOW_PRIORITY
</code>
</p>
<p>
These columns aggregate internal write locks.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
COUNT_WRITE_NORMAL
</code>
,
<code class="literal">
SUM_TIMER_WRITE_NORMAL
</code>
,
<code class="literal">
MIN_TIMER_WRITE_NORMAL
</code>
,
<code class="literal">
AVG_TIMER_WRITE_NORMAL
</code>
,
<code class="literal">
MAX_TIMER_WRITE_NORMAL
</code>
</p>
<p>
These columns aggregate internal write locks.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
COUNT_WRITE_EXTERNAL
</code>
,
<code class="literal">
SUM_TIMER_WRITE_EXTERNAL
</code>
,
<code class="literal">
MIN_TIMER_WRITE_EXTERNAL
</code>
,
<code class="literal">
AVG_TIMER_WRITE_EXTERNAL
</code>
,
<code class="literal">
MAX_TIMER_WRITE_EXTERNAL
</code>
</p>
<p>
These columns aggregate external write locks.
</p>
</li>
</ul>
</div>
<p>
The
<a class="link" href="performance-schema-table-wait-summary-tables.html#performance-schema-table-lock-waits-summary-by-table-table" title="29.12.20.8.3 The table_lock_waits_summary_by_table Table">
<code class="literal">
table_lock_waits_summary_by_table
</code>
</a>
table has these indexes:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Unique index on (
<code class="literal">
OBJECT_TYPE
</code>
,
<code class="literal">
OBJECT_SCHEMA
</code>
,
<code class="literal">
OBJECT_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 permitted
for table lock summary tables. It resets the summary columns
to zero rather than removing rows.
</p>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/full-disk.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="full-disk">
</a>
B.3.3.4 How MySQL Handles a Full Disk
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045053851280">
</a>
<a class="indexterm" name="idm46045053850240">
</a>
<p>
This section describes how MySQL responds to disk-full errors
(such as
<span class="quote">
“
<span class="quote">
no space left on device
</span>
”
</span>
), and to
quota-exceeded errors (such as
<span class="quote">
“
<span class="quote">
write failed
</span>
”
</span>
or
<span class="quote">
“
<span class="quote">
user block limit reached
</span>
”
</span>
).
</p>
<p>
This section is relevant for writes to
<code class="literal">
MyISAM
</code>
tables. It also applies for writes
to binary log files and binary log index file, except that
references to
<span class="quote">
“
<span class="quote">
row
</span>
”
</span>
and
<span class="quote">
“
<span class="quote">
record
</span>
”
</span>
should be understood to mean
<span class="quote">
“
<span class="quote">
event.
</span>
”
</span>
</p>
<p>
When a disk-full condition occurs, MySQL does the following:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
It checks once every minute to see whether there is enough
space to write the current row. If there is enough space,
it continues as if nothing had happened.
</p>
</li>
<li class="listitem">
<p>
Every 10 minutes it writes an entry to the log file,
warning about the disk-full condition.
</p>
</li>
</ul>
</div>
<p>
To alleviate the problem, take the following actions:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
To continue, you only have to free enough disk space to
insert all records.
</p>
</li>
<li class="listitem">
<p>
Alternatively, to abort the thread, use
<a class="link" href="mysqladmin.html" title="6.5.2 mysqladmin — A MySQL Server Administration Program">
<span class="command">
<strong>
mysqladmin kill
</strong>
</span>
</a>
. The thread is aborted
the next time it checks the disk (in one minute).
</p>
</li>
<li class="listitem">
<p>
Other threads might be waiting for the table that caused
the disk-full condition. If you have several
<span class="quote">
“
<span class="quote">
locked
</span>
”
</span>
threads, killing the one thread that
is waiting on the disk-full condition enables the other
threads to continue.
</p>
</li>
</ul>
</div>
<p>
Exceptions to the preceding behavior are when you use
<a class="link" href="repair-table.html" title="15.7.3.5 REPAIR TABLE Statement">
<code class="literal">
REPAIR TABLE
</code>
</a>
or
<a class="link" href="optimize-table.html" title="15.7.3.4 OPTIMIZE TABLE Statement">
<code class="literal">
OPTIMIZE TABLE
</code>
</a>
or when the
indexes are created in a batch after
<a class="link" href="load-data.html" title="15.2.9 LOAD DATA Statement">
<code class="literal">
LOAD
DATA
</code>
</a>
or after an
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER
TABLE
</code>
</a>
statement. All of these statements may create
large temporary files that, if left to themselves, would cause
big problems for the rest of the system. If the disk becomes
full while MySQL is doing any of these operations, it removes
the big temporary files and mark the table as crashed. The
exception is that for
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER
TABLE
</code>
</a>
, the old table is left unchanged.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/mysql-cluster-backup.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="mysql-cluster-backup">
</a>
25.6.8 Online Backup of NDB Cluster
</h3>
</div>
</div>
</div>
<div class="toc">
<dl class="toc">
<dt>
<span class="section">
<a href="mysql-cluster-backup-concepts.html">
25.6.8.1 NDB Cluster Backup Concepts
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-cluster-backup-using-management-client.html">
25.6.8.2 Using The NDB Cluster Management Client to Create a Backup
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-cluster-backup-configuration.html">
25.6.8.3 Configuration for NDB Cluster Backups
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-cluster-backup-troubleshooting.html">
25.6.8.4 NDB Cluster Backup Troubleshooting
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-cluster-backup-parallel-data-nodes.html">
25.6.8.5 Taking an NDB Backup with Parallel Data Nodes
</a>
</span>
</dt>
</dl>
</div>
<a class="indexterm" name="idm46045092160224">
</a>
<a class="indexterm" name="idm46045092158768">
</a>
<p>
The next few sections describe how to prepare for and then to
create an NDB Cluster backup using the functionality for this
purpose found in 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>
management client.
To distinguish this type of backup from a backup made using
<a class="link" href="mysqldump.html" title="6.5.4 mysqldump — A Database Backup Program">
<span class="command">
<strong>
mysqldump
</strong>
</span>
</a>
, we sometimes refer to it as a
<span class="quote">
“
<span class="quote">
native
</span>
”
</span>
NDB Cluster backup. (For information about
the creation of backups with
<a class="link" href="mysqldump.html" title="6.5.4 mysqldump — A Database Backup Program">
<span class="command">
<strong>
mysqldump
</strong>
</span>
</a>
, see
<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>
.) Restoration of NDB Cluster backups
is done using the
<a class="link" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
<span class="command">
<strong>
ndb_restore
</strong>
</span>
</a>
utility provided
with the NDB Cluster distribution; for information about
<a class="link" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
<span class="command">
<strong>
ndb_restore
</strong>
</span>
</a>
and its use in restoring NDB
Cluster backups, see
<a class="xref" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
Section 25.5.23, “ndb_restore — Restore an NDB Cluster Backup”
</a>
.
</p>
<p>
It is also possible to create backups using multiple LDMs to
achieve parallelism on the data nodes. See
<a class="xref" href="mysql-cluster-backup-parallel-data-nodes.html" title="25.6.8.5 Taking an NDB Backup with Parallel Data Nodes">
Section 25.6.8.5, “Taking an NDB Backup with Parallel Data Nodes”
</a>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/sys-list-drop.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="sys-list-drop">
</a>
30.4.5.8 The list_drop() Function
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045060904464">
</a>
<a class="indexterm" name="idm46045060903008">
</a>
<p>
Removes a value from a comma-separated list of values and
returns the result. For more information, see the description
of
<a class="link" href="sys-list-add.html" title="30.4.5.7 The list_add() Function">
<code class="literal">
list_add()
</code>
</a>
</p>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="sys-list-drop-parameters">
</a>
Parameters
</h5>
</div>
</div>
</div>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
in_list TEXT
</code>
: The list to be
modified.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
in_drop_value TEXT
</code>
: The value to drop
from the list.
</p>
</li>
</ul>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="sys-list-drop-return-value">
</a>
Return Value
</h5>
</div>
</div>
</div>
<p>
A
<code class="literal">
TEXT
</code>
value.
</p>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/innodb-multiple-buffer-pools.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="innodb-multiple-buffer-pools">
</a>
17.8.3.2 Configuring Multiple Buffer Pool Instances
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045163167328">
</a>
<a class="indexterm" name="idm46045163166256">
</a>
<a class="indexterm" name="idm46045163165184">
</a>
<p>
For systems with buffer pools in the multi-gigabyte range,
dividing the buffer pool into separate instances can improve
concurrency, by reducing contention as different threads read
and write to cached pages. This feature is typically intended
for systems with a
<a class="link" href="glossary.html#glos_buffer_pool" title="buffer pool">
buffer
pool
</a>
size in the multi-gigabyte range. Multiple buffer
pool instances are configured using the
<a class="link" href="innodb-parameters.html#sysvar_innodb_buffer_pool_instances">
<code class="literal">
innodb_buffer_pool_instances
</code>
</a>
configuration option, and you might also adjust the
<a class="link" href="innodb-parameters.html#sysvar_innodb_buffer_pool_size">
<code class="literal">
innodb_buffer_pool_size
</code>
</a>
value.
</p>
<p>
When the
<code class="literal">
InnoDB
</code>
buffer pool is large, many
data requests can be satisfied by retrieving from memory. You
might encounter bottlenecks from multiple threads trying to
access the buffer pool at once. You can enable multiple buffer
pools to minimize this contention. Each page that is stored in
or read from the buffer pool is assigned to one of the buffer
pools randomly, using a hashing function. Each buffer pool
manages its own free lists, flush lists, LRUs, and all other
data structures connected to a buffer pool.
</p>
<p>
To enable multiple buffer pool instances, set the
<code class="literal">
innodb_buffer_pool_instances
</code>
configuration
option to a value greater than 1 (the default) up to 64 (the
maximum). This option takes effect only when you set
<code class="literal">
innodb_buffer_pool_size
</code>
to a size of 1GB or
more. The total size you specify is divided among all the buffer
pools. For best efficiency, specify a combination of
<a class="link" href="innodb-parameters.html#sysvar_innodb_buffer_pool_instances">
<code class="literal">
innodb_buffer_pool_instances
</code>
</a>
and
<a class="link" href="innodb-parameters.html#sysvar_innodb_buffer_pool_size">
<code class="literal">
innodb_buffer_pool_size
</code>
</a>
so
that each buffer pool instance is at least 1GB.
</p>
<p>
For information about modifying
<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>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/innodb-online-ddl-limitations.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="innodb-online-ddl-limitations">
</a>
17.12.8 Online DDL Limitations
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045159464192">
</a>
<a class="indexterm" name="idm46045159462704">
</a>
<a class="indexterm" name="idm46045159461216">
</a>
<p>
The following limitations apply to online DDL operations:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
The table is copied when creating an index on a
<code class="literal">
TEMPORARY TABLE
</code>
.
</p>
</li>
<li class="listitem">
<p>
The
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER TABLE
</code>
</a>
clause
<code class="literal">
LOCK=NONE
</code>
is not permitted if there are
<code class="literal">
ON...CASCADE
</code>
or
<code class="literal">
ON...SET
NULL
</code>
constraints on the table.
</p>
</li>
<li class="listitem">
<p>
Before an in-place online DDL operation can finish, it must
wait for transactions that hold metadata locks on the table to
commit or roll back. An online DDL operation may briefly
require an exclusive metadata lock on the table during its
execution phase, and always requires one in the final phase of
the operation when updating the table definition.
Consequently, transactions holding metadata locks on the table
can cause an online DDL operation to block. The transactions
that hold metadata locks on the table may have been started
before or during the online DDL operation. A long running or
inactive transaction that holds a metadata lock on the table
can cause an online DDL operation to timeout.
</p>
</li>
<li class="listitem">
<p>
When running an in-place online DDL operation, the thread that
runs the
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER TABLE
</code>
</a>
statement
applies an online log of DML operations that were run
concurrently on the same table from other connection threads.
When the DML operations are applied, it is possible to
encounter a duplicate key entry error (
<span class="errortext">
ERROR 1062
(23000): Duplicate entry
</span>
), even if the duplicate
entry is only temporary and would be reverted by a later entry
in the online log. This is similar to the idea of a foreign
key constraint check in
<code class="literal">
InnoDB
</code>
in which
constraints must hold during a transaction.
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="optimize-table.html" title="15.7.3.4 OPTIMIZE TABLE Statement">
<code class="literal">
OPTIMIZE TABLE
</code>
</a>
for an
<code class="literal">
InnoDB
</code>
table is mapped to an
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER TABLE
</code>
</a>
operation to
rebuild the table and update index statistics and free unused
space in the clustered index. Secondary indexes are not
created as efficiently because keys are inserted in the order
they appeared in the primary key.
<a class="link" href="optimize-table.html" title="15.7.3.4 OPTIMIZE TABLE Statement">
<code class="literal">
OPTIMIZE TABLE
</code>
</a>
is supported
with the addition of online DDL support for rebuilding regular
and partitioned
<code class="literal">
InnoDB
</code>
tables.
</p>
</li>
<li class="listitem">
<p>
Tables created before MySQL 5.6 that include temporal columns
(
<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="datetime.html" title="13.2.2 The DATE, DATETIME, and TIMESTAMP Types">
<code class="literal">
DATETIME
</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>
) and have not been
rebuilt using
<code class="literal">
ALGORITHM=COPY
</code>
do not
support
<code class="literal">
ALGORITHM=INPLACE
</code>
. In this case, an
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER TABLE ...
ALGORITHM=INPLACE
</code>
</a>
operation returns the following
error:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa8088400"><div class="copy-help left">Press ⌘+C to 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">ERROR 1846 (0A000)<span class="token punctuation">:</span> ALGORITHM=INPLACE is not supported.
Reason<span class="token punctuation">:</span> Cannot change column type INPLACE. Try ALGORITHM=COPY.</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
The following limitations are generally applicable to online
DDL operations on large tables that involve rebuilding the
table:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
There is no mechanism to pause an online DDL operation or
to throttle I/O or CPU usage for an online DDL operation.
</p>
</li>
<li class="listitem">
<p>
Rollback of an online DDL operation can be expensive
should the operation fail.
</p>
</li>
<li class="listitem">
<p>
Long running online DDL operations can cause replication
lag. An online DDL operation must finish running on the
source before it is run on the replica. Also, DML that was
processed concurrently on the source is only processed on
the replica after the DDL operation on the replica is
completed.
</p>
</li>
</ul>
</div>
<p>
For additional information related to running online DDL
operations on large tables, see
<a class="xref" href="innodb-online-ddl-performance.html" title="17.12.2 Online DDL Performance and Concurrency">
Section 17.12.2, “Online DDL Performance and Concurrency”
</a>
.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/sys-ps-setup-disable-instrument.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="sys-ps-setup-disable-instrument">
</a>
30.4.4.6 The ps_setup_disable_instrument() Procedure
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045061523008">
</a>
<a class="indexterm" name="idm46045061521552">
</a>
<p>
Disables Performance Schema instruments with names that
contain the argument. Produces a result set indicating how
many instruments were disabled. Already disabled instruments
do not count.
</p>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="sys-ps-setup-disable-instrument-parameters">
</a>
Parameters
</h5>
</div>
</div>
</div>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
in_pattern VARCHAR(128)
</code>
: The value
used to match instrument names, which are identified by
using
<code class="literal">
%in_pattern%
</code>
as an operand for
a
<a class="link" href="string-comparison-functions.html#operator_like">
<code class="literal">
LIKE
</code>
</a>
pattern match.
</p>
<p>
A value of
<code class="literal">
''
</code>
matches all
instruments.
</p>
</li>
</ul>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="sys-ps-setup-disable-instrument-example">
</a>
Example
</h5>
</div>
</div>
</div>
<p>
Disable a specific instrument:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa70632473"><div class="copy-help left">Press ⌘+C to 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">CALL</span> sys<span class="token punctuation">.</span>ps_setup_disable_instrument<span class="token punctuation">(</span><span class="token string">'wait/lock/metadata/sql/mdl'</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>
<span class="token output"><span class="token punctuation">|</span> summary <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> Disabled 1 instrument <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>
Disable all mutex instruments:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa12844113"><div class="copy-help left">Press ⌘+C to 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">CALL</span> sys<span class="token punctuation">.</span>ps_setup_disable_instrument<span class="token punctuation">(</span><span class="token string">'mutex'</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>
<span class="token output"><span class="token punctuation">|</span> summary <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>
<span class="token output"><span class="token punctuation">|</span> Disabled 177 instruments <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></code></pre>
</div>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/myisamchk.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="myisamchk">
</a>
6.6.4 myisamchk — MyISAM Table-Maintenance Utility
</h3>
</div>
</div>
</div>
<div class="toc">
<dl class="toc">
<dt>
<span class="section">
<a href="myisamchk-general-options.html">
6.6.4.1 myisamchk General Options
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="myisamchk-check-options.html">
6.6.4.2 myisamchk Check Options
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="myisamchk-repair-options.html">
6.6.4.3 myisamchk Repair Options
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="myisamchk-other-options.html">
6.6.4.4 Other myisamchk Options
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="myisamchk-table-info.html">
6.6.4.5 Obtaining Table Information with myisamchk
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="myisamchk-memory.html">
6.6.4.6 myisamchk Memory Usage
</a>
</span>
</dt>
</dl>
</div>
<a class="indexterm" name="idm46045307751424">
</a>
<p>
The
<a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
<span class="command">
<strong>
myisamchk
</strong>
</span>
</a>
utility gets information about
your database tables or checks, repairs, or optimizes them.
<a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
<span class="command">
<strong>
myisamchk
</strong>
</span>
</a>
works with
<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).
</p>
<p>
You can also use the
<a class="link" href="check-table.html" title="15.7.3.2 CHECK TABLE Statement">
<code class="literal">
CHECK TABLE
</code>
</a>
and
<a class="link" href="repair-table.html" title="15.7.3.5 REPAIR TABLE Statement">
<code class="literal">
REPAIR TABLE
</code>
</a>
statements to
check and repair
<code class="literal">
MyISAM
</code>
tables. See
<a class="xref" href="check-table.html" title="15.7.3.2 CHECK TABLE Statement">
Section 15.7.3.2, “CHECK TABLE Statement”
</a>
, and
<a class="xref" href="repair-table.html" title="15.7.3.5 REPAIR TABLE Statement">
Section 15.7.3.5, “REPAIR TABLE Statement”
</a>
.
</p>
<p>
The use of
<a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
<span class="command">
<strong>
myisamchk
</strong>
</span>
</a>
with partitioned tables
is not supported.
</p>
<div class="caution" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Caution
</div>
<p>
It is best to make a backup of a table before performing a
table repair operation; under some circumstances the operation
might cause data loss. Possible causes include but are not
limited to file system errors.
</p>
</div>
<p>
Invoke
<a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
<span class="command">
<strong>
myisamchk
</strong>
</span>
</a>
like this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa87376921"><div class="copy-help left">Press ⌘+C to 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">myisamchk <span class="token punctuation">[</span><em class="replaceable">options</em><span class="token punctuation">]</span> <em class="replaceable">tbl_name</em> <span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span></code></pre>
</div>
<p>
The
<em class="replaceable">
<code>
options
</code>
</em>
specify what you want
<a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
<span class="command">
<strong>
myisamchk
</strong>
</span>
</a>
to do. They are described in the
following sections. You can also get a list of options by
invoking
<a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
<span class="command">
<strong>
myisamchk --help
</strong>
</span>
</a>
.
</p>
<p>
With no options,
<a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
<span class="command">
<strong>
myisamchk
</strong>
</span>
</a>
simply checks your
table as the default operation. To get more information or to
tell
<a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
<span class="command">
<strong>
myisamchk
</strong>
</span>
</a>
to take corrective action,
specify options as described in the following discussion.
</p>
<p>
<em class="replaceable">
<code>
tbl_name
</code>
</em>
is the database table you
want to check or repair. If you run
<a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
<span class="command">
<strong>
myisamchk
</strong>
</span>
</a>
somewhere other than in the database directory, you must specify
the path to the database directory, because
<a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
<span class="command">
<strong>
myisamchk
</strong>
</span>
</a>
has no idea where the database is
located. In fact,
<a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
<span class="command">
<strong>
myisamchk
</strong>
</span>
</a>
does not actually
care whether the files you are working on are located in a
database directory. You can copy the files that correspond to a
database table into some other location and perform recovery
operations on them there.
</p>
<p>
You can name several tables on the
<a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
<span class="command">
<strong>
myisamchk
</strong>
</span>
</a>
command line if you wish. You can also specify a table by naming
its index file (the file with the
<code class="filename">
.MYI
</code>
suffix). This enables you to specify all tables in a directory
by using the pattern
<code class="filename">
*.MYI
</code>
. For example, if
you are in a database directory, you can check all the
<code class="literal">
MyISAM
</code>
tables in that directory like this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa75270679"><div class="copy-help left">Press ⌘+C to 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">myisamchk *<span class="token punctuation">.</span>MYI</code></pre>
</div>
<p>
If you are not in the database directory, you can check all the
tables there by specifying the path to the directory:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa83915613"><div class="copy-help left">Press ⌘+C to 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">myisamchk <em class="replaceable">/path/to/database_dir/</em>*<span class="token punctuation">.</span>MYI</code></pre>
</div>
<p>
You can even check all tables in all databases by specifying a
wildcard with the path to the MySQL data directory:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa66496"><div class="copy-help left">Press ⌘+C to 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">myisamchk <em class="replaceable">/path/to/datadir/*/*</em><span class="token punctuation">.</span>MYI</code></pre>
</div>
<p>
The recommended way to quickly check all
<code class="literal">
MyISAM
</code>
tables is:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa59562425"><div class="copy-help left">Press ⌘+C to 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">myisamchk <span class="token property">--silent</span> <span class="token property">--fast</span> <em class="replaceable">/path/to/datadir/*/*</em><span class="token punctuation">.</span>MYI</code></pre>
</div>
<p>
If you want to check all
<code class="literal">
MyISAM
</code>
tables and
repair any that are corrupted, you can use the following
command:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa18769702"><div class="copy-help left">Press ⌘+C to 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">myisamchk <span class="token property">--silent</span> <span class="token property">--force</span> <span class="token property">--fast</span> <span class="token property">--update-state</span> \
<span class="token constant">--key_buffer_size</span><span class="token attr-value"><span class="token punctuation">=</span>64M</span> <span class="token constant">--myisam_sort_buffer_size</span><span class="token attr-value"><span class="token punctuation">=</span>64M</span> \
<span class="token constant">--read_buffer_size</span><span class="token attr-value"><span class="token punctuation">=</span>1M</span> <span class="token constant">--write_buffer_size</span><span class="token attr-value"><span class="token punctuation">=</span>1M</span> \
<em class="replaceable">/path/to/datadir/*/*</em><span class="token punctuation">.</span>MYI</code></pre>
</div>
<p>
This command assumes that you have more than 64MB free. For more
information about memory allocation with
<a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
<span class="command">
<strong>
myisamchk
</strong>
</span>
</a>
, see
<a class="xref" href="myisamchk-memory.html" title="6.6.4.6 myisamchk Memory Usage">
Section 6.6.4.6, “myisamchk Memory Usage”
</a>
.
</p>
<p>
For additional 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>
, see
<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>
<div class="important" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Important
</div>
<p>
<span class="emphasis">
<em>
You must ensure that no other program is using the
tables while you are running
<a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
<span class="command">
<strong>
myisamchk
</strong>
</span>
</a>
</em>
</span>
. The most effective
means of doing so is to shut down the MySQL server while
running
<a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
<span class="command">
<strong>
myisamchk
</strong>
</span>
</a>
, or to lock all tables
that
<a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
<span class="command">
<strong>
myisamchk
</strong>
</span>
</a>
is being used on.
</p>
<p>
Otherwise, when you run
<a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
<span class="command">
<strong>
myisamchk
</strong>
</span>
</a>
, it may
display the following error message:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-none"><div class="docs-select-all right" id="sa28840136"><div class="copy-help left">Press ⌘+C to 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">warning: clients are using or haven't closed the table properly</code></pre>
</div>
<p>
This means that you are trying to check a table that has been
updated by another program (such as the
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
server) that hasn't yet closed the
file or that has died without closing the file properly, which
can sometimes lead to the corruption of one or more
<code class="literal">
MyISAM
</code>
tables.
</p>
<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 running, you must force it to
flush any table modifications that are still buffered in
memory by using
<a class="link" href="flush.html#flush-tables">
<code class="literal">
FLUSH TABLES
</code>
</a>
.
You should then ensure that no one is using the tables while
you are running
<a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
<span class="command">
<strong>
myisamchk
</strong>
</span>
</a>
</p>
<p>
However, the easiest way to avoid this problem is to use
<a class="link" href="check-table.html" title="15.7.3.2 CHECK TABLE Statement">
<code class="literal">
CHECK TABLE
</code>
</a>
instead of
<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 tables. See
<a class="xref" href="check-table.html" title="15.7.3.2 CHECK TABLE Statement">
Section 15.7.3.2, “CHECK TABLE Statement”
</a>
.
</p>
</div>
<p>
<a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
<span class="command">
<strong>
myisamchk
</strong>
</span>
</a>
supports the following options,
which can be specified on the command line or in the
<code class="literal">
[myisamchk]
</code>
group of an option file. For
information about option files used by MySQL programs, 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>
.
</p>
<div class="table">
<a name="idm46045307681520">
</a>
<p class="title">
<b>
Table 6.17 myisamchk Options
</b>
</p>
<div class="table-contents">
<table frame="box" rules="all" summary="Command-line options available for myisamchk.">
<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="myisamchk-other-options.html#option_myisamchk_analyze">
--analyze
</a>
</td>
<td>
Analyze the distribution of key values
</td>
</tr>
<tr>
<td>
<a class="link" href="myisamchk-repair-options.html#option_myisamchk_backup">
--backup
</a>
</td>
<td>
Make a backup of the .MYD file as file_name-time.BAK
</td>
</tr>
<tr>
<td>
<a class="link" href="myisamchk-other-options.html#option_myisamchk_block-search">
--block-search
</a>
</td>
<td>
Find the record that a block at the given offset belongs to
</td>
</tr>
<tr>
<td>
<a class="link" href="myisamchk-repair-options.html#option_myisamchk_character-sets-dir">
--character-sets-dir
</a>
</td>
<td>
Directory where character sets can be found
</td>
</tr>
<tr>
<td>
<a class="link" href="myisamchk-check-options.html#option_myisamchk_check">
--check
</a>
</td>
<td>
Check the table for errors
</td>
</tr>
<tr>
<td>
<a class="link" href="myisamchk-check-options.html#option_myisamchk_check-only-changed">
--check-only-changed
</a>
</td>
<td>
Check only tables that have changed since the last check
</td>
</tr>
<tr>
<td>
<a class="link" href="myisamchk-repair-options.html#option_myisamchk_correct-checksum">
--correct-checksum
</a>
</td>
<td>
Correct the checksum information for the table
</td>
</tr>
<tr>
<td>
<a class="link" href="myisamchk-repair-options.html#option_myisamchk_data-file-length">
--data-file-length
</a>
</td>
<td>
Maximum length of the data file (when re-creating data file when it is full)
</td>
</tr>
<tr>
<td>
<a class="link" href="myisamchk-general-options.html#option_myisamchk_debug">
--debug
</a>
</td>
<td>
Write debugging log
</td>
</tr>
<tr>
<td>
--decode_bits
</td>
<td>
Decode_bits
</td>
</tr>
<tr>
<td>
<a class="link" href="myisamchk-general-options.html#option_myisamchk_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="myisamchk-general-options.html#option_myisamchk_defaults-file">
--defaults-file
</a>
</td>
<td>
Read only named option file
</td>
</tr>
<tr>
<td>
<a class="link" href="myisamchk-general-options.html#option_myisamchk_defaults-group-suffix">
--defaults-group-suffix
</a>
</td>
<td>
Option group suffix value
</td>
</tr>
<tr>
<td>
<a class="link" href="myisamchk-other-options.html#option_myisamchk_description">
--description
</a>
</td>
<td>
Print some descriptive information about the table
</td>
</tr>
<tr>
<td>
<a class="link" href="myisamchk-check-options.html#option_myisamchk_extend-check">
--extend-check
</a>
</td>
<td>
Do very thorough table check or repair that tries to recover every possible row from the data file
</td>
</tr>
<tr>
<td>
<a class="link" href="myisamchk-check-options.html#option_myisamchk_fast">
--fast
</a>
</td>
<td>
Check only tables that haven't been closed properly
</td>
</tr>
<tr>
<td>
<a class="link" href="myisamchk-check-options.html#option_myisamchk_force">
--force
</a>
</td>
<td>
Do a repair operation automatically if myisamchk finds any errors in the table
</td>
</tr>
<tr>
<td>
--force
</td>
<td>
Overwrite old temporary files. For use with the -r or -o option
</td>
</tr>
<tr>
<td>
--ft_max_word_len
</td>
<td>
Maximum word length for FULLTEXT indexes
</td>
</tr>
<tr>
<td>
--ft_min_word_len
</td>
<td>
Minimum word length for FULLTEXT indexes
</td>
</tr>
<tr>
<td>
--ft_stopword_file
</td>
<td>
Use stopwords from this file instead of built-in list
</td>
</tr>
<tr>
<td>
<a class="link" href="myisamchk-general-options.html#option_myisamchk_HELP">
--HELP
</a>
</td>
<td>
Display help message and exit
</td>
</tr>
<tr>
<td>
<a class="link" href="myisamchk-general-options.html#option_myisamchk_help">
--help
</a>
</td>
<td>
Display help message and exit
</td>
</tr>
<tr>
<td>
<a class="link" href="myisamchk-check-options.html#option_myisamchk_information">
--information
</a>
</td>
<td>
Print informational statistics about the table that is checked
</td>
</tr>
<tr>
<td>
--key_buffer_size
</td>
<td>
Size of buffer used for index blocks for MyISAM tables
</td>
</tr>
<tr>
<td>
<a class="link" href="myisamchk-repair-options.html#option_myisamchk_keys-used">
--keys-used
</a>
</td>
<td>
A bit-value that indicates which indexes to update
</td>
</tr>
<tr>
<td>
<a class="link" href="myisamchk-repair-options.html#option_myisamchk_max-record-length">
--max-record-length
</a>
</td>
<td>
Skip rows larger than the given length if myisamchk cannot allocate memory to hold them
</td>
</tr>
<tr>
<td>
<a class="link" href="myisamchk-check-options.html#option_myisamchk_medium-check">
--medium-check
</a>
</td>
<td>
Do a check that is faster than an --extend-check operation
</td>
</tr>
<tr>
<td>
--myisam_block_size
</td>
<td>
Block size to be used for MyISAM index pages
</td>
</tr>
<tr>
<td>
--myisam_sort_buffer_size
</td>
<td>
The buffer that is allocated when sorting the index when doing a REPAIR or when creating indexes with CREATE INDEX or ALTER TABLE
</td>
</tr>
<tr>
<td>
<a class="link" href="myisamchk-general-options.html#option_myisamchk_no-defaults">
--no-defaults
</a>
</td>
<td>
Read no option files
</td>
</tr>
<tr>
<td>
--parallel-recover
</td>
<td>
Uses the same technique as -r and -n, but creates all the keys in parallel, using different threads (beta)
</td>
</tr>
<tr>
<td>
<a class="link" href="myisamchk-general-options.html#option_myisamchk_print-defaults">
--print-defaults
</a>
</td>
<td>
Print default options
</td>
</tr>
<tr>
<td>
<a class="link" href="myisamchk-repair-options.html#option_myisamchk_quick">
--quick
</a>
</td>
<td>
Achieve a faster repair by not modifying the data file
</td>
</tr>
<tr>
<td>
--read_buffer_size
</td>
<td>
Each thread that does a sequential scan allocates a buffer of this size for each table it scans
</td>
</tr>
<tr>
<td>
<a class="link" href="myisamchk-check-options.html#option_myisamchk_read-only">
--read-only
</a>
</td>
<td>
Do not mark the table as checked
</td>
</tr>
<tr>
<td>
<a class="link" href="myisamchk-repair-options.html#option_myisamchk_recover">
--recover
</a>
</td>
<td>
Do a repair that can fix almost any problem except unique keys that aren't unique
</td>
</tr>
<tr>
<td>
<a class="link" href="myisamchk-repair-options.html#option_myisamchk_safe-recover">
--safe-recover
</a>
</td>
<td>
Do a repair using an old recovery method that reads through all rows in order and updates all index trees based on the rows found
</td>
</tr>
<tr>
<td>
<a class="link" href="myisamchk-other-options.html#option_myisamchk_set-auto-increment">
--set-auto-increment
</a>
</td>
<td>
Force AUTO_INCREMENT numbering for new records to start at the given value
</td>
</tr>
<tr>
<td>
<a class="link" href="myisamchk-repair-options.html#option_myisamchk_set-collation">
--set-collation
</a>
</td>
<td>
Specify the collation to use for sorting table indexes
</td>
</tr>
<tr>
<td>
<a class="link" href="myisamchk-general-options.html#option_myisamchk_silent">
--silent
</a>
</td>
<td>
Silent mode
</td>
</tr>
<tr>
<td>
--sort_buffer_size
</td>
<td>
The buffer that is allocated when sorting the index when doing a REPAIR or when creating indexes with CREATE INDEX or ALTER TABLE
</td>
</tr>
<tr>
<td>
<a class="link" href="myisamchk-other-options.html#option_myisamchk_sort-index">
--sort-index
</a>
</td>
<td>
Sort the index tree blocks in high-low order
</td>
</tr>
<tr>
<td>
--sort_key_blocks
</td>
<td>
sort_key_blocks
</td>
</tr>
<tr>
<td>
<a class="link" href="myisamchk-other-options.html#option_myisamchk_sort-records">
--sort-records
</a>
</td>
<td>
Sort records according to a particular index
</td>
</tr>
<tr>
<td>
<a class="link" href="myisamchk-repair-options.html#option_myisamchk_sort-recover">
--sort-recover
</a>
</td>
<td>
Force myisamchk to use sorting to resolve the keys even if the temporary files would be very large
</td>
</tr>
<tr>
<td>
--stats_method
</td>
<td>
Specifies how MyISAM index statistics collection code should treat NULLs
</td>
</tr>
<tr>
<td>
<a class="link" href="myisamchk-repair-options.html#option_myisamchk_tmpdir">
--tmpdir
</a>
</td>
<td>
Directory to be used for storing temporary files
</td>
</tr>
<tr>
<td>
<a class="link" href="myisamchk-repair-options.html#option_myisamchk_unpack">
--unpack
</a>
</td>
<td>
Unpack a table that was packed with myisampack
</td>
</tr>
<tr>
<td>
<a class="link" href="myisamchk-check-options.html#option_myisamchk_update-state">
--update-state
</a>
</td>
<td>
Store information in the .MYI file to indicate when the table was checked and whether the table crashed
</td>
</tr>
<tr>
<td>
<a class="link" href="myisamchk-general-options.html#option_myisamchk_verbose">
--verbose
</a>
</td>
<td>
Verbose mode
</td>
</tr>
<tr>
<td>
<a class="link" href="myisamchk-general-options.html#option_myisamchk_version">
--version
</a>
</td>
<td>
Display version information and exit
</td>
</tr>
<tr>
<td>
<a class="link" href="myisamchk-general-options.html#option_myisamchk_wait">
--wait
</a>
</td>
<td>
Wait for locked table to be unlocked, instead of terminating
</td>
</tr>
<tr>
<td>
--write_buffer_size
</td>
<td>
Write buffer size
</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>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/account-locking.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="account-locking">
</a>
8.2.20 Account Locking
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045247598176">
</a>
<p>
MySQL supports locking and unlocking user accounts using the
<code class="literal">
ACCOUNT LOCK
</code>
and
<code class="literal">
ACCOUNT
UNLOCK
</code>
clauses for the
<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="alter-user.html" title="15.7.1.1 ALTER USER Statement">
<code class="literal">
ALTER USER
</code>
</a>
statements:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
When used with
<a class="link" href="create-user.html" title="15.7.1.3 CREATE USER Statement">
<code class="literal">
CREATE USER
</code>
</a>
,
these clauses specify the initial locking state for a new
account. In the absence of either clause, the account is
created in an unlocked state.
</p>
<p>
If the
<code class="literal">
validate_password
</code>
component is
enabled, creating an account without a password is not
permitted, even if the account is locked. See
<a class="xref" href="validate-password.html" title="8.4.3 The Password Validation Component">
Section 8.4.3, “The Password Validation Component”
</a>
.
</p>
</li>
<li class="listitem">
<p>
When used with
<a class="link" href="alter-user.html" title="15.7.1.1 ALTER USER Statement">
<code class="literal">
ALTER USER
</code>
</a>
,
these clauses specify the new locking state for an existing
account. In the absence of either clause, the account locking
state remains unchanged.
</p>
<p>
<a class="link" href="alter-user.html" title="15.7.1.1 ALTER USER Statement">
<code class="literal">
ALTER USER ...
UNLOCK
</code>
</a>
unlocks any account named by the statement
that is temporarily locked due to too many failed logins. See
<a class="xref" href="password-management.html" title="8.2.15 Password Management">
Section 8.2.15, “Password Management”
</a>
.
</p>
</li>
</ul>
</div>
<p>
Account locking state is recorded in the
<code class="literal">
account_locked
</code>
column of the
<code class="literal">
mysql.user
</code>
system table. The output from
<a class="link" href="show-create-user.html" title="15.7.7.13 SHOW CREATE USER Statement">
<code class="literal">
SHOW CREATE USER
</code>
</a>
indicates whether
an account is locked or unlocked.
</p>
<p>
If a client attempts to connect to a locked account, the attempt
fails. The server increments the
<a class="link" href="server-status-variables.html#statvar_Locked_connects">
<code class="literal">
Locked_connects
</code>
</a>
status variable
that indicates the number of attempts to connect to a locked
account, returns an
<a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_account_has_been_locked" target="_top">
<code class="literal">
ER_ACCOUNT_HAS_BEEN_LOCKED
</code>
</a>
error,
and writes a message to the error log:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-none"><div class="docs-select-all right" id="sa57521029"><div class="copy-help left">Press ⌘+C to 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">Access denied for user '<em class="replaceable">user_name</em>'@'<em class="replaceable">host_name</em>'.
Account is locked.</code></pre>
</div>
<p>
Locking an account does not affect being able to connect using a
proxy user that assumes the identity of the locked account. It
also does not affect the ability to execute stored programs or
views that have a
<code class="literal">
DEFINER
</code>
attribute naming the
locked account. That is, the ability to use a proxied account or
stored programs or views is not affected by locking the account.
</p>
<p>
The account-locking capability depends on the presence of the
<code class="literal">
account_locked
</code>
column in the
<code class="literal">
mysql.user
</code>
system table. For upgrades from
MySQL versions older than 5.7.6, perform the MySQL upgrade
procedure to ensure that this column exists. See
<a class="xref" href="upgrading.html" title="Chapter 3 Upgrading MySQL">
Chapter 3,
<i>
Upgrading MySQL
</i>
</a>
. For nonupgraded installations that
have no
<code class="literal">
account_locked
</code>
column, the server
treats all accounts as unlocked, and using the
<code class="literal">
ACCOUNT
LOCK
</code>
or
<code class="literal">
ACCOUNT UNLOCK
</code>
clauses
produces an error.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/examples.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title">
<a name="examples">
</a>
5.6 Examples of Common Queries
</h2>
</div>
</div>
</div>
<div class="toc">
<dl class="toc">
<dt>
<span class="section">
<a href="example-maximum-column.html">
5.6.1 The Maximum Value for a Column
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="example-maximum-row.html">
5.6.2 The Row Holding the Maximum of a Certain Column
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="example-maximum-column-group.html">
5.6.3 Maximum of Column per Group
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="example-maximum-column-group-row.html">
5.6.4 The Rows Holding the Group-wise Maximum of a Certain Column
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="example-user-variables.html">
5.6.5 Using User-Defined Variables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="example-foreign-keys.html">
5.6.6 Using Foreign Keys
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="searching-on-two-keys.html">
5.6.7 Searching on Two Keys
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="calculating-days.html">
5.6.8 Calculating Visits Per Day
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="example-auto-increment.html">
5.6.9 Using AUTO_INCREMENT
</a>
</span>
</dt>
</dl>
</div>
<a class="indexterm" name="idm46045324738832">
</a>
<a class="indexterm" name="idm46045324737376">
</a>
<p>
Here are examples of how to solve some common problems with MySQL.
</p>
<p>
Some of the examples use the table
<code class="literal">
shop
</code>
to hold
the price of each article (item number) for certain traders
(dealers). Supposing that each trader has a single fixed price per
article, then (
<code class="literal">
article
</code>
,
<code class="literal">
dealer
</code>
) is a primary key for the records.
</p>
<p>
Start the command-line tool
<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 select a
database:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa33660561"><div class="copy-help left">Press ⌘+C to 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> <em class="replaceable">your-database-name</em></code></pre>
</div>
<p>
To create and populate the example table, use these statements:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa82947042"><div class="copy-help left">Press ⌘+C to 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> shop <span class="token punctuation">(</span>
article <span class="token datatype">INT</span> <span class="token keyword">UNSIGNED</span> <span class="token keyword">DEFAULT</span> <span class="token string">'0000'</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span><span class="token punctuation">,</span>
dealer <span class="token datatype">CHAR</span><span class="token punctuation">(</span><span class="token number">20</span><span class="token punctuation">)</span> <span class="token keyword">DEFAULT</span> <span class="token string">''</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span><span class="token punctuation">,</span>
price <span class="token datatype">DECIMAL</span><span class="token punctuation">(</span><span class="token number">16</span><span class="token punctuation">,</span><span class="token number">2</span><span class="token punctuation">)</span> <span class="token keyword">DEFAULT</span> <span class="token string">'0.00'</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>article<span class="token punctuation">,</span> dealer<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> shop <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 string">'A'</span><span class="token punctuation">,</span><span class="token number">3.45</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 string">'B'</span><span class="token punctuation">,</span><span class="token number">3.99</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 string">'A'</span><span class="token punctuation">,</span><span class="token number">10.99</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 string">'B'</span><span class="token punctuation">,</span><span class="token number">1.45</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 string">'C'</span><span class="token punctuation">,</span><span class="token number">1.69</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 string">'D'</span><span class="token punctuation">,</span><span class="token number">1.25</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 string">'D'</span><span class="token punctuation">,</span><span class="token number">19.95</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
After issuing the statements, the table should have the following
contents:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa28971885"><div class="copy-help left">Press ⌘+C to 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> shop <span class="token keyword">ORDER</span> <span class="token keyword">BY</span> article<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>
<span class="token output"><span class="token punctuation">|</span> article <span class="token punctuation">|</span> dealer <span class="token punctuation">|</span> price <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>
<span class="token output"><span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> A <span class="token punctuation">|</span> 3.45 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> B <span class="token punctuation">|</span> 3.99 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 2 <span class="token punctuation">|</span> A <span class="token punctuation">|</span> 10.99 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 3 <span class="token punctuation">|</span> B <span class="token punctuation">|</span> 1.45 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 3 <span class="token punctuation">|</span> C <span class="token punctuation">|</span> 1.69 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 3 <span class="token punctuation">|</span> D <span class="token punctuation">|</span> 1.25 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 4 <span class="token punctuation">|</span> D <span class="token punctuation">|</span> 19.95 <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></code></pre>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/error-log-rotation.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="error-log-rotation">
</a>
7.4.2.10 Error Log File Flushing and Renaming
</h4>
</div>
</div>
</div>
<p>
If you flush the error log using a
<a class="link" href="flush.html#flush-error-logs">
<code class="literal">
FLUSH
ERROR LOGS
</code>
</a>
or
<a class="link" href="flush.html#flush-logs">
<code class="literal">
FLUSH
LOGS
</code>
</a>
statement, or a
<a class="link" href="mysqladmin.html" title="6.5.2 mysqladmin — A MySQL Server Administration Program">
<span class="command">
<strong>
mysqladmin
flush-logs
</strong>
</span>
</a>
command, the server closes and reopens any
error log file to which it is writing. To rename an error log
file, do so manually before flushing. Flushing the logs then
opens a new file with the original file name. For example,
assuming a log file name of
<code class="filename">
<em class="replaceable">
<code>
host_name
</code>
</em>
.err
</code>
,
use the following commands to rename the file and create a new
one:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa18565814"><div class="copy-help left">Press ⌘+C to 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">mv <em class="replaceable">host_name</em><span class="token punctuation">.</span>err <em class="replaceable">host_name</em><span class="token punctuation">.</span>err-old
mysqladmin flush-logs error
mv <em class="replaceable">host_name</em><span class="token punctuation">.</span>err-old <em class="replaceable">backup-directory</em></code></pre>
</div>
<p>
On Windows, use
<span class="command">
<strong>
rename
</strong>
</span>
rather than
<span class="command">
<strong>
mv
</strong>
</span>
.
</p>
<p>
If the location of the error log file is not writable by the
server, the log-flushing operation fails to create a new log
file. For example, on Linux, the server might write the error
log to the
<code class="filename">
/var/log/mysqld.log
</code>
file, where
the
<code class="filename">
/var/log
</code>
directory is owned by
<code class="literal">
root
</code>
and is not writable by
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
. For information about handling this
case, see
<a class="xref" href="log-file-maintenance.html" title="7.4.6 Server Log Maintenance">
Section 7.4.6, “Server Log Maintenance”
</a>
.
</p>
<p>
If the server is not writing to a named error log file, no error
log file renaming occurs when the error log is flushed.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/group-replication-functions-for-member-actions.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="group-replication-functions-for-member-actions">
</a>
14.18.1.5 Functions to Set and Reset Group Replication Member Actions
</h4>
</div>
</div>
</div>
<p>
The following functions can be used to enable and disable
actions for members of a group to take in specified
situations, and to reset the configuration to the default
setting for all member actions. They can only be used by
administrators with the
<a class="link" href="privileges-provided.html#priv_group-replication-admin">
<code class="literal">
GROUP_REPLICATION_ADMIN
</code>
</a>
privilege or the deprecated
<a class="link" href="privileges-provided.html#priv_super">
<code class="literal">
SUPER
</code>
</a>
privilege.
</p>
<p>
You configure member actions on the group’s primary using
the
<a class="link" href="group-replication-functions-for-member-actions.html#function_group-replication-enable-member-action">
<code class="literal">
group_replication_enable_member_action
</code>
</a>
and
<a class="link" href="group-replication-functions-for-member-actions.html#function_group-replication-disable-member-action">
<code class="literal">
group_replication_disable_member_action
</code>
</a>
functions. The member actions configuration, consisting of all
the member actions and whether they are enabled or disabled,
is then propagated to other group members and joining members
using Group Replication’s group messages. This means that
the group members will all act in the same way when they are
in the specified situation, and you only need to use the
function on the primary.
</p>
<p>
The functions can also be used on a server that is not part of
a group, as long as the Group Replication plugin is installed.
In that case, the member actions configuration is not
propagated to any other servers.
</p>
<p>
The
<a class="link" href="group-replication-functions-for-member-actions.html#function_group-replication-reset-member-actions">
<code class="literal">
group_replication_reset_member_actions
</code>
</a>
function can only be used on a server that is not part of a
group. It resets the member actions configuration to the
default settings, and resets its version number. The server
must be writeable (with the
<a class="link" href="server-system-variables.html#sysvar_read_only">
<code class="literal">
read_only
</code>
</a>
system variable set
to
<code class="literal">
OFF
</code>
) and have the Group Replication
plugin installed.
</p>
<p>
The available member actions are as follows:
</p>
<div class="variablelist">
<dl class="variablelist">
<dt>
<span class="term">
<code class="literal">
mysql_disable_super_read_only_if_primary
</code>
</span>
</dt>
<dd>
<p>
This member action is taken after a member is elected as
the group’s primary, which is the event
<code class="literal">
AFTER_PRIMARY_ELECTION
</code>
. The member
action is enabled by default. You can disable it using
the
<a class="link" href="group-replication-functions-for-member-actions.html#function_group-replication-disable-member-action">
<code class="literal">
group_replication_disable_member_action()
</code>
</a>
function, and re-enable it using
<a class="link" href="group-replication-functions-for-member-actions.html#function_group-replication-enable-member-action">
<code class="literal">
group_replication_enable_member_action()
</code>
</a>
.
</p>
<p>
When this member action is enabled and taken, super
read-only mode is disabled on the primary, so that the
primary becomes read-write and accepts updates from a
replication source server and from clients. This is the
normal situation.
</p>
<p>
When this member action is disabled and not taken, the
primary remains in super read-only mode after election.
In this state, it does not accept updates from any
clients, even users who 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. It does
continue to accept updates performed by replication
threads. This setup means that when a group’s purpose
is to provide a secondary backup to another group for
disaster tolerance, you can ensure that the secondary
group remains synchronized with the first.
</p>
</dd>
<dt>
<span class="term">
<code class="literal">
mysql_start_failover_channels_if_primary
</code>
</span>
</dt>
<dd>
<p>
This member action is taken after a member is elected as
the group’s primary, which is the event
<code class="literal">
AFTER_PRIMARY_ELECTION
</code>
. The member
action is enabled by default. You can disable it using
the
<a class="link" href="group-replication-functions-for-member-actions.html#function_group-replication-disable-member-action">
<code class="literal">
group_replication_disable_member_action()
</code>
</a>
function, and re-enable it using the
<a class="link" href="group-replication-functions-for-member-actions.html#function_group-replication-enable-member-action">
<code class="literal">
group_replication_enable_member_action()
</code>
</a>
function.
</p>
<p>
When this member action is enabled, asynchronous
connection failover for replicas is active for a
replication channel on a Group Replication primary when
you set
<code class="literal">
SOURCE_CONNECTION_AUTO_FAILOVER=1
</code>
in
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 for the channel. When the feature
is active and correctly configured, if the primary that
is replicating goes offline or into an error state, the
new primary starts replication on the same channel when
it is elected. This is the normal situation. For
instructions to configure the feature, see
<a class="xref" href="replication-asynchronous-connection-failover-replica.html" title="19.4.9.2 Asynchronous Connection Failover for Replicas">
Section 19.4.9.2, “Asynchronous Connection Failover for Replicas”
</a>
.
</p>
<p>
When this member action is disabled, asynchronous
connection failover does not take place for the
replicas. If the primary goes offline or into an error
state, replication stops for the channel. Note that if
there is more than one channel with
<code class="literal">
SOURCE_CONNECTION_AUTO_FAILOVER=1
</code>
,
the member action covers all the channels, so they
cannot be individually enabled and disabled by this
method. Set
<code class="literal">
SOURCE_CONNECTION_AUTO_FAILOVER=0
</code>
to
disable an individual channel.
</p>
</dd>
</dl>
</div>
<p>
For more information on member actions and how to view the
member actions configuration, see
<a class="xref" href="group-replication-member-actions.html" title="20.5.1.5 Configuring Member Actions">
Section 20.5.1.5, “Configuring Member Actions”
</a>
.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a name="function_group-replication-disable-member-action">
</a>
<a class="link" href="group-replication-functions-for-member-actions.html#function_group-replication-disable-member-action">
<code class="literal">
group_replication_disable_member_action()
</code>
</a>
</p>
<a class="indexterm" name="idm46045193733984">
</a>
<a class="indexterm" name="idm46045193732880">
</a>
<p>
Disable a member action so that the member does not take
it in the specified situation. If the server where you use
the function is part of a group, it must be the current
primary in a group in single-primary mode, and it must be
part of the majority. The changed setting is propagated to
other group members and joining members, so they will all
act in the same way when they are in the specified
situation, and you only need to use the function on the
primary.
</p>
<p>
Syntax:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-clike"><div class="docs-select-all right" id="sa91963102"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-clike">STRING <span class="token function">group_replication_disable_member_action</span><span class="token punctuation">(</span><em class="replaceable">name</em><span class="token punctuation">,</span> <em class="replaceable">event</em><span class="token punctuation">)</span></code></pre>
</div>
<p>
Arguments:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<em class="replaceable">
<code>
name
</code>
</em>
: The name of the
member action to disable.
</p>
</li>
<li class="listitem">
<p>
<em class="replaceable">
<code>
event
</code>
</em>
: The event that
triggers the member action.
</p>
</li>
</ul>
</div>
<p>
Return value:
</p>
<p>
A string containing the result of the operation, for
example whether it was successful or not.
</p>
<p>
Example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa84434621"><div class="copy-help left">Press ⌘+C to 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_disable_member_action<span class="token punctuation">(</span><span class="token string">"mysql_disable_super_read_only_if_primary"</span><span class="token punctuation">,</span> <span class="token string">"AFTER_PRIMARY_ELECTION"</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
For more information, see
<a class="xref" href="group-replication-member-actions.html" title="20.5.1.5 Configuring Member Actions">
Section 20.5.1.5, “Configuring Member Actions”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="function_group-replication-enable-member-action">
</a>
<a class="link" href="group-replication-functions-for-member-actions.html#function_group-replication-enable-member-action">
<code class="literal">
group_replication_enable_member_action()
</code>
</a>
</p>
<a class="indexterm" name="idm46045193718016">
</a>
<a class="indexterm" name="idm46045193716912">
</a>
<p>
Enable a member action for the member to take in the
specified situation. If the server where you use the
function is part of a group, it must be the current
primary in a group in single-primary mode, and it must be
part of the majority. The changed setting is propagated to
other group members and joining members, so they will all
act in the same way when they are in the specified
situation, and you only need to use the function on the
primary.
</p>
<p>
Syntax:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-clike"><div class="docs-select-all right" id="sa47034852"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-clike">STRING <span class="token function">group_replication_enable_member_action</span><span class="token punctuation">(</span><em class="replaceable">name</em><span class="token punctuation">,</span> <em class="replaceable">event</em><span class="token punctuation">)</span></code></pre>
</div>
<p>
Arguments:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<em class="replaceable">
<code>
name
</code>
</em>
: The name of the
member action to enable.
</p>
</li>
<li class="listitem">
<p>
<em class="replaceable">
<code>
event
</code>
</em>
: The event that
triggers the member action.
</p>
</li>
</ul>
</div>
<p>
Return value:
</p>
<p>
A string containing the result of the operation, for
example whether it was successful or not.
</p>
<p>
Example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa42542503"><div class="copy-help left">Press ⌘+C to 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_enable_member_action<span class="token punctuation">(</span><span class="token string">"mysql_disable_super_read_only_if_primary"</span><span class="token punctuation">,</span> <span class="token string">"AFTER_PRIMARY_ELECTION"</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
For more information, see
<a class="xref" href="group-replication-member-actions.html" title="20.5.1.5 Configuring Member Actions">
Section 20.5.1.5, “Configuring Member Actions”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="function_group-replication-reset-member-actions">
</a>
<a class="link" href="group-replication-functions-for-member-actions.html#function_group-replication-reset-member-actions">
<code class="literal">
group_replication_reset_member_actions()
</code>
</a>
</p>
<a class="indexterm" name="idm46045193702128">
</a>
<a class="indexterm" name="idm46045193701024">
</a>
<p>
Reset the member actions configuration to the default
settings, and reset its version number to 1.
</p>
<p>
The
<a class="link" href="group-replication-functions-for-member-actions.html#function_group-replication-reset-member-actions">
<code class="literal">
group_replication_reset_member_actions()
</code>
</a>
function can only be used on a server that is not
currently part of a group. The server must be writeable
(with the
<a class="link" href="server-system-variables.html#sysvar_read_only">
<code class="literal">
read_only
</code>
</a>
system variable set to
<code class="literal">
OFF
</code>
) and have
the Group Replication plugin installed. You can use this
function to remove the member actions configuration that a
server used when it was part of a group, if you intend to
use it as a standalone server with no member actions or
different member actions.
</p>
<p>
Syntax:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-clike"><div class="docs-select-all right" id="sa31330780"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-clike">STRING <span class="token function">group_replication_reset_member_actions</span><span class="token punctuation">(</span><span class="token punctuation">)</span></code></pre>
</div>
<p>
Arguments:
</p>
<p>
None.
</p>
<p>
Return value:
</p>
<p>
A string containing the result of the operation, for
example whether it was successful or not.
</p>
<p>
Example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa89790283"><div class="copy-help left">Press ⌘+C to 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_reset_member_actions<span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
For more information, see
<a class="xref" href="group-replication-member-actions.html" title="20.5.1.5 Configuring Member Actions">
Section 20.5.1.5, “Configuring Member Actions”
</a>
.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/error-log.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="error-log">
</a>
7.4.2 The Error Log
</h3>
</div>
</div>
</div>
<div class="toc">
<dl class="toc">
<dt>
<span class="section">
<a href="error-log-configuration.html">
7.4.2.1 Error Log Configuration
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="error-log-destination-configuration.html">
7.4.2.2 Default Error Log Destination Configuration
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="error-log-event-fields.html">
7.4.2.3 Error Event Fields
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="error-log-filtering.html">
7.4.2.4 Types of Error Log Filtering
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="error-log-priority-based-filtering.html">
7.4.2.5 Priority-Based Error Log Filtering (log_filter_internal)
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="error-log-rule-based-filtering.html">
7.4.2.6 Rule-Based Error Log Filtering (log_filter_dragnet)
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="error-log-json.html">
7.4.2.7 Error Logging in JSON Format
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="error-log-syslog.html">
7.4.2.8 Error Logging to the System Log
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="error-log-format.html">
7.4.2.9 Error Log Output Format
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="error-log-rotation.html">
7.4.2.10 Error Log File Flushing and Renaming
</a>
</span>
</dt>
</dl>
</div>
<p>
This section discusses how to configure the MySQL server for
logging of diagnostic messages to the error log. For information
about selecting the error message character set and language, see
<a class="xref" href="charset-errors.html" title="12.6 Error Message Character Set">
Section 12.6, “Error Message Character Set”
</a>
, and
<a class="xref" href="error-message-language.html" title="12.12 Setting the Error Message Language">
Section 12.12, “Setting the Error Message Language”
</a>
.
</p>
<p>
The error log contains a record of
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
startup and shutdown times. It also contains diagnostic messages
such as errors, warnings, and notes that occur during server
startup and shutdown, and while the server is running. For
example, if
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
notices that a table needs
to be automatically checked or repaired, it writes a message to
the error log.
</p>
<p>
Depending on error log configuration, error messages may also
populate the Performance Schema
<a class="link" href="performance-schema-error-log-table.html" title="29.12.22.2 The error_log Table">
<code class="literal">
error_log
</code>
</a>
table, to provide an SQL
interface to the log and enable its contents to be queried. See
<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>
.
</p>
<p>
On some operating systems, the error log contains a stack trace if
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
exits abnormally. The trace can be used
to determine where
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
exited. See
<a class="xref" href="debugging-mysql.html" title="7.9 Debugging MySQL">
Section 7.9, “Debugging MySQL”
</a>
.
</p>
<p>
If used to start
<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="mysqld-safe.html" title="6.3.2 mysqld_safe — MySQL Server Startup Script">
<span class="command">
<strong>
mysqld_safe
</strong>
</span>
</a>
may write messages to the error
log. For example, when
<a class="link" href="mysqld-safe.html" title="6.3.2 mysqld_safe — MySQL Server Startup Script">
<span class="command">
<strong>
mysqld_safe
</strong>
</span>
</a>
notices
abnormal
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
exits, it restarts
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
and writes a
<code class="literal">
mysqld
restarted
</code>
message to the error log.
</p>
<p>
The following sections discuss aspects of configuring error
logging.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/arithmetic-functions.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="arithmetic-functions">
</a>
14.6.1 Arithmetic Operators
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045206456608">
</a>
<div class="table">
<a name="idm46045206455120">
</a>
<p class="title">
<b>
Table 14.9 Arithmetic Operators
</b>
</p>
<div class="table-contents">
<table frame="box" rules="all" summary="A reference that lists arithmetic 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="arithmetic-functions.html#operator_mod">
<code class="literal">
%
</code>
,
<code class="literal">
MOD
</code>
</a>
</td>
<td>
Modulo operator
</td>
</tr>
<tr>
<td>
<a class="link" href="arithmetic-functions.html#operator_times">
<code class="literal">
*
</code>
</a>
</td>
<td>
Multiplication operator
</td>
</tr>
<tr>
<td>
<a class="link" href="arithmetic-functions.html#operator_plus">
<code class="literal">
+
</code>
</a>
</td>
<td>
Addition operator
</td>
</tr>
<tr>
<td>
<a class="link" href="arithmetic-functions.html#operator_minus">
<code class="literal">
-
</code>
</a>
</td>
<td>
Minus operator
</td>
</tr>
<tr>
<td>
<a class="link" href="arithmetic-functions.html#operator_unary-minus">
<code class="literal">
-
</code>
</a>
</td>
<td>
Change the sign of the argument
</td>
</tr>
<tr>
<td>
<a class="link" href="arithmetic-functions.html#operator_divide">
<code class="literal">
/
</code>
</a>
</td>
<td>
Division operator
</td>
</tr>
<tr>
<td>
<a class="link" href="arithmetic-functions.html#operator_div">
<code class="literal">
DIV
</code>
</a>
</td>
<td>
Integer division
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br class="table-break"/>
<p>
The usual arithmetic operators are available. The result is
determined according to the following rules:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
In the case of
<a class="link" href="arithmetic-functions.html#operator_minus">
<code class="literal">
-
</code>
</a>
,
<a class="link" href="arithmetic-functions.html#operator_plus">
<code class="literal">
+
</code>
</a>
, and
<a class="link" href="arithmetic-functions.html#operator_times">
<code class="literal">
*
</code>
</a>
, the result
is calculated with
<a class="link" href="integer-types.html" title="13.1.2 Integer Types (Exact Value) - INTEGER, INT, SMALLINT, TINYINT, MEDIUMINT, BIGINT">
<code class="literal">
BIGINT
</code>
</a>
(64-bit) precision if both operands are integers.
</p>
</li>
<li class="listitem">
<p>
If both operands are integers and any of them are unsigned,
the result is an unsigned integer. For subtraction, 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 signed even if any
operand is unsigned.
</p>
</li>
<li class="listitem">
<p>
If any of the operands of a
<a class="link" href="arithmetic-functions.html#operator_plus">
<code class="literal">
+
</code>
</a>
,
<a class="link" href="arithmetic-functions.html#operator_minus">
<code class="literal">
-
</code>
</a>
,
<a class="link" href="arithmetic-functions.html#operator_divide">
<code class="literal">
/
</code>
</a>
,
<a class="link" href="arithmetic-functions.html#operator_times">
<code class="literal">
*
</code>
</a>
,
<a class="link" href="arithmetic-functions.html#operator_mod">
<code class="literal">
%
</code>
</a>
is a real or
string value, the precision of the result is the precision
of the operand with the maximum precision.
</p>
</li>
<li class="listitem">
<p>
In division performed with
<a class="link" href="arithmetic-functions.html#operator_divide">
<code class="literal">
/
</code>
</a>
, the scale
of the result when using two exact-value operands is the
scale of the first operand plus the value of the
<a class="link" href="server-system-variables.html#sysvar_div_precision_increment">
<code class="literal">
div_precision_increment
</code>
</a>
system variable (which is 4 by default). For example, the
result of the expression
<code class="literal">
5.05 / 0.014
</code>
has
a scale of six decimal places
(
<code class="literal">
360.714286
</code>
).
</p>
</li>
</ul>
</div>
<p>
These rules are applied for each operation, such that nested
calculations imply the precision of each component. Hence,
<code class="literal">
(14620 / 9432456) / (24250 / 9432456)
</code>
,
resolves first to
<code class="literal">
(0.0014) / (0.0026)
</code>
, with
the final result having 8 decimal places
(
<code class="literal">
0.60288653
</code>
).
</p>
<p>
Because of these rules and the way they are applied, care should
be taken to ensure that components and subcomponents of a
calculation use the appropriate level of precision. 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>
For information about handling of overflow in numeric expression
evaluation, see
<a class="xref" href="out-of-range-and-overflow.html" title="13.1.7 Out-of-Range and Overflow Handling">
Section 13.1.7, “Out-of-Range and Overflow Handling”
</a>
.
</p>
<p>
Arithmetic operators apply to numbers. For other types of
values, alternative operations may be available. For example, to
add date values, use
<a class="link" href="date-and-time-functions.html#function_date-add">
<code class="literal">
DATE_ADD()
</code>
</a>
;
see
<a class="xref" href="date-and-time-functions.html" title="14.7 Date and Time Functions">
Section 14.7, “Date and Time Functions”
</a>
.
</p>
<a class="indexterm" name="idm46045206398384">
</a>
<a class="indexterm" name="idm46045206396896">
</a>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<a name="operator_plus">
</a>
<p>
<a class="link" href="arithmetic-functions.html#operator_plus">
<code class="literal">
+
</code>
</a>
</p>
<a class="indexterm" name="idm46045206391392">
</a>
<a class="indexterm" name="idm46045206390320">
</a>
<p>
Addition:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa47315316"><div class="copy-help left">Press ⌘+C to 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">3</span><span class="token operator">+</span><span class="token number">5</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token number">8</span></code></pre>
</div>
</li>
<li class="listitem">
<a name="operator_minus">
</a>
<p>
<a class="link" href="arithmetic-functions.html#operator_minus">
<code class="literal">
-
</code>
</a>
</p>
<a class="indexterm" name="idm46045206380656">
</a>
<a class="indexterm" name="idm46045206379584">
</a>
<p>
Subtraction:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa1268715"><div class="copy-help left">Press ⌘+C to 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">3</span><span class="token operator">-</span><span class="token number">5</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token operator">-</span><span class="token number">2</span></code></pre>
</div>
</li>
<li class="listitem">
<a name="operator_unary-minus">
</a>
<p>
<a class="link" href="arithmetic-functions.html#operator_unary-minus">
<code class="literal">
-
</code>
</a>
</p>
<a class="indexterm" name="idm46045206369920">
</a>
<a class="indexterm" name="idm46045206368848">
</a>
<a class="indexterm" name="idm46045206367360">
</a>
<p>
Unary minus. This operator changes the sign of the operand.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa15067427"><div class="copy-help left">Press ⌘+C to 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 number">2</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token operator">-</span><span class="token number">2</span></code></pre>
</div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
If this operator is used with a
<a class="link" href="integer-types.html" title="13.1.2 Integer Types (Exact Value) - INTEGER, INT, SMALLINT, TINYINT, MEDIUMINT, BIGINT">
<code class="literal">
BIGINT
</code>
</a>
, the return value is
also a
<a class="link" href="integer-types.html" title="13.1.2 Integer Types (Exact Value) - INTEGER, INT, SMALLINT, TINYINT, MEDIUMINT, BIGINT">
<code class="literal">
BIGINT
</code>
</a>
. This means
that you should avoid using
<code class="literal">
-
</code>
on
integers that may have the value of
−2
<sup>
63
</sup>
.
</p>
</div>
</li>
<li class="listitem">
<a name="operator_times">
</a>
<p>
<a class="link" href="arithmetic-functions.html#operator_times">
<code class="literal">
*
</code>
</a>
</p>
<a class="indexterm" name="idm46045206353072">
</a>
<a class="indexterm" name="idm46045206352000">
</a>
<p>
Multiplication:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa52637800"><div class="copy-help left">Press ⌘+C to 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">3</span><span class="token operator">*</span><span class="token number">5</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token number">15</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token number">18014398509481984</span><span class="token operator">*</span><span class="token number">18014398509481984.0</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token number">324518553658426726783156020576256.0</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token number">18014398509481984</span><span class="token operator">*</span><span class="token number">18014398509481984</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token keyword">out</span><span class="token operator">-</span><span class="token keyword">of</span><span class="token operator">-</span><span class="token keyword">range</span> <span class="token keyword">error</span></code></pre>
</div>
<p>
The last expression produces an error because the result of
the integer multiplication exceeds the 64-bit range of
<a class="link" href="integer-types.html" title="13.1.2 Integer Types (Exact Value) - INTEGER, INT, SMALLINT, TINYINT, MEDIUMINT, BIGINT">
<code class="literal">
BIGINT
</code>
</a>
calculations. (See
<a class="xref" href="numeric-types.html" title="13.1 Numeric Data Types">
Section 13.1, “Numeric Data Types”
</a>
.)
</p>
</li>
<li class="listitem">
<a name="operator_divide">
</a>
<p>
<a class="link" href="arithmetic-functions.html#operator_divide">
<code class="literal">
/
</code>
</a>
</p>
<a class="indexterm" name="idm46045206338144">
</a>
<a class="indexterm" name="idm46045206337072">
</a>
<p>
Division:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa96769063"><div class="copy-help left">Press ⌘+C to 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">3</span><span class="token operator">/</span><span class="token number">5</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token number">0.60</span></code></pre>
</div>
<p>
Division by zero produces a
<code class="literal">
NULL
</code>
result:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa42401793"><div class="copy-help left">Press ⌘+C to 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">102</span><span class="token operator">/</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 boolean">NULL</span></code></pre>
</div>
<p>
A division is calculated with
<a class="link" href="integer-types.html" title="13.1.2 Integer Types (Exact Value) - INTEGER, INT, SMALLINT, TINYINT, MEDIUMINT, BIGINT">
<code class="literal">
BIGINT
</code>
</a>
arithmetic only if
performed in a context where its result is converted to an
integer.
</p>
</li>
<li class="listitem">
<a name="operator_div">
</a>
<p>
<a class="link" href="arithmetic-functions.html#operator_div">
<code class="literal">
DIV
</code>
</a>
</p>
<a class="indexterm" name="idm46045206322832">
</a>
<p>
Integer division. Discards from the division result any
fractional part to the right of the decimal point.
</p>
<p>
If either operand has a noninteger type, the operands are
converted to
<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
divided using
<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>
arithmetic before converting the result to
<a class="link" href="integer-types.html" title="13.1.2 Integer Types (Exact Value) - INTEGER, INT, SMALLINT, TINYINT, MEDIUMINT, BIGINT">
<code class="literal">
BIGINT
</code>
</a>
. If the result exceeds
<code class="literal">
BIGINT
</code>
range, an error occurs.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa62040199"><div class="copy-help left">Press ⌘+C to 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">5</span> <span class="token operator">DIV</span> <span class="token number">2</span><span class="token punctuation">,</span> <span class="token operator">-</span><span class="token number">5</span> <span class="token operator">DIV</span> <span class="token number">2</span><span class="token punctuation">,</span> <span class="token number">5</span> <span class="token operator">DIV</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">5</span> <span class="token operator">DIV</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">2</span><span class="token punctuation">,</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">2</span><span class="token punctuation">,</span> <span class="token number">2</span></code></pre>
</div>
</li>
<li class="listitem">
<a name="operator_mod">
</a>
<p>
<a class="link" href="arithmetic-functions.html#operator_mod">
<code class="literal">
<em class="replaceable">
<code>
N
</code>
</em>
%
<em class="replaceable">
<code>
M
</code>
</em>
</code>
</a>
,
<a class="link" href="arithmetic-functions.html#operator_mod">
<code class="literal">
<em class="replaceable">
<code>
N
</code>
</em>
MOD
<em class="replaceable">
<code>
M
</code>
</em>
</code>
</a>
</p>
<a class="indexterm" name="idm46045206305728">
</a>
<p>
Modulo operation. Returns the remainder of
<em class="replaceable">
<code>
N
</code>
</em>
divided by
<em class="replaceable">
<code>
M
</code>
</em>
. For more information, see the
description for the
<a class="link" href="mathematical-functions.html#function_mod">
<code class="literal">
MOD()
</code>
</a>
function in
<a class="xref" href="mathematical-functions.html" title="14.6.2 Mathematical Functions">
Section 14.6.2, “Mathematical Functions”
</a>
.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/mysql-cluster-replication-pitr.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="mysql-cluster-replication-pitr">
</a>
25.7.9.2 Point-In-Time Recovery Using NDB Cluster Replication
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045085811312">
</a>
<a class="indexterm" name="idm46045085809824">
</a>
<a class="indexterm" name="idm46045085808368">
</a>
<p>
<span class="firstterm">
Point-in-time
</span>
recovery—that is, recovery of data changes made since a
given point in time—is performed after restoring a full
backup that returns the server to its state when the backup was
made. Performing point-in-time recovery of NDB Cluster tables
with NDB Cluster and NDB Cluster Replication can be accomplished
using a native
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
data backup
(taken by issuing
<a class="link" href="mysql-cluster-mgm-client-commands.html#ndbclient-create-nodegroup">
<code class="literal">
CREATE
BACKUP
</code>
</a>
in 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) and
restoring the
<code class="literal">
ndb_binlog_index
</code>
table (from a
dump made using
<a class="link" href="mysqldump.html" title="6.5.4 mysqldump — A Database Backup Program">
<span class="command">
<strong>
mysqldump
</strong>
</span>
</a>
).
</p>
<p>
To perform point-in-time recovery of NDB Cluster, it is
necessary to follow the steps shown here:
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
Back up all
<code class="literal">
NDB
</code>
databases in the cluster,
using the
<a class="link" href="mysql-cluster-backup-using-management-client.html" title="25.6.8.2 Using The NDB Cluster Management Client to Create a Backup">
<code class="literal">
START BACKUP
</code>
</a>
command in 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 (see
<a class="xref" href="mysql-cluster-backup.html" title="25.6.8 Online Backup of NDB Cluster">
Section 25.6.8, “Online Backup of NDB Cluster”
</a>
).
</p>
</li>
<li class="listitem">
<p>
At some later point, prior to restoring the cluster, make a
backup of the
<code class="literal">
mysql.ndb_binlog_index
</code>
table. It is probably simplest to use
<a class="link" href="mysqldump.html" title="6.5.4 mysqldump — A Database Backup Program">
<span class="command">
<strong>
mysqldump
</strong>
</span>
</a>
for this task. Also back up the
binary log files at this time.
</p>
<p>
This backup should be updated regularly—perhaps even
hourly—depending on your needs.
</p>
</li>
<li class="listitem">
<p>
(
<span class="emphasis">
<em>
Catastrophic failure or error occurs
</em>
</span>
.)
</p>
</li>
<li class="listitem">
<p>
Locate the last known good backup.
</p>
</li>
<li class="listitem">
<p>
Clear the data node file systems (using
<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
</strong>
</span>
</a>
<a class="link" href="mysql-cluster-programs-ndbd.html#option_ndbd_initial">
<code class="option">
--initial
</code>
</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
</strong>
</span>
</a>
<a class="link" href="mysql-cluster-programs-ndbd.html#option_ndbd_initial">
<code class="option">
--initial
</code>
</a>
).
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
Disk Data tablespace and log files are also removed by
<a class="link" href="mysql-cluster-programs-ndbd.html#option_ndbd_initial">
<code class="option">
--initial
</code>
</a>
.
</p>
</div>
</li>
<li class="listitem">
<p>
Use
<a class="link" href="drop-table.html" title="15.1.32 DROP TABLE Statement">
<code class="literal">
DROP TABLE
</code>
</a>
or
<a class="link" href="truncate-table.html" title="15.1.37 TRUNCATE TABLE Statement">
<code class="literal">
TRUNCATE TABLE
</code>
</a>
with the
<code class="literal">
mysql.ndb_binlog_index
</code>
table.
</p>
</li>
<li class="listitem">
<p>
Execute
<a class="link" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
<span class="command">
<strong>
ndb_restore
</strong>
</span>
</a>
, restoring all data.
You must include the
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_restore-epoch">
<code class="option">
--restore-epoch
</code>
</a>
option
when you run
<a class="link" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
<span class="command">
<strong>
ndb_restore
</strong>
</span>
</a>
, so that the
<code class="literal">
ndb_apply_status
</code>
table is populated
correctly. (See
<a class="xref" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
Section 25.5.23, “ndb_restore — Restore an NDB Cluster Backup”
</a>
, for
more information.)
</p>
</li>
<li class="listitem">
<p>
Restore the
<code class="literal">
ndb_binlog_index
</code>
table from
the output of
<a class="link" href="mysqldump.html" title="6.5.4 mysqldump — A Database Backup Program">
<span class="command">
<strong>
mysqldump
</strong>
</span>
</a>
and restore the
binary log files from backup, if necessary.
</p>
</li>
<li class="listitem">
<p>
Find the epoch applied most recently—that is, the
maximum
<code class="literal">
epoch
</code>
column value in the
<code class="literal">
ndb_apply_status
</code>
table—as the user
variable
<code class="literal">
@LATEST_EPOCH
</code>
(emphasized):
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa71976648"><div class="copy-help left">Press ⌘+C to 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"><em>@LATEST_EPOCH</em></span><span class="token operator">:=</span><span class="token function">MAX</span><span class="token punctuation">(</span>epoch<span class="token punctuation">)</span>
<span class="token keyword">FROM</span> mysql<span class="token punctuation">.</span>ndb_apply_status<span class="token punctuation">;</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
Find the latest binary log file
(
<code class="literal">
@FIRST_FILE
</code>
) and position
(
<code class="literal">
Position
</code>
column value) within this file
that correspond to
<code class="literal">
@LATEST_EPOCH
</code>
in the
<code class="literal">
ndb_binlog_index
</code>
table:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa17346255"><div class="copy-help left">Press ⌘+C to 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> Position<span class="token punctuation">,</span> <span class="token variable"><em>@FIRST_FILE</em></span><span class="token operator">:=</span><span class="token keyword">File</span>
<span class="token keyword">FROM</span> mysql<span class="token punctuation">.</span>ndb_binlog_index
<span class="token keyword">WHERE</span> epoch <span class="token operator">></span> <span class="token variable"><em>@LATEST_EPOCH</em></span> <span class="token keyword">ORDER</span> <span class="token keyword">BY</span> epoch <span class="token keyword">ASC</span> <span class="token keyword">LIMIT</span> <span class="token number">1</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
Using
<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>
, replay the binary log
events from the given file and position up to the point of
the failure. (See
<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>
.)
</p>
</li>
</ol>
</div>
<p>
See also
<a class="xref" href="point-in-time-recovery.html" title="9.5 Point-in-Time (Incremental) Recovery">
Section 9.5, “Point-in-Time (Incremental) Recovery”
</a>
, for more
information about the binary log, replication, and incremental
recovery.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/cast-functions.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title">
<a name="cast-functions">
</a>
14.10 Cast Functions and Operators
</h2>
</div>
</div>
</div>
<a class="indexterm" name="idm46045201038160">
</a>
<a class="indexterm" name="idm46045201037120">
</a>
<a class="indexterm" name="idm46045201036048">
</a>
<a class="indexterm" name="idm46045201034560">
</a>
<a class="indexterm" name="idm46045201033488">
</a>
<div class="table">
<a name="idm46045201031184">
</a>
<p class="title">
<b>
Table 14.15 Cast Functions and Operators
</b>
</p>
<div class="table-contents">
<table frame="box" rules="all" summary="A reference that lists cast functions and operators.">
<colgroup>
<col style="width: 25%"/>
<col style="width: 62%"/>
<col style="width: 12%"/>
</colgroup>
<thead>
<tr>
<th>
Name
</th>
<th>
Description
</th>
<th>
Deprecated
</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">
<a class="link" href="cast-functions.html#operator_binary">
<code class="literal">
BINARY
</code>
</a>
</th>
<td>
Cast a string to a binary string
</td>
<td>
Yes
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="cast-functions.html#function_cast">
<code class="literal">
CAST()
</code>
</a>
</th>
<td>
Cast a value as a certain type
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="cast-functions.html#function_convert">
<code class="literal">
CONVERT()
</code>
</a>
</th>
<td>
Cast a value as a certain type
</td>
<td>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br class="table-break"/>
<p>
Cast functions and operators enable conversion of values from one
data type to another.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="xref" href="cast-functions.html#cast-function-descriptions" title="Cast Function and Operator Descriptions">
Cast Function and Operator Descriptions
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="cast-functions.html#cast-character-set-conversions" title="Character Set Conversions">
Character Set Conversions
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="cast-functions.html#cast-string-comparisons" title="Character Set Conversions for String Comparisons">
Character Set Conversions for String Comparisons
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="cast-functions.html#cast-spatial-types" title="Cast Operations on Spatial Types">
Cast Operations on Spatial Types
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="cast-functions.html#cast-other-uses" title="Other Uses for Cast Operations">
Other Uses for Cast Operations
</a>
</p>
</li>
</ul>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h3 class="title">
<a name="cast-function-descriptions">
</a>
Cast Function and Operator Descriptions
</h3>
</div>
</div>
</div>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<a name="operator_binary">
</a>
<p>
<a class="link" href="cast-functions.html#operator_binary">
<code class="literal">
BINARY
</code>
</a>
<em class="replaceable">
<code>
expr
</code>
</em>
</p>
<a class="indexterm" name="idm46045200999280">
</a>
<p>
The
<a class="link" href="cast-functions.html#operator_binary">
<code class="literal">
BINARY
</code>
</a>
operator converts
the expression to a binary string (a string that has the
<code class="literal">
binary
</code>
character set and
<code class="literal">
binary
</code>
collation). A common use for
<a class="link" href="cast-functions.html#operator_binary">
<code class="literal">
BINARY
</code>
</a>
is to force a character
string comparison to be done byte by byte using numeric byte
values rather than character by character. The
<a class="link" href="cast-functions.html#operator_binary">
<code class="literal">
BINARY
</code>
</a>
operator also causes
trailing spaces in comparisons to be significant. For
information about the differences between the
<code class="literal">
binary
</code>
collation of the
<code class="literal">
binary
</code>
character set and the
<code class="literal">
_bin
</code>
collations of nonbinary character
sets, see
<a class="xref" href="charset-binary-collations.html" title="12.8.5 The binary Collation Compared to _bin Collations">
Section 12.8.5, “The binary Collation Compared to _bin Collations”
</a>
.
</p>
<p>
The
<code class="literal">
BINARY
</code>
operator is deprecated; you
should expect its removal in a future version of MySQL. Use
<a class="link" href="cast-functions.html#function_cast">
<code class="literal">
CAST(... AS BINARY)
</code>
</a>
instead.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa95194992"><div class="copy-help left">Press ⌘+C to 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> utf8mb4 <span class="token keyword">COLLATE</span> utf8mb4_general_ci<span class="token punctuation">;</span>
<span class="token prompt"> -></span> OK
<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 prompt"> -></span> <span class="token number">1</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token datatype">BINARY</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 prompt"> -></span> <span class="token number">0</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 prompt"> -></span> <span class="token number">1</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token datatype">BINARY</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 prompt"> -></span> <span class="token number">0</span></code></pre>
</div>
<p>
In a comparison,
<a class="link" href="cast-functions.html#operator_binary">
<code class="literal">
BINARY
</code>
</a>
affects
the entire operation; it can be given before either operand
with the same result.
</p>
<p>
To convert a string expression to a binary string, these
constructs are equivalent:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa14107900"><div class="copy-help left">Press ⌘+C to 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 function">CONVERT</span><span class="token punctuation">(</span><em class="replaceable">expr</em> <span class="token keyword">USING</span> <span class="token datatype">BINARY</span><span class="token punctuation">)</span>
<span class="token function">CAST</span><span class="token punctuation">(</span><em class="replaceable">expr</em> <span class="token keyword">AS</span> <span class="token datatype">BINARY</span><span class="token punctuation">)</span>
<span class="token datatype">BINARY</span> <em class="replaceable">expr</em></code></pre>
</div>
<p>
If a value is a string literal, it can be designated as a
binary string without converting it by using the
<code class="literal">
_binary
</code>
character set introducer:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa84804834"><div class="copy-help left">Press ⌘+C to 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 operator">=</span> <span class="token string">'A'</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> _binary <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 prompt"> -></span> <span class="token number">0</span></code></pre>
</div>
<p>
For information about introducers, see
<a class="xref" href="charset-introducer.html" title="12.3.8 Character Set Introducers">
Section 12.3.8, “Character Set Introducers”
</a>
.
</p>
<p>
The
<a class="link" href="cast-functions.html#operator_binary">
<code class="literal">
BINARY
</code>
</a>
operator in
expressions differs in effect from the
<code class="literal">
BINARY
</code>
attribute in character column
definitions. For a character column defined with the
<code class="literal">
BINARY
</code>
attribute, MySQL assigns the table
default character set and the binary
(
<code class="literal">
_bin
</code>
) collation of that character set.
Every nonbinary character set has a
<code class="literal">
_bin
</code>
collation. For example, if the table default character set
is
<code class="literal">
utf8mb4
</code>
, these two column definitions
are equivalent:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa60353153"><div class="copy-help left">Press ⌘+C to 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 datatype">CHAR</span><span class="token punctuation">(</span><span class="token number">10</span><span class="token punctuation">)</span> <span class="token datatype">BINARY</span>
<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 keyword">CHARACTER</span> <span class="token keyword">SET</span> utf8mb4 <span class="token keyword">COLLATE</span> utf8mb4_bin</code></pre>
</div>
<p>
The use of
<code class="literal">
CHARACTER SET binary
</code>
in the
definition of a
<a class="link" href="char.html" title="13.3.2 The CHAR and VARCHAR Types">
<code class="literal">
CHAR
</code>
</a>
,
<a class="link" href="char.html" title="13.3.2 The CHAR and VARCHAR Types">
<code class="literal">
VARCHAR
</code>
</a>
, or
<a class="link" href="blob.html" title="13.3.4 The BLOB and TEXT Types">
<code class="literal">
TEXT
</code>
</a>
column causes the column
to be treated as the corresponding binary string data type.
For example, the following pairs of definitions are
equivalent:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa9983187"><div class="copy-help left">Press ⌘+C to 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 datatype">CHAR</span><span class="token punctuation">(</span><span class="token number">10</span><span class="token punctuation">)</span> <span class="token keyword">CHARACTER</span> <span class="token keyword">SET</span> <span class="token datatype">binary</span>
<span class="token datatype">BINARY</span><span class="token punctuation">(</span><span class="token number">10</span><span class="token punctuation">)</span>
<span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">10</span><span class="token punctuation">)</span> <span class="token keyword">CHARACTER</span> <span class="token keyword">SET</span> <span class="token datatype">binary</span>
<span class="token datatype">VARBINARY</span><span class="token punctuation">(</span><span class="token number">10</span><span class="token punctuation">)</span>
<span class="token datatype">TEXT</span> <span class="token keyword">CHARACTER</span> <span class="token keyword">SET</span> <span class="token datatype">binary</span>
<span class="token datatype">BLOB</span></code></pre>
</div>
<p>
If
<a class="link" href="cast-functions.html#operator_binary">
<code class="literal">
BINARY
</code>
</a>
is invoked from
within 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, binary strings
display using hexadecimal notation, depending on the value
of the
<a class="link" href="mysql-command-options.html#option_mysql_binary-as-hex">
<code class="option">
--binary-as-hex
</code>
</a>
. For
more information about that option, see
<a class="xref" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
Section 6.5.1, “mysql — The MySQL Command-Line Client”
</a>
.
</p>
</li>
<li class="listitem">
<a name="function_cast">
</a>
<p>
<a class="link" href="cast-functions.html#function_cast">
<code class="literal">
CAST(
<em class="replaceable">
<code>
expr
</code>
</em>
AS
<em class="replaceable">
<code>
type
</code>
</em>
[ARRAY])
</code>
</a>
</p>
<p>
<a class="link" href="cast-functions.html#function_cast">
<code class="literal">
CAST(
<em class="replaceable">
<code>
timestamp_value
</code>
</em>
AT TIME ZONE
<em class="replaceable">
<code>
timezone_specifier
</code>
</em>
AS
DATETIME[(
<em class="replaceable">
<code>
precision
</code>
</em>
)])
</code>
</a>
</p>
<p>
<em class="replaceable">
<code>
timezone_specifier
</code>
</em>
: [INTERVAL]
'+00:00' | 'UTC'
</p>
<a class="indexterm" name="idm46045200944144">
</a>
<p>
With
<a class="link" href="cast-functions.html#function_cast">
<code class="literal">
CAST(
<em class="replaceable">
<code>
expr
</code>
</em>
AS
<em class="replaceable">
<code>
type
</code>
</em>
</code>
</a>
syntax, the
<a class="link" href="cast-functions.html#function_cast">
<code class="literal">
CAST()
</code>
</a>
function takes an
expression of any type and produces a result value of the
specified type. This operation may also be expressed as
<a class="link" href="cast-functions.html#function_convert">
<code class="literal">
CONVERT(
<em class="replaceable">
<code>
expr
</code>
</em>
,
<em class="replaceable">
<code>
type
</code>
</em>
)
</code>
</a>
, which is
equivalent. If
<em class="replaceable">
<code>
expr
</code>
</em>
is
<code class="literal">
NULL
</code>
,
<code class="literal">
CAST()
</code>
returns
<code class="literal">
NULL
</code>
.
</p>
<p>
These
<em class="replaceable">
<code>
type
</code>
</em>
values are permitted:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<code class="literal">
BINARY[(
<em class="replaceable">
<code>
N
</code>
</em>
)]
</code>
</p>
<p>
Produces a string with the
<a class="link" href="binary-varbinary.html" title="13.3.3 The BINARY and VARBINARY Types">
<code class="literal">
VARBINARY
</code>
</a>
data type,
except that when the expression
<em class="replaceable">
<code>
expr
</code>
</em>
is empty (zero length),
the result type is
<code class="literal">
BINARY(0)
</code>
. If the
optional length
<em class="replaceable">
<code>
N
</code>
</em>
is given,
<code class="literal">
BINARY(
<em class="replaceable">
<code>
N
</code>
</em>
)
</code>
causes the cast to use no more than
<em class="replaceable">
<code>
N
</code>
</em>
bytes of the argument.
Values shorter than
<em class="replaceable">
<code>
N
</code>
</em>
bytes
are padded with
<code class="literal">
0x00
</code>
bytes to a
length of
<em class="replaceable">
<code>
N
</code>
</em>
. If the optional
length
<em class="replaceable">
<code>
N
</code>
</em>
is not given, MySQL
calculates the maximum length from the expression. If
the supplied or calculated length is greater than an
internal threshold, the result type is
<code class="literal">
BLOB
</code>
. If the length is still too
long, the result type is
<code class="literal">
LONGBLOB
</code>
.
</p>
<p>
For a description of how casting to
<code class="literal">
BINARY
</code>
affects comparisons, see
<a class="xref" href="binary-varbinary.html" title="13.3.3 The BINARY and VARBINARY Types">
Section 13.3.3, “The BINARY and VARBINARY Types”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
CHAR[(
<em class="replaceable">
<code>
N
</code>
</em>
)]
[
<em class="replaceable">
<code>
charset_info
</code>
</em>
]
</code>
</p>
<p>
Produces a string with the
<a class="link" href="char.html" title="13.3.2 The CHAR and VARCHAR Types">
<code class="literal">
VARCHAR
</code>
</a>
data type, unless
the expression
<em class="replaceable">
<code>
expr
</code>
</em>
is empty
(zero length), in which case the result type is
<code class="literal">
CHAR(0)
</code>
. If the optional length
<em class="replaceable">
<code>
N
</code>
</em>
is given,
<code class="literal">
CHAR(
<em class="replaceable">
<code>
N
</code>
</em>
)
</code>
causes the cast to use no more than
<em class="replaceable">
<code>
N
</code>
</em>
characters of the argument.
No padding occurs for values shorter than
<em class="replaceable">
<code>
N
</code>
</em>
characters. If the optional
length
<em class="replaceable">
<code>
N
</code>
</em>
is not given, MySQL
calculates the maximum length from the expression. If
the supplied or calculated length is greater than an
internal threshold, the result type is
<code class="literal">
TEXT
</code>
. If the length is still too
long, the result type is
<code class="literal">
LONGTEXT
</code>
.
</p>
<p>
With no
<em class="replaceable">
<code>
charset_info
</code>
</em>
clause,
<code class="literal">
CHAR
</code>
produces a string with the
default character set. To specify the character set
explicitly, these
<em class="replaceable">
<code>
charset_info
</code>
</em>
values are
permitted:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: square; ">
<li class="listitem">
<p>
<code class="literal">
CHARACTER SET
<em class="replaceable">
<code>
charset_name
</code>
</em>
</code>
:
Produces a string with the given character set.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
ASCII
</code>
: Shorthand for
<code class="literal">
CHARACTER SET latin1
</code>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
UNICODE
</code>
: Shorthand for
<code class="literal">
CHARACTER SET ucs2
</code>
.
</p>
</li>
</ul>
</div>
<p>
In all cases, the string has the character set default
collation.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
DATE
</code>
</p>
<p>
Produces a
<a class="link" href="datetime.html" title="13.2.2 The DATE, DATETIME, and TIMESTAMP Types">
<code class="literal">
DATE
</code>
</a>
value.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
DATETIME[(
<em class="replaceable">
<code>
M
</code>
</em>
)]
</code>
</p>
<p>
Produces a
<a class="link" href="datetime.html" title="13.2.2 The DATE, DATETIME, and TIMESTAMP Types">
<code class="literal">
DATETIME
</code>
</a>
value. If the optional
<em class="replaceable">
<code>
M
</code>
</em>
value is given, it specifies the fractional seconds
precision.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
DECIMAL[(
<em class="replaceable">
<code>
M
</code>
</em>
[,
<em class="replaceable">
<code>
D
</code>
</em>
])]
</code>
</p>
<p>
Produces 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.
If the optional
<em class="replaceable">
<code>
M
</code>
</em>
and
<em class="replaceable">
<code>
D
</code>
</em>
values are given, they
specify the maximum number of digits (the precision) and
the number of digits following the decimal point (the
scale). If
<em class="replaceable">
<code>
D
</code>
</em>
is omitted, 0 is
assumed. If
<em class="replaceable">
<code>
M
</code>
</em>
is omitted, 10
is assumed.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
DOUBLE
</code>
</p>
<p>
Produces a
<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>
result.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
FLOAT[(
<em class="replaceable">
<code>
p
</code>
</em>
)]
</code>
</p>
<p>
If the precision
<em class="replaceable">
<code>
p
</code>
</em>
is not
specified, produces a result of type
<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>
. If
<em class="replaceable">
<code>
p
</code>
</em>
is provided and 0 <=
<
<em class="replaceable">
<code>
p
</code>
</em>
<= 24, the result
is of type
<code class="literal">
FLOAT
</code>
. If 25 <=
<em class="replaceable">
<code>
p
</code>
</em>
<= 53, the result is of
type
<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>
. If
<em class="replaceable">
<code>
p
</code>
</em>
< 0 or
<em class="replaceable">
<code>
p
</code>
</em>
> 53, an error is
returned.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
JSON
</code>
</p>
<p>
Produces a
<a class="link" href="json.html" title="13.5 The JSON Data Type">
<code class="literal">
JSON
</code>
</a>
value.
For details on the rules for conversion of values
between
<a class="link" href="json.html" title="13.5 The JSON Data Type">
<code class="literal">
JSON
</code>
</a>
and other
types, see
<a class="xref" href="json.html#json-comparison" title="Comparison and Ordering of JSON Values">
Comparison and Ordering of JSON Values
</a>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
NCHAR[(
<em class="replaceable">
<code>
N
</code>
</em>
)]
</code>
</p>
<p>
Like
<code class="literal">
CHAR
</code>
, but produces a string with
the national character set. See
<a class="xref" href="charset-national.html" title="12.3.7 The National Character Set">
Section 12.3.7, “The National Character Set”
</a>
.
</p>
<p>
Unlike
<code class="literal">
CHAR
</code>
,
<code class="literal">
NCHAR
</code>
does not permit trailing character set information to be
specified.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
REAL
</code>
</p>
<p>
Produces a result of type
<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>
. This is actually
<code class="literal">
FLOAT
</code>
if the
<a class="link" href="sql-mode.html#sqlmode_real_as_float">
<code class="literal">
REAL_AS_FLOAT
</code>
</a>
SQL mode
is enabled; otherwise the result is of type
<code class="literal">
DOUBLE
</code>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
SIGNED [INTEGER]
</code>
</p>
<p>
Produces a signed
<a class="link" href="integer-types.html" title="13.1.2 Integer Types (Exact Value) - INTEGER, INT, SMALLINT, TINYINT, MEDIUMINT, BIGINT">
<code class="literal">
BIGINT
</code>
</a>
value.
</p>
</li>
<li class="listitem">
<p>
<em class="replaceable">
<code>
spatial_type
</code>
</em>
</p>
<p>
<a class="link" href="cast-functions.html#function_cast">
<code class="literal">
CAST()
</code>
</a>
and
<a class="link" href="cast-functions.html#function_convert">
<code class="literal">
CONVERT()
</code>
</a>
support casting
geometry values from one spatial type to another, for
certain combinations of spatial types. For details, see
<a class="xref" href="cast-functions.html#cast-spatial-types" title="Cast Operations on Spatial Types">
Cast Operations on Spatial Types
</a>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
TIME[(
<em class="replaceable">
<code>
M
</code>
</em>
)]
</code>
</p>
<p>
Produces a
<a class="link" href="time.html" title="13.2.3 The TIME Type">
<code class="literal">
TIME
</code>
</a>
value. If
the optional
<em class="replaceable">
<code>
M
</code>
</em>
value is
given, it specifies the fractional seconds precision.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
UNSIGNED [INTEGER]
</code>
</p>
<p>
Produces an unsigned
<a class="link" href="integer-types.html" title="13.1.2 Integer Types (Exact Value) - INTEGER, INT, SMALLINT, TINYINT, MEDIUMINT, BIGINT">
<code class="literal">
BIGINT
</code>
</a>
value.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
YEAR
</code>
</p>
<p>
Produces a
<a class="link" href="year.html" title="13.2.4 The YEAR Type">
<code class="literal">
YEAR
</code>
</a>
value.
These rules govern conversion to
<code class="literal">
YEAR
</code>
as follows:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: square; ">
<li class="listitem">
<p>
For a four-digit number in the range 1901-2155
inclusive, or for a string which can be interpreted
as a four-digit number in this range, return the
corresponding
<code class="literal">
YEAR
</code>
value.
</p>
</li>
<li class="listitem">
<p>
For a number consisting of one or two digits, or for
a string which can be interpreted as such a number,
return a
<code class="literal">
YEAR
</code>
value as follows:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
If the number is in the range 1-69 inclusive,
add 2000 and return the sum.
</p>
</li>
<li class="listitem">
<p>
If the number is in the range 70-99 inclusive,
add 1900 and return the sum.
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
For a string which evaluates to 0, return 2000.
</p>
</li>
<li class="listitem">
<p>
For the number 0, return 0.
</p>
</li>
<li class="listitem">
<p>
For 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="datetime.html" title="13.2.2 The DATE, DATETIME, and TIMESTAMP Types">
<code class="literal">
DATETIME
</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,
return the
<code class="literal">
YEAR
</code>
portion of the
value. For a
<a class="link" href="time.html" title="13.2.3 The TIME Type">
<code class="literal">
TIME
</code>
</a>
value, return the current year.
</p>
<p>
If you do not specify the type of a
<code class="literal">
TIME
</code>
argument, you may get a
different result from what you expect, as shown
here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa96234471"><div class="copy-help left">Press ⌘+C to 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">CAST</span><span class="token punctuation">(</span><span class="token string">"11:35:00"</span> <span class="token keyword">AS</span> <span class="token datatype">YEAR</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token function">CAST</span><span class="token punctuation">(</span><span class="token datatype">TIME</span> <span class="token string">"11:35:00"</span> <span class="token keyword">AS</span> <span class="token datatype">YEAR</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 class="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("11:35:00" AS YEAR) <span class="token punctuation">|</span> CAST(TIME "11:35:00" AS YEAR) <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> 2011 <span class="token punctuation">|</span> 2021 <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></code></pre>
</div>
</li>
<li class="listitem">
<p>
If the argument is of type
<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>
,
<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>
,
<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
<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>
, round the value
to the nearest integer, then attempt to cast the
value to
<code class="literal">
YEAR
</code>
using the rules for
integer values, as shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa64145784"><div class="copy-help left">Press ⌘+C to 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">CAST</span><span class="token punctuation">(</span><span class="token number">1944.35</span> <span class="token keyword">AS</span> <span class="token datatype">YEAR</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token function">CAST</span><span class="token punctuation">(</span><span class="token number">1944.50</span> <span class="token keyword">AS</span> <span class="token datatype">YEAR</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>
<span class="token output"><span class="token punctuation">|</span> CAST(1944.35 AS YEAR) <span class="token punctuation">|</span> CAST(1944.50 AS YEAR) <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>
<span class="token output"><span class="token punctuation">|</span> 1944 <span class="token punctuation">|</span> 1945 <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>
<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">66.35</span> <span class="token keyword">AS</span> <span class="token datatype">YEAR</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token function">CAST</span><span class="token punctuation">(</span><span class="token number">66.50</span> <span class="token keyword">AS</span> <span class="token datatype">YEAR</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>
<span class="token output"><span class="token punctuation">|</span> CAST(66.35 AS YEAR) <span class="token punctuation">|</span> CAST(66.50 AS YEAR) <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> 2066 <span class="token punctuation">|</span> 2067 <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>
<li class="listitem">
<p>
An argument of type
<a class="link" href="spatial-type-overview.html" title="13.4.1 Spatial Data Types">
<code class="literal">
GEOMETRY
</code>
</a>
cannot be
converted to
<a class="link" href="year.html" title="13.2.4 The YEAR Type">
<code class="literal">
YEAR
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
For a value that cannot be successfully converted to
<code class="literal">
YEAR
</code>
, return
<code class="literal">
NULL
</code>
.
</p>
</li>
</ul>
</div>
<p>
A string value containing non-numeric characters which
must be truncated prior to conversion raises a warning,
as shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa53644799"><div class="copy-help left">Press ⌘+C to 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">CAST</span><span class="token punctuation">(</span><span class="token string">"1979aaa"</span> <span class="token keyword">AS</span> <span class="token datatype">YEAR</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>
<span class="token output"><span class="token punctuation">|</span> CAST("1979aaa" AS YEAR) <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> 1979 <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, 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><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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>
<span class="token output"><span class="token punctuation">|</span> Warning <span class="token punctuation">|</span> 1292 <span class="token punctuation">|</span> Truncated incorrect YEAR value: '1979aaa' <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></code></pre>
</div>
</li>
</ul>
</div>
<p>
<a class="link" href="innodb-storage-engine.html" title="Chapter 17 The InnoDB Storage Engine">
<code class="literal">
InnoDB
</code>
</a>
allows the use of an
additional
<code class="literal">
ARRAY
</code>
keyword for creating a
multi-valued index on a
<a class="link" href="json.html" title="13.5 The JSON Data Type">
<code class="literal">
JSON
</code>
</a>
array as part of
<a class="link" href="create-index.html" title="15.1.15 CREATE INDEX Statement">
<code class="literal">
CREATE
INDEX
</code>
</a>
,
<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.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER
TABLE
</code>
</a>
statements.
<code class="literal">
ARRAY
</code>
is not
supported except when used to create a multi-valued index in
one of these statements, in which case it is required. The
column being indexed must be a column of type
<code class="literal">
JSON
</code>
. With
<code class="literal">
ARRAY
</code>
, the
<em class="replaceable">
<code>
type
</code>
</em>
following the
<code class="literal">
AS
</code>
keyword may specify any of the types
supported by
<code class="literal">
CAST()
</code>
, with the exceptions
of
<code class="literal">
BINARY
</code>
,
<code class="literal">
JSON
</code>
, and
<code class="literal">
YEAR
</code>
. For syntax information and
examples, as well as other relevant information, see
<a class="xref" href="create-index.html#create-index-multi-valued" title="Multi-Valued Indexes">
Multi-Valued Indexes
</a>
.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
<a class="link" href="cast-functions.html#function_convert">
<code class="literal">
CONVERT()
</code>
</a>
, unlike
<a class="link" href="cast-functions.html#function_cast">
<code class="literal">
CAST()
</code>
</a>
, does
<span class="emphasis">
<em>
not
</em>
</span>
support multi-valued index
creation or the
<code class="literal">
ARRAY
</code>
keyword.
</p>
</div>
<p>
<code class="literal">
CAST()
</code>
supports retrieval of a
<a class="link" href="datetime.html" title="13.2.2 The DATE, DATETIME, and TIMESTAMP Types">
<code class="literal">
TIMESTAMP
</code>
</a>
value as being in
UTC, using the
<code class="literal">
AT TIMEZONE
</code>
operator. The
only supported time zone is UTC; this can be specified as
either of
<code class="literal">
'+00:00'
</code>
or
<code class="literal">
'UTC'
</code>
. The only return type supported by
this syntax is
<code class="literal">
DATETIME
</code>
, with an optional
precision specifier in the range of 0 to 6, inclusive.
</p>
<p>
<code class="literal">
TIMESTAMP
</code>
values that use timezone
offsets are also supported.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa20477201"><div class="copy-help left">Press ⌘+C to 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 variable">@@system_time_zone</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> @@system_time_zone <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> EDT <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">1 row in set (0.00 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> tz <span class="token punctuation">(</span>c <span class="token datatype">TIMESTAMP</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 0 rows affected (0.41 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">INSERT</span> <span class="token keyword">INTO</span> tz <span class="token keyword">VALUES</span>
<span class="token prompt"> -></span> <span class="token keyword">ROW</span><span class="token punctuation">(</span><span class="token keyword">CURRENT_TIMESTAMP</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token prompt"> -></span> <span class="token keyword">ROW</span><span class="token punctuation">(</span><span class="token string">'2020-07-28 14:50:15+1:00'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 1 row affected (0.08 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">TABLE</span> tz<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>
<span class="token output"><span class="token punctuation">|</span> c <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>
<span class="token output"><span class="token punctuation">|</span> 2020<span class="token punctuation">-</span>07<span class="token punctuation">-</span>28 09:22:41 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 2020<span class="token punctuation">-</span>07<span class="token punctuation">-</span>28 09:50:15 <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>
<span class="token output">2 rows in set (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>c <span class="token keyword">AT</span> <span class="token datatype">TIME</span> ZONE <span class="token string">'+00:00'</span> <span class="token keyword">AS</span> <span class="token datatype">DATETIME</span><span class="token punctuation">)</span> <span class="token keyword">AS</span> u <span class="token keyword">FROM</span> tz<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>
<span class="token output"><span class="token punctuation">|</span> u <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>
<span class="token output"><span class="token punctuation">|</span> 2020<span class="token punctuation">-</span>07<span class="token punctuation">-</span>28 13:22:41 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 2020<span class="token punctuation">-</span>07<span class="token punctuation">-</span>28 13:50:15 <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>
<span class="token output">2 rows in set (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>c <span class="token keyword">AT</span> <span class="token datatype">TIME</span> ZONE <span class="token string">'UTC'</span> <span class="token keyword">AS</span> <span class="token datatype">DATETIME</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">AS</span> u <span class="token keyword">FROM</span> tz<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> u <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> 2020<span class="token punctuation">-</span>07<span class="token punctuation">-</span>28 13:22:41.00 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 2020<span class="token punctuation">-</span>07<span class="token punctuation">-</span>28 13:50:15.00 <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">2 rows in set (0.00 sec)</span></code></pre>
</div>
<p>
If you use
<code class="literal">
'UTC'
</code>
as the time zone
specifier with this form of
<code class="literal">
CAST()
</code>
, and
the server raises an error such as
<span class="errortext">
Unknown or
incorrect time zone: 'UTC'
</span>
, you may need to
install the MySQL time zone tables (see
<a class="xref" href="time-zone-support.html#time-zone-installation" title="Populating the Time Zone Tables">
Populating the Time Zone Tables
</a>
).
</p>
<p>
<code class="literal">
AT TIME ZONE
</code>
does not support the
<code class="literal">
ARRAY
</code>
keyword, and is not supported by
the
<a class="link" href="cast-functions.html#function_convert">
<code class="literal">
CONVERT()
</code>
</a>
function.
</p>
</li>
<li class="listitem">
<a name="function_convert">
</a>
<p>
<a class="link" href="cast-functions.html#function_convert">
<code class="literal">
CONVERT(
<em class="replaceable">
<code>
expr
</code>
</em>
USING
<em class="replaceable">
<code>
transcoding_name
</code>
</em>
)
</code>
</a>
</p>
<p>
<a class="link" href="cast-functions.html#function_convert">
<code class="literal">
CONVERT(
<em class="replaceable">
<code>
expr
</code>
</em>
,
<em class="replaceable">
<code>
type
</code>
</em>
)
</code>
</a>
</p>
<a class="indexterm" name="idm46045200754928">
</a>
<p>
<a class="link" href="cast-functions.html#function_convert">
<code class="literal">
CONVERT(
<em class="replaceable">
<code>
expr
</code>
</em>
USING
<em class="replaceable">
<code>
transcoding_name
</code>
</em>
)
</code>
</a>
is standard SQL syntax. The non-
<code class="literal">
USING
</code>
form of
<a class="link" href="cast-functions.html#function_convert">
<code class="literal">
CONVERT()
</code>
</a>
is ODBC
syntax. Regardless of the syntax used, the function returns
<code class="literal">
NULL
</code>
if
<em class="replaceable">
<code>
expr
</code>
</em>
is
<code class="literal">
NULL
</code>
.
</p>
<p>
<a class="link" href="cast-functions.html#function_convert">
<code class="literal">
CONVERT(
<em class="replaceable">
<code>
expr
</code>
</em>
USING
<em class="replaceable">
<code>
transcoding_name
</code>
</em>
)
</code>
</a>
converts data between different character sets. In MySQL,
transcoding names are the same as the corresponding
character set names. For example, this statement converts
the string
<code class="literal">
'abc'
</code>
in the default character
set to the corresponding string in the
<code class="literal">
utf8mb4
</code>
character set:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa25212896"><div class="copy-help left">Press ⌘+C to 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">CONVERT</span><span class="token punctuation">(</span><span class="token string">'abc'</span> <span class="token keyword">USING</span> utf8mb4<span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
<a class="link" href="cast-functions.html#function_convert">
<code class="literal">
CONVERT(
<em class="replaceable">
<code>
expr
</code>
</em>
,
<em class="replaceable">
<code>
type
</code>
</em>
)
</code>
</a>
syntax (without
<code class="literal">
USING
</code>
) takes an expression and a
<em class="replaceable">
<code>
type
</code>
</em>
value specifying a result
type, and produces a result value of the specified type.
This operation may also be expressed as
<a class="link" href="cast-functions.html#function_cast">
<code class="literal">
CAST(
<em class="replaceable">
<code>
expr
</code>
</em>
AS
<em class="replaceable">
<code>
type
</code>
</em>
)
</code>
</a>
, which is
equivalent. For more information, see the description of
<a class="link" href="cast-functions.html#function_cast">
<code class="literal">
CAST()
</code>
</a>
.
</p>
</li>
</ul>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h3 class="title">
<a name="cast-character-set-conversions">
</a>
Character Set Conversions
</h3>
</div>
</div>
</div>
<p>
<a class="link" href="cast-functions.html#function_convert">
<code class="literal">
CONVERT()
</code>
</a>
with a
<code class="literal">
USING
</code>
clause converts data between character
sets:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa40096737"><div class="copy-help left">Press ⌘+C to 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 function">CONVERT</span><span class="token punctuation">(</span><em class="replaceable">expr</em> <span class="token keyword">USING</span> <em class="replaceable">transcoding_name</em><span class="token punctuation">)</span></code></pre>
</div>
<p>
In MySQL, transcoding names are the same as the corresponding
character set names.
</p>
<p>
Examples:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa6303933"><div class="copy-help left">Press ⌘+C to 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">CONVERT</span><span class="token punctuation">(</span><span class="token string">'test'</span> <span class="token keyword">USING</span> utf8mb4<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">SELECT</span> <span class="token function">CONVERT</span><span class="token punctuation">(</span>_latin1<span class="token string">'Müller'</span> <span class="token keyword">USING</span> utf8mb4<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">INSERT</span> <span class="token keyword">INTO</span> utf8mb4_table <span class="token punctuation">(</span>utf8mb4_column<span class="token punctuation">)</span>
<span class="token keyword">SELECT</span> <span class="token function">CONVERT</span><span class="token punctuation">(</span>latin1_column <span class="token keyword">USING</span> utf8mb4<span class="token punctuation">)</span> <span class="token keyword">FROM</span> latin1_table<span class="token punctuation">;</span></code></pre>
</div>
<p>
To convert strings between character sets, you can also use
<a class="link" href="cast-functions.html#function_convert">
<code class="literal">
CONVERT(
<em class="replaceable">
<code>
expr
</code>
</em>
,
<em class="replaceable">
<code>
type
</code>
</em>
)
</code>
</a>
syntax (without
<code class="literal">
USING
</code>
), or
<a class="link" href="cast-functions.html#function_cast">
<code class="literal">
CAST(
<em class="replaceable">
<code>
expr
</code>
</em>
AS
<em class="replaceable">
<code>
type
</code>
</em>
)
</code>
</a>
, which is equivalent:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa8663981"><div class="copy-help left">Press ⌘+C to 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 function">CONVERT</span><span class="token punctuation">(</span><span class="token keyword"><em class="replaceable">string</em></span><span class="token punctuation">,</span> <span class="token datatype">CHAR</span><span class="token punctuation">[</span><span class="token punctuation">(</span><em class="replaceable">N</em><span class="token punctuation">)</span><span class="token punctuation">]</span> <span class="token keyword">CHARACTER</span> <span class="token keyword">SET</span> <em class="replaceable">charset_name</em><span class="token punctuation">)</span>
<span class="token function">CAST</span><span class="token punctuation">(</span><span class="token keyword"><em class="replaceable">string</em></span> <span class="token keyword">AS</span> <span class="token datatype">CHAR</span><span class="token punctuation">[</span><span class="token punctuation">(</span><em class="replaceable">N</em><span class="token punctuation">)</span><span class="token punctuation">]</span> <span class="token keyword">CHARACTER</span> <span class="token keyword">SET</span> <em class="replaceable">charset_name</em><span class="token punctuation">)</span></code></pre>
</div>
<p>
Examples:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa78562723"><div class="copy-help left">Press ⌘+C to 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">CONVERT</span><span class="token punctuation">(</span><span class="token string">'test'</span><span class="token punctuation">,</span> <span class="token datatype">CHAR</span> <span class="token keyword">CHARACTER</span> <span class="token keyword">SET</span> utf8mb4<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">SELECT</span> <span class="token function">CAST</span><span class="token punctuation">(</span><span class="token string">'test'</span> <span class="token keyword">AS</span> <span class="token datatype">CHAR</span> <span class="token keyword">CHARACTER</span> <span class="token keyword">SET</span> utf8mb4<span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
If you specify
<code class="literal">
CHARACTER SET
<em class="replaceable">
<code>
charset_name
</code>
</em>
</code>
as just shown,
the character set and collation of the result are
<em class="replaceable">
<code>
charset_name
</code>
</em>
and the default
collation of
<em class="replaceable">
<code>
charset_name
</code>
</em>
. If you
omit
<code class="literal">
CHARACTER SET
<em class="replaceable">
<code>
charset_name
</code>
</em>
</code>
, the character
set and collation of the result are defined by the
<a class="link" href="server-system-variables.html#sysvar_character_set_connection">
<code class="literal">
character_set_connection
</code>
</a>
and
<a class="link" href="server-system-variables.html#sysvar_collation_connection">
<code class="literal">
collation_connection
</code>
</a>
system
variables that determine the default connection character set
and collation (see
<a class="xref" href="charset-connection.html" title="12.4 Connection Character Sets and Collations">
Section 12.4, “Connection Character Sets and Collations”
</a>
).
</p>
<p>
A
<code class="literal">
COLLATE
</code>
clause is not permitted within a
<a class="link" href="cast-functions.html#function_convert">
<code class="literal">
CONVERT()
</code>
</a>
or
<a class="link" href="cast-functions.html#function_cast">
<code class="literal">
CAST()
</code>
</a>
call, but you can apply it
to the function result. For example, these are legal:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa18164038"><div class="copy-help left">Press ⌘+C to 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">CONVERT</span><span class="token punctuation">(</span><span class="token string">'test'</span> <span class="token keyword">USING</span> utf8mb4<span class="token punctuation">)</span> <span class="token keyword">COLLATE</span> utf8mb4_bin<span class="token punctuation">;</span>
<span class="token keyword">SELECT</span> <span class="token function">CONVERT</span><span class="token punctuation">(</span><span class="token string">'test'</span><span class="token punctuation">,</span> <span class="token datatype">CHAR</span> <span class="token keyword">CHARACTER</span> <span class="token keyword">SET</span> utf8mb4<span class="token punctuation">)</span> <span class="token keyword">COLLATE</span> utf8mb4_bin<span class="token punctuation">;</span>
<span class="token keyword">SELECT</span> <span class="token function">CAST</span><span class="token punctuation">(</span><span class="token string">'test'</span> <span class="token keyword">AS</span> <span class="token datatype">CHAR</span> <span class="token keyword">CHARACTER</span> <span class="token keyword">SET</span> utf8mb4<span class="token punctuation">)</span> <span class="token keyword">COLLATE</span> utf8mb4_bin<span class="token punctuation">;</span></code></pre>
</div>
<p>
But these are illegal:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa84668854"><div class="copy-help left">Press ⌘+C to 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">CONVERT</span><span class="token punctuation">(</span><span class="token string">'test'</span> <span class="token keyword">USING</span> utf8mb4 <span class="token keyword">COLLATE</span> utf8mb4_bin<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">SELECT</span> <span class="token function">CONVERT</span><span class="token punctuation">(</span><span class="token string">'test'</span><span class="token punctuation">,</span> <span class="token datatype">CHAR</span> <span class="token keyword">CHARACTER</span> <span class="token keyword">SET</span> utf8mb4 <span class="token keyword">COLLATE</span> utf8mb4_bin<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">SELECT</span> <span class="token function">CAST</span><span class="token punctuation">(</span><span class="token string">'test'</span> <span class="token keyword">AS</span> <span class="token datatype">CHAR</span> <span class="token keyword">CHARACTER</span> <span class="token keyword">SET</span> utf8mb4 <span class="token keyword">COLLATE</span> utf8mb4_bin<span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
For string literals, another way to specify the character set is
to use a character set introducer.
<code class="literal">
_latin1
</code>
and
<code class="literal">
_latin2
</code>
in the preceding example are
instances of introducers. Unlike conversion functions such as
<a class="link" href="cast-functions.html#function_cast">
<code class="literal">
CAST()
</code>
</a>
, or
<a class="link" href="cast-functions.html#function_convert">
<code class="literal">
CONVERT()
</code>
</a>
, which convert a string
from one character set to another, an introducer designates a
string literal as having a particular character set, with no
conversion involved. For more information, see
<a class="xref" href="charset-introducer.html" title="12.3.8 Character Set Introducers">
Section 12.3.8, “Character Set Introducers”
</a>
.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h3 class="title">
<a name="cast-string-comparisons">
</a>
Character Set Conversions for String Comparisons
</h3>
</div>
</div>
</div>
<p>
Normally, you cannot compare a
<a class="link" href="blob.html" title="13.3.4 The BLOB and TEXT Types">
<code class="literal">
BLOB
</code>
</a>
value or other binary string
in case-insensitive fashion because binary strings use the
<code class="literal">
binary
</code>
character set, which has no collation
with the concept of lettercase. To perform a case-insensitive
comparison, first use the
<a class="link" href="cast-functions.html#function_convert">
<code class="literal">
CONVERT()
</code>
</a>
or
<a class="link" href="cast-functions.html#function_cast">
<code class="literal">
CAST()
</code>
</a>
function to convert the
value to a nonbinary string. Comparisons of the resulting string
use its collation. For example, if the conversion result
collation is not case-sensitive, a
<a class="link" href="string-comparison-functions.html#operator_like">
<code class="literal">
LIKE
</code>
</a>
operation is not
case-sensitive. That is true for the following operation because
the default
<code class="literal">
utf8mb4
</code>
collation
(
<code class="literal">
utf8mb4_0900_ai_ci
</code>
) is not case-sensitive:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa6271302"><div class="copy-help left">Press ⌘+C to 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 string">'A'</span> <span class="token operator">LIKE</span> <span class="token function">CONVERT</span><span class="token punctuation">(</span><em class="replaceable">blob_col</em> <span class="token keyword">USING</span> utf8mb4<span class="token punctuation">)</span>
<span class="token keyword">FROM</span> <em class="replaceable">tbl_name</em><span class="token punctuation">;</span></code></pre>
</div>
<p>
To specify a particular collation for the converted string, use
a
<code class="literal">
COLLATE
</code>
clause following the
<a class="link" href="cast-functions.html#function_convert">
<code class="literal">
CONVERT()
</code>
</a>
call:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa15754603"><div class="copy-help left">Press ⌘+C to 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 string">'A'</span> <span class="token operator">LIKE</span> <span class="token function">CONVERT</span><span class="token punctuation">(</span><em class="replaceable">blob_col</em> <span class="token keyword">USING</span> utf8mb4<span class="token punctuation">)</span> <span class="token keyword">COLLATE</span> utf8mb4_unicode_ci
<span class="token keyword">FROM</span> <em class="replaceable">tbl_name</em><span class="token punctuation">;</span></code></pre>
</div>
<p>
To use a different character set, substitute its name for
<code class="literal">
utf8mb4
</code>
in the preceding statements (and
similarly to use a different collation).
</p>
<p>
<a class="link" href="cast-functions.html#function_convert">
<code class="literal">
CONVERT()
</code>
</a>
and
<a class="link" href="cast-functions.html#function_cast">
<code class="literal">
CAST()
</code>
</a>
can be used more generally
for comparing strings represented in different character sets.
For example, a comparison of these strings results in an error
because they have different character sets:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa11484303"><div class="copy-help left">Press ⌘+C to 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 variable">@s1</span> <span class="token operator">=</span> _latin1 <span class="token string">'abc'</span><span class="token punctuation">,</span> <span class="token variable">@s2</span> <span class="token operator">=</span> _latin2 <span class="token string">'abc'</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token variable">@s1</span> <span class="token operator">=</span> <span class="token variable">@s2</span><span class="token punctuation">;</span>
<span class="token output">ERROR 1267 (HY000)<span class="token punctuation">:</span> Illegal mix of collations (latin1_swedish_ci,IMPLICIT)
and (latin2_general_ci,IMPLICIT) for operation '='</span></code></pre>
</div>
<p>
Converting one of the strings to a character set compatible with
the other enables the comparison to occur without error:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa54613635"><div class="copy-help left">Press ⌘+C to 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 variable">@s1</span> <span class="token operator">=</span> <span class="token function">CONVERT</span><span class="token punctuation">(</span><span class="token variable">@s2</span> <span class="token keyword">USING</span> latin1<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> @s1 = CONVERT(@s2 USING latin1) <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> 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></code></pre>
</div>
<p>
Character set conversion is also useful preceding lettercase
conversion of binary strings.
<a class="link" href="string-functions.html#function_lower">
<code class="literal">
LOWER()
</code>
</a>
and
<a class="link" href="string-functions.html#function_upper">
<code class="literal">
UPPER()
</code>
</a>
are ineffective when
applied directly to binary strings because the concept of
lettercase does not apply. To perform lettercase conversion of a
binary string, first convert it to a nonbinary string using a
character set appropriate for the data stored in the string:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa94992452"><div class="copy-help left">Press ⌘+C to 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 variable">@str</span> <span class="token operator">=</span> <span class="token datatype">BINARY</span> <span class="token string">'New York'</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">LOWER</span><span class="token punctuation">(</span><span class="token variable">@str</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token function">LOWER</span><span class="token punctuation">(</span><span class="token function">CONVERT</span><span class="token punctuation">(</span><span class="token variable">@str</span> <span class="token keyword">USING</span> utf8mb4<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>
<span class="token output"><span class="token punctuation">|</span> LOWER(@str) <span class="token punctuation">|</span> LOWER(CONVERT(@str USING utf8mb4)) <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> New York <span class="token punctuation">|</span> new york <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>
<p>
Be aware that if you apply
<a class="link" href="cast-functions.html#operator_binary">
<code class="literal">
BINARY
</code>
</a>
,
<a class="link" href="cast-functions.html#function_cast">
<code class="literal">
CAST()
</code>
</a>
, or
<a class="link" href="cast-functions.html#function_convert">
<code class="literal">
CONVERT()
</code>
</a>
to an indexed column,
MySQL may not be able to use the index efficiently.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h3 class="title">
<a name="cast-spatial-types">
</a>
Cast Operations on Spatial Types
</h3>
</div>
</div>
</div>
<p>
<a class="link" href="cast-functions.html#function_cast">
<code class="literal">
CAST()
</code>
</a>
and
<a class="link" href="cast-functions.html#function_convert">
<code class="literal">
CONVERT()
</code>
</a>
support casting
geometry values from one spatial type to another, for certain
combinations of spatial types. The following list shows the
permitted type combinations, where
<span class="quote">
“
<span class="quote">
MySQL
extension
</span>
”
</span>
designates casts implemented in MySQL beyond
those defined in the
<a class="link" href="spatial-types.html" title="13.4 Spatial Data Types">
SQL/MM
standard
</a>
:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
From
<code class="literal">
Point
</code>
to:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<code class="literal">
MultiPoint
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
GeometryCollection
</code>
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
From
<code class="literal">
LineString
</code>
to:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<code class="literal">
Polygon
</code>
(MySQL extension)
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
MultiPoint
</code>
(MySQL extension)
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
MultiLineString
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
GeometryCollection
</code>
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
From
<code class="literal">
Polygon
</code>
to:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<code class="literal">
LineString
</code>
(MySQL extension)
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
MultiLineString
</code>
(MySQL extension)
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
MultiPolygon
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
GeometryCollection
</code>
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
From
<code class="literal">
MultiPoint
</code>
to:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<code class="literal">
Point
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
LineString
</code>
(MySQL extension)
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
GeometryCollection
</code>
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
From
<code class="literal">
MultiLineString
</code>
to:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<code class="literal">
LineString
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
Polygon
</code>
(MySQL extension)
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
MultiPolygon
</code>
(MySQL extension)
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
GeometryCollection
</code>
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
From
<code class="literal">
MultiPolygon
</code>
to:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<code class="literal">
Polygon
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
MultiLineString
</code>
(MySQL extension)
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
GeometryCollection
</code>
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
From
<code class="literal">
GeometryCollection
</code>
to:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<code class="literal">
Point
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
LineString
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
Polygon
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
MultiPoint
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
MultiLineString
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
MultiPolygon
</code>
</p>
</li>
</ul>
</div>
</li>
</ul>
</div>
<p>
In spatial casts,
<code class="literal">
GeometryCollection
</code>
and
<code class="literal">
GeomCollection
</code>
are synonyms for the same
result type.
</p>
<p>
Some conditions apply to all spatial type casts, and some
conditions apply only when the cast result is to have a
particular spatial type. For information about terms such as
<span class="quote">
“
<span class="quote">
well-formed geometry,
</span>
”
</span>
see
<a class="xref" href="geometry-well-formedness-validity.html" title="13.4.4 Geometry Well-Formedness and Validity">
Section 13.4.4, “Geometry Well-Formedness and Validity”
</a>
.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="xref" href="cast-functions.html#spatial-cast-general-conditions" title="General Conditions for Spatial Casts">
General Conditions for Spatial Casts
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="cast-functions.html#spatial-cast-point-conditions" title="Conditions for Casts to Point">
Conditions for Casts to Point
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="cast-functions.html#spatial-cast-linestring-conditions" title="Conditions for Casts to LineString">
Conditions for Casts to LineString
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="cast-functions.html#spatial-cast-polygon-conditions" title="Conditions for Casts to Polygon">
Conditions for Casts to Polygon
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="cast-functions.html#spatial-cast-multipoint-conditions" title="Conditions for Casts to MultiPoint">
Conditions for Casts to MultiPoint
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="cast-functions.html#spatial-cast-multilinestring-conditions" title="Conditions for Casts to MultiLineString">
Conditions for Casts to MultiLineString
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="cast-functions.html#spatial-cast-multipolygon-conditions" title="Conditions for Casts to MultiPolygon">
Conditions for Casts to MultiPolygon
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="cast-functions.html#spatial-cast-geometrycollection-conditions" title="Conditions for Casts to GeometryCollection">
Conditions for Casts to GeometryCollection
</a>
</p>
</li>
</ul>
</div>
<h4>
<a name="spatial-cast-general-conditions">
</a>
General Conditions for Spatial Casts
</h4>
<p>
These conditions apply to all spatial casts regardless of the
result type:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
The result of a cast is in the same SRS as that of the
expression to cast.
</p>
</li>
<li class="listitem">
<p>
Casting between spatial types does not change coordinate
values or order.
</p>
</li>
<li class="listitem">
<p>
If the expression to cast is
<code class="literal">
NULL
</code>
, the
function result is
<code class="literal">
NULL
</code>
.
</p>
</li>
<li class="listitem">
<p>
Casting to spatial types using the
<a class="link" href="json-search-functions.html#function_json-value">
<code class="literal">
JSON_VALUE()
</code>
</a>
function with a
<code class="literal">
RETURNING
</code>
clause specifying a spatial
type is not permitted.
</p>
</li>
<li class="listitem">
<p>
Casting to an
<code class="literal">
ARRAY
</code>
of spatial types is
not permitted.
</p>
</li>
<li class="listitem">
<p>
If the spatial type combination is permitted but the
expression to cast is not a syntactically well-formed
geometry, an
<a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_gis_invalid_data" target="_top">
<code class="literal">
ER_GIS_INVALID_DATA
</code>
</a>
error
occurs.
</p>
</li>
<li class="listitem">
<p>
If the spatial type combination is permitted but the
expression to cast is a syntactically well-formed geometry
in an undefined spatial reference system (SRS), an
<a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_srs_not_found" target="_top">
<code class="literal">
ER_SRS_NOT_FOUND
</code>
</a>
error
occurs.
</p>
</li>
<li class="listitem">
<p>
If the expression to cast has a geographic SRS but has a
longitude or latitude that is out of range, an error occurs:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
If a longitude value is not in the range (−180,
180], an
<a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_geometry_param_longitude_out_of_range" target="_top">
<code class="literal">
ER_GEOMETRY_PARAM_LONGITUDE_OUT_OF_RANGE
</code>
</a>
error occurs.
</p>
</li>
<li class="listitem">
<p>
If a latitude value is not in the range [−90, 90],
an
<a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_geometry_param_latitude_out_of_range" target="_top">
<code class="literal">
ER_GEOMETRY_PARAM_LATITUDE_OUT_OF_RANGE
</code>
</a>
error occurs.
</p>
</li>
</ul>
</div>
<p>
Ranges shown are in degrees. If an SRS uses another unit,
the range uses the corresponding values in its unit. The
exact range limits deviate slightly due to floating-point
arithmetic.
</p>
</li>
</ul>
</div>
<h4>
<a name="spatial-cast-point-conditions">
</a>
Conditions for Casts to Point
</h4>
<p>
When the cast result type is
<code class="literal">
Point
</code>
, these
conditions apply:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
If the expression to cast is a well-formed geometry of type
<code class="literal">
Point
</code>
, the function result is that
<code class="literal">
Point
</code>
.
</p>
</li>
<li class="listitem">
<p>
If the expression to cast is a well-formed geometry of type
<code class="literal">
MultiPoint
</code>
containing a single
<code class="literal">
Point
</code>
, the function result is that
<code class="literal">
Point
</code>
. If the expression contains more
than one
<code class="literal">
Point
</code>
, an
<a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_invalid_cast_to_geometry" target="_top">
<code class="literal">
ER_INVALID_CAST_TO_GEOMETRY
</code>
</a>
error occurs.
</p>
</li>
<li class="listitem">
<p>
If the expression to cast is a well-formed geometry of type
<code class="literal">
GeometryCollection
</code>
containing only a
single
<code class="literal">
Point
</code>
, the function result is that
<code class="literal">
Point
</code>
. If the expression is empty,
contains more than one
<code class="literal">
Point
</code>
, or contains
other geometry types, an
<a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_invalid_cast_to_geometry" target="_top">
<code class="literal">
ER_INVALID_CAST_TO_GEOMETRY
</code>
</a>
error occurs.
</p>
</li>
<li class="listitem">
<p>
If the expression to cast is a well-formed geometry of type
other than
<code class="literal">
Point
</code>
,
<code class="literal">
MultiPoint
</code>
,
<code class="literal">
GeometryCollection
</code>
, an
<a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_invalid_cast_to_geometry" target="_top">
<code class="literal">
ER_INVALID_CAST_TO_GEOMETRY
</code>
</a>
error occurs.
</p>
</li>
</ul>
</div>
<h4>
<a name="spatial-cast-linestring-conditions">
</a>
Conditions for Casts to LineString
</h4>
<p>
When the cast result type is
<code class="literal">
LineString
</code>
,
these conditions apply:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
If the expression to cast is a well-formed geometry of type
<code class="literal">
LineString
</code>
, the function result is that
<code class="literal">
LineString
</code>
.
</p>
</li>
<li class="listitem">
<p>
If the expression to cast is a well-formed geometry of type
<code class="literal">
Polygon
</code>
that has no inner rings, the
function result is a
<code class="literal">
LineString
</code>
containing the points of the outer ring in the same order.
If the expression has inner rings, an
<a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_invalid_cast_to_geometry" target="_top">
<code class="literal">
ER_INVALID_CAST_TO_GEOMETRY
</code>
</a>
error occurs.
</p>
</li>
<li class="listitem">
<p>
If the expression to cast is a well-formed geometry of type
<code class="literal">
MultiPoint
</code>
containing at least two
points, the function result is a
<code class="literal">
LineString
</code>
containing the points of the
<code class="literal">
MultiPoint
</code>
in the order they appear in
the expression. If the expression contains only one
<code class="literal">
Point
</code>
, an
<a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_invalid_cast_to_geometry" target="_top">
<code class="literal">
ER_INVALID_CAST_TO_GEOMETRY
</code>
</a>
error occurs.
</p>
</li>
<li class="listitem">
<p>
If the expression to cast is a well-formed geometry of type
<code class="literal">
MultiLineString
</code>
containing a single
<code class="literal">
LineString
</code>
, the function result is that
<code class="literal">
LineString
</code>
. If the expression contains
more than one
<code class="literal">
LineString
</code>
, an
<a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_invalid_cast_to_geometry" target="_top">
<code class="literal">
ER_INVALID_CAST_TO_GEOMETRY
</code>
</a>
error occurs.
</p>
</li>
<li class="listitem">
<p>
If the expression to cast is a well-formed geometry of type
<code class="literal">
GeometryCollection
</code>
, containing only a
single
<code class="literal">
LineString
</code>
, the function result is
that
<code class="literal">
LineString
</code>
. If the expression is
empty, contains more than one
<code class="literal">
LineString
</code>
,
or contains other geometry types, an
<a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_invalid_cast_to_geometry" target="_top">
<code class="literal">
ER_INVALID_CAST_TO_GEOMETRY
</code>
</a>
error occurs.
</p>
</li>
<li class="listitem">
<p>
If the expression to cast is a well-formed geometry of type
other than
<code class="literal">
LineString
</code>
,
<code class="literal">
Polygon
</code>
,
<code class="literal">
MultiPoint
</code>
,
<code class="literal">
MultiLineString
</code>
, or
<code class="literal">
GeometryCollection
</code>
, an
<a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_invalid_cast_to_geometry" target="_top">
<code class="literal">
ER_INVALID_CAST_TO_GEOMETRY
</code>
</a>
error occurs.
</p>
</li>
</ul>
</div>
<h4>
<a name="spatial-cast-polygon-conditions">
</a>
Conditions for Casts to Polygon
</h4>
<p>
When the cast result type is
<code class="literal">
Polygon
</code>
, these
conditions apply:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
If the expression to cast is a well-formed geometry of type
<code class="literal">
LineString
</code>
that is a ring (that is, the
start and end points are the same), the function result is a
<code class="literal">
Polygon
</code>
with an outer ring consisting of
the points of the
<code class="literal">
LineString
</code>
in the same
order. If the expression is not a ring, an
<a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_invalid_cast_to_geometry" target="_top">
<code class="literal">
ER_INVALID_CAST_TO_GEOMETRY
</code>
</a>
error occurs. If the ring is not in the correct order (the
exterior ring must be counter-clockwise), an
<a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_invalid_cast_polygon_ring_direction" target="_top">
<code class="literal">
ER_INVALID_CAST_POLYGON_RING_DIRECTION
</code>
</a>
error occurs.
</p>
</li>
<li class="listitem">
<p>
If the expression to cast is a well-formed geometry of type
<code class="literal">
Polygon
</code>
, the function result is that
<code class="literal">
Polygon
</code>
.
</p>
</li>
<li class="listitem">
<p>
If the expression to cast is a well-formed geometry of type
<code class="literal">
MultiLineString
</code>
where all elements are
rings, the function result is a
<code class="literal">
Polygon
</code>
with the first
<code class="literal">
LineString
</code>
as outer ring
and any additional
<code class="literal">
LineString
</code>
values as
inner rings. If any element of the expression is not a ring,
an
<a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_invalid_cast_to_geometry" target="_top">
<code class="literal">
ER_INVALID_CAST_TO_GEOMETRY
</code>
</a>
error occurs. If any ring is not in the correct order (the
exterior ring must be counter-clockwise, interior rings must
be clockwise), an
<a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_invalid_cast_polygon_ring_direction" target="_top">
<code class="literal">
ER_INVALID_CAST_POLYGON_RING_DIRECTION
</code>
</a>
error occurs.
</p>
</li>
<li class="listitem">
<p>
If the expression to cast is a well-formed geometry of type
<code class="literal">
MultiPolygon
</code>
containing a single
<code class="literal">
Polygon
</code>
, the function result is that
<code class="literal">
Polygon
</code>
. If the expression contains more
than one
<code class="literal">
Polygon
</code>
, an
<a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_invalid_cast_to_geometry" target="_top">
<code class="literal">
ER_INVALID_CAST_TO_GEOMETRY
</code>
</a>
error occurs.
</p>
</li>
<li class="listitem">
<p>
If the expression to cast is a well-formed geometry of type
<code class="literal">
GeometryCollection
</code>
containing only a
single
<code class="literal">
Polygon
</code>
, the function result is
that
<code class="literal">
Polygon
</code>
. If the expression is empty,
contains more than one
<code class="literal">
Polygon
</code>
, or
contains other geometry types, an
<a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_invalid_cast_to_geometry" target="_top">
<code class="literal">
ER_INVALID_CAST_TO_GEOMETRY
</code>
</a>
error occurs.
</p>
</li>
<li class="listitem">
<p>
If the expression to cast is a well-formed geometry of type
other than
<code class="literal">
LineString
</code>
,
<code class="literal">
Polygon
</code>
,
<code class="literal">
MultiLineString
</code>
,
<code class="literal">
MultiPolygon
</code>
, or
<code class="literal">
GeometryCollection
</code>
, an
<a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_invalid_cast_to_geometry" target="_top">
<code class="literal">
ER_INVALID_CAST_TO_GEOMETRY
</code>
</a>
error occurs.
</p>
</li>
</ul>
</div>
<h4>
<a name="spatial-cast-multipoint-conditions">
</a>
Conditions for Casts to MultiPoint
</h4>
<p>
When the cast result type is
<code class="literal">
MultiPoint
</code>
,
these conditions apply:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
If the expression to cast is a well-formed geometry of type
<code class="literal">
Point
</code>
, the function result is a
<code class="literal">
MultiPoint
</code>
containing that
<code class="literal">
Point
</code>
as its sole element.
</p>
</li>
<li class="listitem">
<p>
If the expression to cast is a well-formed geometry of type
<code class="literal">
LineString
</code>
, the function result is a
<code class="literal">
MultiPoint
</code>
containing the points of the
<code class="literal">
LineString
</code>
in the same order.
</p>
</li>
<li class="listitem">
<p>
If the expression to cast is a well-formed geometry of type
<code class="literal">
MultiPoint
</code>
, the function result is that
<code class="literal">
MultiPoint
</code>
.
</p>
</li>
<li class="listitem">
<p>
If the expression to cast is a well-formed geometry of type
<code class="literal">
GeometryCollection
</code>
containing only
points, the function result is a
<code class="literal">
MultiPoint
</code>
containing those points. If
the
<code class="literal">
GeometryCollection
</code>
is empty or
contains other geometry types, an
<a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_invalid_cast_to_geometry" target="_top">
<code class="literal">
ER_INVALID_CAST_TO_GEOMETRY
</code>
</a>
error occurs.
</p>
</li>
<li class="listitem">
<p>
If the expression to cast is a well-formed geometry of type
other than
<code class="literal">
Point
</code>
,
<code class="literal">
LineString
</code>
,
<code class="literal">
MultiPoint
</code>
, or
<code class="literal">
GeometryCollection
</code>
, an
<a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_invalid_cast_to_geometry" target="_top">
<code class="literal">
ER_INVALID_CAST_TO_GEOMETRY
</code>
</a>
error occurs.
</p>
</li>
</ul>
</div>
<h4>
<a name="spatial-cast-multilinestring-conditions">
</a>
Conditions for Casts to MultiLineString
</h4>
<p>
When the cast result type is
<code class="literal">
MultiLineString
</code>
,
these conditions apply:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
If the expression to cast is a well-formed geometry of type
<code class="literal">
LineString
</code>
, the function result is a
<code class="literal">
MultiLineString
</code>
containing that
<code class="literal">
LineString
</code>
as its sole element.
</p>
</li>
<li class="listitem">
<p>
If the expression to cast is a well-formed geometry of type
<code class="literal">
Polygon
</code>
, the function result is a
<code class="literal">
MultiLineString
</code>
containing the outer ring
of the
<code class="literal">
Polygon
</code>
as its first element and
any inner rings as additional elements in the order they
appear in the expression.
</p>
</li>
<li class="listitem">
<p>
If the expression to cast is a well-formed geometry of type
<code class="literal">
MultiLineString
</code>
, the function result is
that
<code class="literal">
MultiLineString
</code>
.
</p>
</li>
<li class="listitem">
<p>
If the expression to cast is a well-formed geometry of type
<code class="literal">
MultiPolygon
</code>
containing only polygons
without inner rings, the function result is a
<code class="literal">
MultiLineString
</code>
containing the polygon
rings in the order they appear in the expression. If the
expression contains any polygons with inner rings, an
<a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_wrong_parameters_to_stored_fct" target="_top">
<code class="literal">
ER_WRONG_PARAMETERS_TO_STORED_FCT
</code>
</a>
error occurs.
</p>
</li>
<li class="listitem">
<p>
If the expression to cast is a well-formed geometry of type
<code class="literal">
GeometryCollection
</code>
containing only
linestrings, the function result is a
<code class="literal">
MultiLineString
</code>
containing those
linestrings. If the expression is empty or contains other
geometry types, an
<a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_invalid_cast_to_geometry" target="_top">
<code class="literal">
ER_INVALID_CAST_TO_GEOMETRY
</code>
</a>
error occurs.
</p>
</li>
<li class="listitem">
<p>
If the expression to cast is a well-formed geometry of type
other than
<code class="literal">
LineString
</code>
,
<code class="literal">
Polygon
</code>
,
<code class="literal">
MultiLineString
</code>
,
<code class="literal">
MultiPolygon
</code>
, or
<code class="literal">
GeometryCollection
</code>
, an
<a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_invalid_cast_to_geometry" target="_top">
<code class="literal">
ER_INVALID_CAST_TO_GEOMETRY
</code>
</a>
error occurs.
</p>
</li>
</ul>
</div>
<h4>
<a name="spatial-cast-multipolygon-conditions">
</a>
Conditions for Casts to MultiPolygon
</h4>
<p>
When the cast result type is
<code class="literal">
MultiPolygon
</code>
,
these conditions apply:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
If the expression to cast is a well-formed geometry of type
<code class="literal">
Polygon
</code>
, the function result is a
<code class="literal">
MultiPolygon
</code>
containing the
<code class="literal">
Polygon
</code>
as its sole element.
</p>
</li>
<li class="listitem">
<p>
If the expression to cast is a well-formed geometry of type
<code class="literal">
MultiLineString
</code>
where all elements are
rings, the function result is a
<code class="literal">
MultiPolygon
</code>
containing a
<code class="literal">
Polygon
</code>
with only an outer ring for each
element of the expression. If any element is not a ring, an
<a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_invalid_cast_to_geometry" target="_top">
<code class="literal">
ER_INVALID_CAST_TO_GEOMETRY
</code>
</a>
error occurs. If any ring is not in the correct order
(exterior ring must be counter-clockwise), an
<a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_invalid_cast_polygon_ring_direction" target="_top">
<code class="literal">
ER_INVALID_CAST_POLYGON_RING_DIRECTION
</code>
</a>
error occurs.
</p>
</li>
<li class="listitem">
<p>
If the expression to cast is a well-formed geometry of type
<code class="literal">
MultiPolygon
</code>
, the function result is that
<code class="literal">
MultiPolygon
</code>
.
</p>
</li>
<li class="listitem">
<p>
If the expression to cast is a well-formed geometry of type
<code class="literal">
GeometryCollection
</code>
containing only
polygons, the function result is a
<code class="literal">
MultiPolygon
</code>
containing those polygons.
If the expression is empty or contains other geometry types,
an
<a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_invalid_cast_to_geometry" target="_top">
<code class="literal">
ER_INVALID_CAST_TO_GEOMETRY
</code>
</a>
error occurs.
</p>
</li>
<li class="listitem">
<p>
If the expression to cast is a well-formed geometry of type
other than
<code class="literal">
Polygon
</code>
,
<code class="literal">
MultiLineString
</code>
,
<code class="literal">
MultiPolygon
</code>
, or
<code class="literal">
GeometryCollection
</code>
, an
<a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_invalid_cast_to_geometry" target="_top">
<code class="literal">
ER_INVALID_CAST_TO_GEOMETRY
</code>
</a>
error occurs.
</p>
</li>
</ul>
</div>
<h4>
<a name="spatial-cast-geometrycollection-conditions">
</a>
Conditions for Casts to GeometryCollection
</h4>
<p>
When the cast result type is
<code class="literal">
GeometryCollection
</code>
, these conditions apply:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
GeometryCollection
</code>
and
<code class="literal">
GeomCollection
</code>
are synonyms for the same
result type.
</p>
</li>
<li class="listitem">
<p>
If the expression to cast is a well-formed geometry of type
<code class="literal">
Point
</code>
, the function result is a
<code class="literal">
GeometryCollection
</code>
containing that
<code class="literal">
Point
</code>
as its sole element.
</p>
</li>
<li class="listitem">
<p>
If the expression to cast is a well-formed geometry of type
<code class="literal">
LineString
</code>
, the function result is a
<code class="literal">
GeometryCollection
</code>
containing that
<code class="literal">
LineString
</code>
as its sole element.
</p>
</li>
<li class="listitem">
<p>
If the expression to cast is a well-formed geometry of type
<code class="literal">
Polygon
</code>
, the function result is a
<code class="literal">
GeometryCollection
</code>
containing that
<code class="literal">
Polygon
</code>
as its sole element.
</p>
</li>
<li class="listitem">
<p>
If the expression to cast is a well-formed geometry of type
<code class="literal">
MultiPoint
</code>
, the function result is a
<code class="literal">
GeometryCollection
</code>
containing the points
in the order they appear in the expression.
</p>
</li>
<li class="listitem">
<p>
If the expression to cast is a well-formed geometry of type
<code class="literal">
MultiLineString
</code>
, the function result is a
<code class="literal">
GeometryCollection
</code>
containing the
linestrings in the order they appear in the expression.
</p>
</li>
<li class="listitem">
<p>
If the expression to cast is a well-formed geometry of type
<code class="literal">
MultiPolygon
</code>
, the function result is a
<code class="literal">
GeometryCollection
</code>
containing the
elements of the
<code class="literal">
MultiPolygon
</code>
in the order
they appear in the expression.
</p>
</li>
<li class="listitem">
<p>
If the expression to cast is a well-formed geometry of type
<code class="literal">
GeometryCollection
</code>
, the function result
is that
<code class="literal">
GeometryCollection
</code>
.
</p>
</li>
</ul>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h3 class="title">
<a name="cast-other-uses">
</a>
Other Uses for Cast Operations
</h3>
</div>
</div>
</div>
<p>
The cast functions are useful for creating a column with a
specific type in a
<a class="link" href="create-table.html" title="15.1.20 CREATE TABLE Statement">
<code class="literal">
CREATE TABLE ...
SELECT
</code>
</a>
statement:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa20697684"><div class="copy-help left">Press ⌘+C to 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> new_table <span class="token keyword">SELECT</span> <span class="token function">CAST</span><span class="token punctuation">(</span><span class="token string">'2000-01-01'</span> <span class="token keyword">AS</span> <span class="token datatype">DATE</span><span class="token punctuation">)</span> <span class="token keyword">AS</span> c1<span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">SHOW</span> <span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> new_table\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>
Table<span class="token punctuation">:</span> new_table
Create Table<span class="token punctuation">:</span> CREATE TABLE `new_table` (
`c1` date DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci</span></code></pre>
</div>
<p>
The cast functions are useful for sorting
<a class="link" href="enum.html" title="13.3.5 The ENUM Type">
<code class="literal">
ENUM
</code>
</a>
columns in lexical order.
Normally, sorting of
<a class="link" href="enum.html" title="13.3.5 The ENUM Type">
<code class="literal">
ENUM
</code>
</a>
columns
occurs using the internal numeric values. Casting the values to
<a class="link" href="char.html" title="13.3.2 The CHAR and VARCHAR Types">
<code class="literal">
CHAR
</code>
</a>
results in a lexical sort:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa25170567"><div class="copy-help left">Press ⌘+C to 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> <em class="replaceable">enum_col</em> <span class="token keyword">FROM</span> <em class="replaceable">tbl_name</em>
<span class="token keyword">ORDER</span> <span class="token keyword">BY</span> <span class="token function">CAST</span><span class="token punctuation">(</span><em class="replaceable">enum_col</em> <span class="token keyword">AS</span> <span class="token datatype">CHAR</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
<a class="link" href="cast-functions.html#function_cast">
<code class="literal">
CAST()
</code>
</a>
also changes the result if
you use it as part of a more complex expression such as
<a class="link" href="string-functions.html#function_concat">
<code class="literal">
CONCAT('Date: ',CAST(NOW() AS
DATE))
</code>
</a>
.
</p>
<p>
For temporal values, there is little need to use
<a class="link" href="cast-functions.html#function_cast">
<code class="literal">
CAST()
</code>
</a>
to extract data in
different formats. Instead, use a function such as
<a class="link" href="date-and-time-functions.html#function_extract">
<code class="literal">
EXTRACT()
</code>
</a>
,
<a class="link" href="date-and-time-functions.html#function_date-format">
<code class="literal">
DATE_FORMAT()
</code>
</a>
, or
<a class="link" href="date-and-time-functions.html#function_time-format">
<code class="literal">
TIME_FORMAT()
</code>
</a>
. See
<a class="xref" href="date-and-time-functions.html" title="14.7 Date and Time Functions">
Section 14.7, “Date and Time Functions”
</a>
.
</p>
<p>
To cast a string to a number, it normally suffices to use the
string value in numeric context:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa32638874"><div class="copy-help left">Press ⌘+C to 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 string">'1'</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token number">2</span></code></pre>
</div>
<p>
That is also true for hexadecimal and bit literals, which are
binary strings by default:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa2868749"><div class="copy-help left">Press ⌘+C to 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> X<span class="token string">'41'</span><span class="token punctuation">,</span> X<span class="token string">'41'</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 string">'A'</span><span class="token punctuation">,</span> <span class="token number">65</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> b<span class="token string">'1100001'</span><span class="token punctuation">,</span> b<span class="token string">'1100001'</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 string">'a'</span><span class="token punctuation">,</span> <span class="token number">97</span></code></pre>
</div>
<p>
A string used in an arithmetic operation is converted to a
floating-point number during expression evaluation.
</p>
<p>
A number used in string context is converted to a string:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa71913921"><div class="copy-help left">Press ⌘+C to 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">CONCAT</span><span class="token punctuation">(</span><span class="token string">'hello you '</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 prompt"> -></span> <span class="token string">'hello you 2'</span></code></pre>
</div>
<p>
For information about implicit conversion of numbers to strings,
see
<a class="xref" href="type-conversion.html" title="14.3 Type Conversion in Expression Evaluation">
Section 14.3, “Type Conversion in Expression Evaluation”
</a>
.
</p>
<p>
MySQL supports arithmetic with both signed and unsigned 64-bit
values. For numeric operators (such as
<a class="link" href="arithmetic-functions.html#operator_plus">
<code class="literal">
+
</code>
</a>
or
<a class="link" href="arithmetic-functions.html#operator_minus">
<code class="literal">
-
</code>
</a>
) where one of
the operands is an unsigned integer, the result is unsigned by
default (see
<a class="xref" href="arithmetic-functions.html" title="14.6.1 Arithmetic Operators">
Section 14.6.1, “Arithmetic Operators”
</a>
). To
override this, use the
<code class="literal">
SIGNED
</code>
or
<code class="literal">
UNSIGNED
</code>
cast operator to cast a value to a
signed or unsigned 64-bit integer, respectively.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa34586787"><div class="copy-help left">Press ⌘+C to 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 punctuation">;</span>
<span class="token prompt"> -></span> <span class="token operator">-</span><span class="token number">1</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">1</span> <span class="token operator">-</span> <span class="token number">2</span> <span class="token keyword">AS</span> <span class="token keyword">UNSIGNED</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token number">18446744073709551615</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 function">CAST</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 keyword">AS</span> <span class="token keyword">UNSIGNED</span><span class="token punctuation">)</span> <span class="token keyword">AS</span> <span class="token keyword">SIGNED</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token operator">-</span><span class="token number">1</span></code></pre>
</div>
<p>
If either operand is a floating-point value, the result is a
floating-point value and is not affected by the preceding rule.
(In this context,
<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>
column
values are regarded as floating-point values.)
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa48706015"><div class="copy-help left">Press ⌘+C to 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">CAST</span><span class="token punctuation">(</span><span class="token number">1</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">2.0</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token operator">-</span><span class="token number">1.0</span></code></pre>
</div>
<p>
The SQL mode affects the result of conversion operations (see
<a class="xref" href="sql-mode.html" title="7.1.11 Server SQL Modes">
Section 7.1.11, “Server SQL Modes”
</a>
). Examples:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
For conversion of a
<span class="quote">
“
<span class="quote">
zero
</span>
”
</span>
date string to a
date,
<a class="link" href="cast-functions.html#function_convert">
<code class="literal">
CONVERT()
</code>
</a>
and
<a class="link" href="cast-functions.html#function_cast">
<code class="literal">
CAST()
</code>
</a>
return
<code class="literal">
NULL
</code>
and produce a warning when the
<a class="link" href="sql-mode.html#sqlmode_no_zero_date">
<code class="literal">
NO_ZERO_DATE
</code>
</a>
SQL mode is
enabled.
</p>
</li>
<li class="listitem">
<p>
For integer subtraction, 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 subtraction result is signed even
if any operand is unsigned.
</p>
</li>
</ul>
</div>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/innodb-performance-read_ahead.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="innodb-performance-read_ahead">
</a>
17.8.3.4 Configuring InnoDB Buffer Pool Prefetching (Read-Ahead)
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045163099808">
</a>
<a class="indexterm" name="idm46045163098736">
</a>
<a class="indexterm" name="idm46045163097664">
</a>
<a class="indexterm" name="idm46045163096624">
</a>
<a class="indexterm" name="idm46045163095136">
</a>
<p>
A
<a class="link" href="glossary.html#glos_read_ahead" title="read-ahead">
read-ahead
</a>
request is
an I/O request to prefetch multiple pages in the
<a class="link" href="glossary.html#glos_buffer_pool" title="buffer pool">
buffer pool
</a>
asynchronously, in anticipation of impending need for these
pages. The requests bring in all the pages in one
<a class="link" href="glossary.html#glos_extent" title="extent">
extent
</a>
.
<code class="literal">
InnoDB
</code>
uses two read-ahead algorithms to
improve I/O performance:
</p>
<p>
<span class="strong">
<strong>
Linear
</strong>
</span>
read-ahead is a
technique that predicts what pages might be needed soon based on
pages in the buffer pool being accessed sequentially. You
control when
<code class="literal">
InnoDB
</code>
performs a read-ahead
operation by adjusting the number of sequential page accesses
required to trigger an asynchronous read request, using the
configuration parameter
<a class="link" href="innodb-parameters.html#sysvar_innodb_read_ahead_threshold">
<code class="literal">
innodb_read_ahead_threshold
</code>
</a>
.
Before this parameter was added,
<code class="literal">
InnoDB
</code>
would
only calculate whether to issue an asynchronous prefetch request
for the entire next extent when it read the last page of the
current extent.
</p>
<p>
The configuration parameter
<a class="link" href="innodb-parameters.html#sysvar_innodb_read_ahead_threshold">
<code class="literal">
innodb_read_ahead_threshold
</code>
</a>
controls how sensitive
<code class="literal">
InnoDB
</code>
is in detecting
patterns of sequential page access. If the number of pages read
sequentially from an extent is greater than or equal to
<a class="link" href="innodb-parameters.html#sysvar_innodb_read_ahead_threshold">
<code class="literal">
innodb_read_ahead_threshold
</code>
</a>
,
<code class="literal">
InnoDB
</code>
initiates an asynchronous read-ahead
operation of the entire following extent.
<a class="link" href="innodb-parameters.html#sysvar_innodb_read_ahead_threshold">
<code class="literal">
innodb_read_ahead_threshold
</code>
</a>
can
be set to any value from 0-64. The default value is 56. The
higher the value, the more strict the access pattern check. For
example, if you set the value to 48,
<code class="literal">
InnoDB
</code>
triggers a linear read-ahead request only when 48 pages in the
current extent have been accessed sequentially. If the value is
8,
<code class="literal">
InnoDB
</code>
triggers an asynchronous read-ahead
even if as few as 8 pages in the extent are accessed
sequentially. You can set the value of this parameter in the
MySQL
<a class="link" href="glossary.html#glos_configuration_file" title="configuration file">
configuration
file
</a>
, or change it dynamically with the
<a class="link" href="set-variable.html" title="15.7.6.1 SET Syntax for Variable Assignment">
<code class="literal">
SET
GLOBAL
</code>
</a>
statement, which requires privileges sufficient
to set global 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>
<p>
<span class="strong">
<strong>
Random
</strong>
</span>
read-ahead is a
technique that predicts when pages might be needed soon based on
pages already in the buffer pool, regardless of the order in
which those pages were read. If 13 consecutive pages from the
same extent are found in the buffer pool,
<code class="literal">
InnoDB
</code>
asynchronously issues a request to
prefetch the remaining pages of the extent. To enable this
feature, set the configuration variable
<a class="link" href="innodb-parameters.html#sysvar_innodb_random_read_ahead">
<code class="literal">
innodb_random_read_ahead
</code>
</a>
to
<code class="literal">
ON
</code>
.
</p>
<p>
The
<code class="literal">
SHOW ENGINE INNODB STATUS
</code>
statement
displays statistics to help you evaluate the effectiveness of
the read-ahead algorithm. Statistics include counter information
for the following global status variables:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="link" href="server-status-variables.html#statvar_Innodb_buffer_pool_read_ahead">
<code class="literal">
Innodb_buffer_pool_read_ahead
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="server-status-variables.html#statvar_Innodb_buffer_pool_read_ahead_evicted">
<code class="literal">
Innodb_buffer_pool_read_ahead_evicted
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="server-status-variables.html#statvar_Innodb_buffer_pool_read_ahead_rnd">
<code class="literal">
Innodb_buffer_pool_read_ahead_rnd
</code>
</a>
</p>
</li>
</ul>
</div>
<p>
This information can be useful when fine-tuning the
<a class="link" href="innodb-parameters.html#sysvar_innodb_random_read_ahead">
<code class="literal">
innodb_random_read_ahead
</code>
</a>
setting.
</p>
<p>
For more information about I/O performance, see
<a class="xref" href="optimizing-innodb-diskio.html" title="10.5.8 Optimizing InnoDB Disk I/O">
Section 10.5.8, “Optimizing InnoDB Disk I/O”
</a>
and
<a class="xref" href="disk-issues.html" title="10.12.1 Optimizing Disk I/O">
Section 10.12.1, “Optimizing Disk I/O”
</a>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/apis-ruby-rubymysql.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="apis-ruby-rubymysql">
</a>
31.11.2 The Ruby/MySQL API
</h3>
</div>
</div>
</div>
<p>
The Ruby/MySQL module provides access to MySQL databases using
Ruby through a native driver interface using the MySQL network
protocol.
</p>
<p>
For information on installing the module, and the functions
exposed, see
<a class="ulink" href="http://tmtm.org/en/ruby/mysql/README_en.html" target="_blank">
Ruby/MySQL
</a>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/drop-view.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="drop-view">
</a>
15.1.35 DROP VIEW Statement
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045183225296">
</a>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa60288941"><div class="copy-help left">Press ⌘+C to 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">DROP</span> <span class="token keyword">VIEW</span> <span class="token punctuation">[</span><span class="token keyword">IF</span> <span class="token keyword">EXISTS</span><span class="token punctuation">]</span>
<em class="replaceable">view_name</em> <span class="token punctuation">[</span><span class="token punctuation">,</span> <em class="replaceable">view_name</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 keyword">RESTRICT</span> <span class="token operator">|</span> <span class="token keyword">CASCADE</span><span class="token punctuation">]</span></code></pre>
</div>
<p>
<a class="link" href="drop-view.html" title="15.1.35 DROP VIEW Statement">
<code class="literal">
DROP VIEW
</code>
</a>
removes one or more
views. You must have the
<a class="link" href="privileges-provided.html#priv_drop">
<code class="literal">
DROP
</code>
</a>
privilege for each view.
</p>
<p>
If any views named in the argument list do not exist, the
statement fails with an error indicating by name which nonexisting
views it was unable to drop, and no changes are made.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
In MySQL 8.3 and earlier,
<a class="link" href="drop-view.html" title="15.1.35 DROP VIEW Statement">
<code class="literal">
DROP VIEW
</code>
</a>
returns an error if any
views named in the argument list do not exist, but also drops
all views in the list that do exist. Due to the change in
behavior in MySQL 8.4, a partially completed
<a class="link" href="drop-view.html" title="15.1.35 DROP VIEW Statement">
<code class="literal">
DROP VIEW
</code>
</a>
operation on a MySQL
8.3 replication source server fails when
replicated on a MySQL 8.4 replica. To avoid this
failure scenario, use
<code class="literal">
IF EXISTS
</code>
syntax in
<a class="link" href="drop-view.html" title="15.1.35 DROP VIEW Statement">
<code class="literal">
DROP VIEW
</code>
</a>
statements to prevent
an error from occurring for views that do not exist. 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>
</div>
<p>
The
<code class="literal">
IF EXISTS
</code>
clause prevents an error from
occurring for views that don't exist. When this clause is given, a
<code class="literal">
NOTE
</code>
is generated for each nonexistent view.
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>
.
</p>
<p>
<code class="literal">
RESTRICT
</code>
and
<code class="literal">
CASCADE
</code>
, if
given, are parsed and ignored.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/xml-functions.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title">
<a name="xml-functions">
</a>
14.11 XML Functions
</h2>
</div>
</div>
</div>
<div class="table">
<a name="idm46045200341312">
</a>
<p class="title">
<b>
Table 14.16 XML Functions
</b>
</p>
<div class="table-contents">
<table frame="box" rules="all" summary="A reference that lists XML 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="xml-functions.html#function_extractvalue">
<code class="literal">
ExtractValue()
</code>
</a>
</td>
<td>
Extract a value from an XML string using XPath notation
</td>
</tr>
<tr>
<td>
<a class="link" href="xml-functions.html#function_updatexml">
<code class="literal">
UpdateXML()
</code>
</a>
</td>
<td>
Return replaced XML fragment
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br class="table-break"/>
<p>
This section discusses XML and related functionality in MySQL.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
It is possible to obtain XML-formatted output from MySQL 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>
and
<a class="link" href="mysqldump.html" title="6.5.4 mysqldump — A Database Backup Program">
<span class="command">
<strong>
mysqldump
</strong>
</span>
</a>
clients by invoking them with the
<a class="link" href="mysql-command-options.html#option_mysql_xml">
<code class="option">
--xml
</code>
</a>
option. See
<a class="xref" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
Section 6.5.1, “mysql — The MySQL Command-Line Client”
</a>
, and
<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>
.
</p>
</div>
<p>
Two functions providing basic XPath 1.0 (XML Path Language,
version 1.0) capabilities are available. Some basic information
about XPath syntax and usage is provided later in this section;
however, an in-depth discussion of these topics is beyond the
scope of this manual, and you should refer to the
<a class="ulink" href="http://www.w3.org/TR/xpath" target="_blank">
XML Path Language (XPath)
1.0 standard
</a>
for definitive information. A useful resource
for those new to XPath or who desire a refresher in the basics is
the
<a class="ulink" href="http://www.zvon.org/xxl/XPathTutorial/" target="_blank">
Zvon.org
XPath Tutorial
</a>
, which is available in several languages.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
These functions remain under development. We continue to improve
these and other aspects of XML and XPath functionality in MySQL
8.4 and onwards. You may discuss these, ask
questions about them, and obtain help from other users with them
in the
<a class="ulink" href="https://forums.mysql.com/list.php?44" target="_blank">
MySQL XML User
Forum
</a>
.
</p>
</div>
<p>
XPath expressions used with these functions support user variables
and local stored program variables. User variables are weakly
checked; variables local to stored programs are strongly checked
(see also Bug #26518):
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<b>
User variables (weak checking).
</b>
Variables using the syntax
<code class="literal">
$@
<em class="replaceable">
<code>
variable_name
</code>
</em>
</code>
(that is, user variables) are not checked. No warnings or
errors are issued by the server if a variable has the wrong
type or has previously not been assigned a value. This also
means the user is fully responsible for any typographical
errors, since no warnings are given if (for example)
<code class="literal">
$@myvairable
</code>
is used where
<code class="literal">
$@myvariable
</code>
was intended.
</p>
<p>
Example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa24857705"><div class="copy-help left">Press ⌘+C to 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 variable">@xml</span> <span class="token operator">=</span> <span class="token string">'<a><b>X</b><b>Y</b></a>'</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">SET</span> <span class="token variable">@i</span> <span class="token operator">=</span><span class="token number">1</span><span class="token punctuation">,</span> <span class="token variable">@j</span> <span class="token operator">=</span> <span class="token number">2</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 variable">@i</span><span class="token punctuation">,</span> <span class="token function">ExtractValue</span><span class="token punctuation">(</span><span class="token variable">@xml</span><span class="token punctuation">,</span> <span class="token string">'//b[$@i]'</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>
<span class="token output"><span class="token punctuation">|</span> @i <span class="token punctuation">|</span> ExtractValue(@xml, '//b[$@i]') <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> 1 <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 class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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 variable">@j</span><span class="token punctuation">,</span> <span class="token function">ExtractValue</span><span class="token punctuation">(</span><span class="token variable">@xml</span><span class="token punctuation">,</span> <span class="token string">'//b[$@j]'</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>
<span class="token output"><span class="token punctuation">|</span> @j <span class="token punctuation">|</span> ExtractValue(@xml, '//b[$@j]') <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> 2 <span class="token punctuation">|</span> Y <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">1 row in set (0.00 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token variable">@k</span><span class="token punctuation">,</span> <span class="token function">ExtractValue</span><span class="token punctuation">(</span><span class="token variable">@xml</span><span class="token punctuation">,</span> <span class="token string">'//b[$@k]'</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>
<span class="token output"><span class="token punctuation">|</span> @k <span class="token punctuation">|</span> ExtractValue(@xml, '//b[$@k]') <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> NULL <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>
<span class="token output">1 row in set (0.00 sec)</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
<b>
Variables in stored programs (strong checking).
</b>
Variables using the syntax
<code class="literal">
$
<em class="replaceable">
<code>
variable_name
</code>
</em>
</code>
can be declared and used with these functions when they are
called inside stored programs. Such variables are local to
the stored program in which they are defined, and are
strongly checked for type and value.
</p>
<p>
Example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa61179858"><div class="copy-help left">Press ⌘+C to 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 operator">|</span>
<span class="token prompt">mysql></span> <span class="token keyword">CREATE</span> <span class="token keyword">PROCEDURE</span> myproc <span class="token punctuation">(</span><span class="token punctuation">)</span>
<span class="token prompt"> -></span> <span class="token keyword">BEGIN</span>
<span class="token prompt"> -></span> <span class="token keyword">DECLARE</span> i <span class="token datatype">INT</span> <span class="token keyword">DEFAULT</span> <span class="token number">1</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token keyword">DECLARE</span> <span class="token keyword">xml</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 keyword">DEFAULT</span> <span class="token string">'<a>X</a><a>Y</a><a>Z</a>'</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span>
<span class="token prompt"> -></span> <span class="token keyword">WHILE</span> i <span class="token operator"><</span> <span class="token number">4</span> <span class="token keyword">DO</span>
<span class="token prompt"> -></span> <span class="token keyword">SELECT</span> <span class="token keyword">xml</span><span class="token punctuation">,</span> i<span class="token punctuation">,</span> <span class="token function">ExtractValue</span><span class="token punctuation">(</span><span class="token keyword">xml</span><span class="token punctuation">,</span> <span class="token string">'//a[$i]'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token keyword">SET</span> i <span class="token operator">=</span> i<span class="token operator">+</span><span class="token number">1</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token keyword">END</span> <span class="token keyword">WHILE</span><span class="token punctuation">;</span>
<span class="token prompt"> -></span> <span class="token keyword">END</span> <span class="token operator">|</span>
<span class="token output">Query OK, 0 rows affected (0.01 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">DELIMITER</span> <span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">CALL</span> myproc<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 class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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> xml <span class="token punctuation">|</span> i <span class="token punctuation">|</span> ExtractValue(xml, '//a[$i]') <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>
<span class="token output"><span class="token punctuation">|</span> <a>X</a><a>Y</a><a>Z</a> <span class="token punctuation">|</span> 1 <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 class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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 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>
<span class="token output"><span class="token punctuation">|</span> xml <span class="token punctuation">|</span> i <span class="token punctuation">|</span> ExtractValue(xml, '//a[$i]') <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>
<span class="token output"><span class="token punctuation">|</span> <a>X</a><a>Y</a><a>Z</a> <span class="token punctuation">|</span> 2 <span class="token punctuation">|</span> Y <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>
<span class="token output">1 row in set (0.01 sec)</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>
<span class="token output"><span class="token punctuation">|</span> xml <span class="token punctuation">|</span> i <span class="token punctuation">|</span> ExtractValue(xml, '//a[$i]') <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>
<span class="token output"><span class="token punctuation">|</span> <a>X</a><a>Y</a><a>Z</a> <span class="token punctuation">|</span> 3 <span class="token punctuation">|</span> Z <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>
<span class="token output">1 row in set (0.01 sec)</span></code></pre>
</div>
<p>
<b>
Parameters.
</b>
Variables used in XPath expressions inside stored routines
that are passed in as parameters are also subject to strong
checking.
</p>
</li>
</ul>
</div>
<p>
Expressions containing user variables or variables local to stored
programs must otherwise (except for notation) conform to the rules
for XPath expressions containing variables as given in the XPath
1.0 specification.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
A user variable used to store an XPath expression is treated as
an empty string. Because of this, it is not possible to store an
XPath expression as a user variable. (Bug #32911)
</p>
</div>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<a name="function_extractvalue">
</a>
<p>
<a class="link" href="xml-functions.html#function_extractvalue">
<code class="literal">
ExtractValue(
<em class="replaceable">
<code>
xml_frag
</code>
</em>
,
<em class="replaceable">
<code>
xpath_expr
</code>
</em>
)
</code>
</a>
</p>
<a class="indexterm" name="idm46045200282576">
</a>
<p>
<a class="link" href="xml-functions.html#function_extractvalue">
<code class="literal">
ExtractValue()
</code>
</a>
takes two string
arguments, a fragment of XML markup
<em class="replaceable">
<code>
xml_frag
</code>
</em>
and an XPath expression
<em class="replaceable">
<code>
xpath_expr
</code>
</em>
(also known as a
<span class="firstterm">
locator
</span>
); it returns the
text (
<code class="literal">
CDATA
</code>
) of the first text node which
is a child of the element or elements matched by the XPath
expression.
</p>
<p>
Using this function is the equivalent of performing a match
using the
<em class="replaceable">
<code>
xpath_expr
</code>
</em>
after
appending
<code class="literal">
/text()
</code>
. In other words,
<a class="link" href="xml-functions.html#function_extractvalue">
<code class="literal">
ExtractValue('<a><b>Sakila</b></a>',
'/a/b')
</code>
</a>
and
<a class="link" href="xml-functions.html#function_extractvalue">
<code class="literal">
ExtractValue('<a><b>Sakila</b></a>',
'/a/b/text()')
</code>
</a>
produce the same result. If
<em class="replaceable">
<code>
xml_frag
</code>
</em>
or
<em class="replaceable">
<code>
xpath_expr
</code>
</em>
is
<code class="literal">
NULL
</code>
, the function returns
<code class="literal">
NULL
</code>
.
</p>
<p>
If multiple matches are found, the content of the first child
text node of each matching element is returned (in the order
matched) as a single, space-delimited string.
</p>
<p>
If no matching text node is found for the expression
(including the implicit
<code class="literal">
/text()
</code>
)—for
whatever reason, as long as
<em class="replaceable">
<code>
xpath_expr
</code>
</em>
is valid, and
<em class="replaceable">
<code>
xml_frag
</code>
</em>
consists of elements which
are properly nested and closed—an empty string is
returned. No distinction is made between a match on an empty
element and no match at all. This is by design.
</p>
<p>
If you need to determine whether no matching element was found
in
<em class="replaceable">
<code>
xml_frag
</code>
</em>
or such an element was
found but contained no child text nodes, you should test the
result of an expression that uses the XPath
<code class="literal">
count()
</code>
function. For example, both of
these statements return an empty string, as shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa36161161"><div class="copy-help left">Press ⌘+C to 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">ExtractValue</span><span class="token punctuation">(</span><span class="token string">'<a><b/></a>'</span><span class="token punctuation">,</span> <span class="token string">'/a/b'</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>
<span class="token output"><span class="token punctuation">|</span> ExtractValue('<a><b/></a>', '/a/b') <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>
<span class="token output"><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>
<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">ExtractValue</span><span class="token punctuation">(</span><span class="token string">'<a><c/></a>'</span><span class="token punctuation">,</span> <span class="token string">'/a/b'</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>
<span class="token output"><span class="token punctuation">|</span> ExtractValue('<a><c/></a>', '/a/b') <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>
<span class="token output"><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>
<span class="token output">1 row in set (0.00 sec)</span></code></pre>
</div>
<p>
However, you can determine whether there was actually a
matching element using the following:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa30316801"><div class="copy-help left">Press ⌘+C to 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">ExtractValue</span><span class="token punctuation">(</span><span class="token string">'<a><b/></a>'</span><span class="token punctuation">,</span> <span class="token string">'count(/a/b)'</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>
<span class="token output"><span class="token punctuation">|</span> ExtractValue('<a><b/></a>', 'count(/a/b)') <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>
<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 class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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 function">ExtractValue</span><span class="token punctuation">(</span><span class="token string">'<a><c/></a>'</span><span class="token punctuation">,</span> <span class="token string">'count(/a/b)'</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>
<span class="token output"><span class="token punctuation">|</span> ExtractValue('<a><c/></a>', 'count(/a/b)') <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>
<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><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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></code></pre>
</div>
<div class="important" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Important
</div>
<p>
<a class="link" href="xml-functions.html#function_extractvalue">
<code class="literal">
ExtractValue()
</code>
</a>
returns only
<code class="literal">
CDATA
</code>
, and does not return any tags that
might be contained within a matching tag, nor any of their
content (see the result returned as
<code class="literal">
val1
</code>
in the following example).
</p>
</div>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa68629107"><div class="copy-help left">Press ⌘+C to 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 prompt"> -></span> <span class="token function">ExtractValue</span><span class="token punctuation">(</span><span class="token string">'<a>ccc<b>ddd</b></a>'</span><span class="token punctuation">,</span> <span class="token string">'/a'</span><span class="token punctuation">)</span> <span class="token keyword">AS</span> val1<span class="token punctuation">,</span>
<span class="token prompt"> -></span> <span class="token function">ExtractValue</span><span class="token punctuation">(</span><span class="token string">'<a>ccc<b>ddd</b></a>'</span><span class="token punctuation">,</span> <span class="token string">'/a/b'</span><span class="token punctuation">)</span> <span class="token keyword">AS</span> val2<span class="token punctuation">,</span>
<span class="token prompt"> -></span> <span class="token function">ExtractValue</span><span class="token punctuation">(</span><span class="token string">'<a>ccc<b>ddd</b></a>'</span><span class="token punctuation">,</span> <span class="token string">'//b'</span><span class="token punctuation">)</span> <span class="token keyword">AS</span> val3<span class="token punctuation">,</span>
<span class="token prompt"> -></span> <span class="token function">ExtractValue</span><span class="token punctuation">(</span><span class="token string">'<a>ccc<b>ddd</b></a>'</span><span class="token punctuation">,</span> <span class="token string">'/b'</span><span class="token punctuation">)</span> <span class="token keyword">AS</span> val4<span class="token punctuation">,</span>
<span class="token prompt"> -></span> <span class="token function">ExtractValue</span><span class="token punctuation">(</span><span class="token string">'<a>ccc<b>ddd</b><b>eee</b></a>'</span><span class="token punctuation">,</span> <span class="token string">'//b'</span><span class="token punctuation">)</span> <span class="token keyword">AS</span> val5<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>
<span class="token output"><span class="token punctuation">|</span> val1 <span class="token punctuation">|</span> val2 <span class="token punctuation">|</span> val3 <span class="token punctuation">|</span> val4 <span class="token punctuation">|</span> val5 <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>
<span class="token output"><span class="token punctuation">|</span> ccc <span class="token punctuation">|</span> ddd <span class="token punctuation">|</span> ddd <span class="token punctuation">|</span> <span class="token punctuation">|</span> ddd eee <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></code></pre>
</div>
<p>
This function uses the current SQL collation for making
comparisons with
<code class="literal">
contains()
</code>
, performing the
same collation aggregation as other string functions (such as
<a class="link" href="string-functions.html#function_concat">
<code class="literal">
CONCAT()
</code>
</a>
), in taking into
account the collation coercibility of their arguments; see
<a class="xref" href="charset-collation-coercibility.html" title="12.8.4 Collation Coercibility in Expressions">
Section 12.8.4, “Collation Coercibility in Expressions”
</a>
, for an
explanation of the rules governing this behavior.
</p>
<p>
(Previously, binary—that is,
case-sensitive—comparison was always used.)
</p>
<p>
<code class="literal">
NULL
</code>
is returned if
<em class="replaceable">
<code>
xml_frag
</code>
</em>
contains elements which
are not properly nested or closed, and a warning is generated,
as shown in this example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa91420222"><div class="copy-help left">Press ⌘+C to 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">ExtractValue</span><span class="token punctuation">(</span><span class="token string">'<a>c</a><b'</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 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> ExtractValue('<a>c</a><b', '//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>
<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 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, 1 warning (0.00 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">SHOW</span> <span class="token keyword">WARNINGS</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>
Level<span class="token punctuation">:</span> Warning
Code<span class="token punctuation">:</span> 1525
Message<span class="token punctuation">:</span> Incorrect XML value<span class="token punctuation">:</span> 'parse error at line 1 pos 11<span class="token punctuation">:</span>
END-OF-INPUT unexpected ('>' wanted)'
</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">ExtractValue</span><span class="token punctuation">(</span><span class="token string">'<a>c</a><b/>'</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 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>
<span class="token output"><span class="token punctuation">|</span> ExtractValue('<a>c</a><b/>', '//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>
<span class="token output"><span class="token punctuation">|</span> c <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>
<span class="token output">1 row in set (0.00 sec)</span></code></pre>
</div>
</li>
<li class="listitem">
<a name="function_updatexml">
</a>
<p>
<a class="link" href="xml-functions.html#function_updatexml">
<code class="literal">
UpdateXML(
<em class="replaceable">
<code>
xml_target
</code>
</em>
,
<em class="replaceable">
<code>
xpath_expr
</code>
</em>
,
<em class="replaceable">
<code>
new_xml
</code>
</em>
)
</code>
</a>
</p>
<a class="indexterm" name="idm46045200230304">
</a>
<p>
This function replaces a single portion of a given fragment of
XML markup
<em class="replaceable">
<code>
xml_target
</code>
</em>
with a new
XML fragment
<em class="replaceable">
<code>
new_xml
</code>
</em>
, and then
returns the changed XML. The portion of
<em class="replaceable">
<code>
xml_target
</code>
</em>
that is replaced matches
an XPath expression
<em class="replaceable">
<code>
xpath_expr
</code>
</em>
supplied by the user.
</p>
<p>
If no expression matching
<em class="replaceable">
<code>
xpath_expr
</code>
</em>
is found, or if multiple
matches are found, the function returns the original
<em class="replaceable">
<code>
xml_target
</code>
</em>
XML fragment. All three
arguments should be strings. If any of the arguments to
<code class="literal">
UpdateXML()
</code>
are
<code class="literal">
NULL
</code>
,
the function returns
<code class="literal">
NULL
</code>
.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa28149475"><div class="copy-help left">Press ⌘+C to 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 prompt"> -></span> <span class="token function">UpdateXML</span><span class="token punctuation">(</span><span class="token string">'<a><b>ccc</b><d></d></a>'</span><span class="token punctuation">,</span> <span class="token string">'/a'</span><span class="token punctuation">,</span> <span class="token string">'<e>fff</e>'</span><span class="token punctuation">)</span> <span class="token keyword">AS</span> val1<span class="token punctuation">,</span>
<span class="token prompt"> -></span> <span class="token function">UpdateXML</span><span class="token punctuation">(</span><span class="token string">'<a><b>ccc</b><d></d></a>'</span><span class="token punctuation">,</span> <span class="token string">'/b'</span><span class="token punctuation">,</span> <span class="token string">'<e>fff</e>'</span><span class="token punctuation">)</span> <span class="token keyword">AS</span> val2<span class="token punctuation">,</span>
<span class="token prompt"> -></span> <span class="token function">UpdateXML</span><span class="token punctuation">(</span><span class="token string">'<a><b>ccc</b><d></d></a>'</span><span class="token punctuation">,</span> <span class="token string">'//b'</span><span class="token punctuation">,</span> <span class="token string">'<e>fff</e>'</span><span class="token punctuation">)</span> <span class="token keyword">AS</span> val3<span class="token punctuation">,</span>
<span class="token prompt"> -></span> <span class="token function">UpdateXML</span><span class="token punctuation">(</span><span class="token string">'<a><b>ccc</b><d></d></a>'</span><span class="token punctuation">,</span> <span class="token string">'/a/d'</span><span class="token punctuation">,</span> <span class="token string">'<e>fff</e>'</span><span class="token punctuation">)</span> <span class="token keyword">AS</span> val4<span class="token punctuation">,</span>
<span class="token prompt"> -></span> <span class="token function">UpdateXML</span><span class="token punctuation">(</span><span class="token string">'<a><d></d><b>ccc</b><d></d></a>'</span><span class="token punctuation">,</span> <span class="token string">'/a/d'</span><span class="token punctuation">,</span> <span class="token string">'<e>fff</e>'</span><span class="token punctuation">)</span> <span class="token keyword">AS</span> val5
<span class="token prompt"> -></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>
val1<span class="token punctuation">:</span> <e>fff</e>
val2<span class="token punctuation">:</span> <a><b>ccc</b><d></d></a>
val3<span class="token punctuation">:</span> <a><e>fff</e><d></d></a>
val4<span class="token punctuation">:</span> <a><b>ccc</b><e>fff</e></a>
val5<span class="token punctuation">:</span> <a><d></d><b>ccc</b><d></d></a></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>
A discussion in depth of XPath syntax and usage are beyond the
scope of this manual. Please see the
<a class="ulink" href="http://www.w3.org/TR/xpath" target="_blank">
XML Path Language
(XPath) 1.0 specification
</a>
for definitive information. A
useful resource for those new to XPath or who are wishing a
refresher in the basics is the
<a class="ulink" href="http://www.zvon.org/xxl/XPathTutorial/" target="_blank">
Zvon.org
XPath Tutorial
</a>
, which is available in several languages.
</p>
</div>
<p>
Descriptions and examples of some basic XPath expressions follow:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
/
<em class="replaceable">
<code>
tag
</code>
</em>
</code>
</p>
<p>
Matches
<code class="literal">
<
<em class="replaceable">
<code>
tag
</code>
</em>
/>
</code>
if
and only if
<code class="literal">
<
<em class="replaceable">
<code>
tag
</code>
</em>
/>
</code>
is
the root element.
</p>
<p>
Example:
<code class="literal">
/a
</code>
has a match in
<code class="literal">
<a><b/></a>
</code>
because it
matches the outermost (root) tag. It does not match the inner
<em class="replaceable">
<code>
a
</code>
</em>
element in
<code class="literal">
<b><a/></b>
</code>
because in
this instance it is the child of another element.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
/
<em class="replaceable">
<code>
tag1
</code>
</em>
/
<em class="replaceable">
<code>
tag2
</code>
</em>
</code>
</p>
<p>
Matches
<code class="literal">
<
<em class="replaceable">
<code>
tag2
</code>
</em>
/>
</code>
if
and only if it is a child of
<code class="literal">
<
<em class="replaceable">
<code>
tag1
</code>
</em>
/>
</code>
,
and
<code class="literal">
<
<em class="replaceable">
<code>
tag1
</code>
</em>
/>
</code>
is
the root element.
</p>
<p>
Example:
<code class="literal">
/a/b
</code>
matches the
<em class="replaceable">
<code>
b
</code>
</em>
element in the XML fragment
<code class="literal">
<a><b/></a>
</code>
because it is
a child of the root element
<em class="replaceable">
<code>
a
</code>
</em>
. It
does not have a match in
<code class="literal">
<b><a/></b>
</code>
because in
this case,
<em class="replaceable">
<code>
b
</code>
</em>
is the root element
(and hence the child of no other element). Nor does the XPath
expression have a match in
<code class="literal">
<a><c><b/></c></a>
</code>
;
here,
<em class="replaceable">
<code>
b
</code>
</em>
is a descendant of
<em class="replaceable">
<code>
a
</code>
</em>
, but not actually a child of
<em class="replaceable">
<code>
a
</code>
</em>
.
</p>
<p>
This construct is extendable to three or more elements. For
example, the XPath expression
<code class="literal">
/a/b/c
</code>
matches the
<em class="replaceable">
<code>
c
</code>
</em>
element in the
fragment
<code class="literal">
<a><b><c/></b></a>
</code>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
//
<em class="replaceable">
<code>
tag
</code>
</em>
</code>
</p>
<p>
Matches any instance of
<code class="literal">
<
<em class="replaceable">
<code>
tag
</code>
</em>
>
</code>
.
</p>
<p>
Example:
<code class="literal">
//a
</code>
matches the
<em class="replaceable">
<code>
a
</code>
</em>
element in any of the following:
<code class="literal">
<a><b><c/></b></a>
</code>
;
<code class="literal">
<c><a><b/></a></b>
</code>
;
<code class="literal">
<c><b><a/></b></c>
</code>
.
</p>
<p>
<code class="literal">
//
</code>
can be combined with
<code class="literal">
/
</code>
. For example,
<code class="literal">
//a/b
</code>
matches the
<em class="replaceable">
<code>
b
</code>
</em>
element in either of
the fragments
<code class="literal">
<a><b/></a>
</code>
or
<code class="literal">
<c><a><b/></a></c>
</code>
.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
<code class="literal">
//
<em class="replaceable">
<code>
tag
</code>
</em>
</code>
is the
equivalent of
<code class="literal">
/descendant-or-self::*/
<em class="replaceable">
<code>
tag
</code>
</em>
</code>
.
A common error is to confuse this with
<code class="literal">
/descendant-or-self::
<em class="replaceable">
<code>
tag
</code>
</em>
</code>
,
although the latter expression can actually lead to very
different results, as can be seen here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa31264531"><div class="copy-help left">Press ⌘+C to 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 variable">@xml</span> <span class="token operator">=</span> <span class="token string">'<a><b><c>w</c><b>x</b><d>y</d>z</b></a>'</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 variable">@xml</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>
<span class="token output"><span class="token punctuation">|</span> @xml <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><b><c>w</c><b>x</b><d>y</d>z</b></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>
<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">ExtractValue</span><span class="token punctuation">(</span><span class="token variable">@xml</span><span class="token punctuation">,</span> <span class="token string">'//b[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 class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> ExtractValue(@xml, '//b[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>
<span class="token output"><span class="token punctuation">|</span> x z <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>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">ExtractValue</span><span class="token punctuation">(</span><span class="token variable">@xml</span><span class="token punctuation">,</span> <span class="token string">'//b[2]'</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>
<span class="token output"><span class="token punctuation">|</span> ExtractValue(@xml, '//b[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>
<span class="token output"><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>
<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 function">ExtractValue</span><span class="token punctuation">(</span><span class="token variable">@xml</span><span class="token punctuation">,</span> <span class="token string">'/descendant-or-self::*/b[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 class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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> ExtractValue(@xml, '/descendant<span class="token punctuation">-</span>or<span class="token punctuation">-</span>self::*/b[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>
<span class="token output"><span class="token punctuation">|</span> x z <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.06 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">ExtractValue</span><span class="token punctuation">(</span><span class="token variable">@xml</span><span class="token punctuation">,</span> <span class="token string">'/descendant-or-self::*/b[2]'</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> ExtractValue(@xml, '/descendant<span class="token punctuation">-</span>or<span class="token punctuation">-</span>self::*/b[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>
<span class="token output"><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>
<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">ExtractValue</span><span class="token punctuation">(</span><span class="token variable">@xml</span><span class="token punctuation">,</span> <span class="token string">'/descendant-or-self::b[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 class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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> ExtractValue(@xml, '/descendant<span class="token punctuation">-</span>or<span class="token punctuation">-</span>self::b[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>
<span class="token output"><span class="token punctuation">|</span> z <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>
<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">ExtractValue</span><span class="token punctuation">(</span><span class="token variable">@xml</span><span class="token punctuation">,</span> <span class="token string">'/descendant-or-self::b[2]'</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>
<span class="token output"><span class="token punctuation">|</span> ExtractValue(@xml, '/descendant<span class="token punctuation">-</span>or<span class="token punctuation">-</span>self::b[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>
<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 class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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>
</li>
<li class="listitem">
<p>
The
<code class="literal">
*
</code>
operator acts as a
<span class="quote">
“
<span class="quote">
wildcard
</span>
”
</span>
that matches any element. For example,
the expression
<code class="literal">
/*/b
</code>
matches the
<em class="replaceable">
<code>
b
</code>
</em>
element in either of the XML
fragments
<code class="literal">
<a><b/></a>
</code>
or
<code class="literal">
<c><b/></c>
</code>
. However, the
expression does not produce a match in the fragment
<code class="literal">
<b><a/></b>
</code>
because
<em class="replaceable">
<code>
b
</code>
</em>
must be a child of some other
element. The wildcard may be used in any position: The
expression
<code class="literal">
/*/b/*
</code>
matches any child of a
<em class="replaceable">
<code>
b
</code>
</em>
element that is itself not the
root element.
</p>
</li>
<li class="listitem">
<p>
You can match any of several locators using the
<code class="literal">
|
</code>
(
<a class="link" href="union.html" title="15.2.18 UNION Clause">
<code class="literal">
UNION
</code>
</a>
)
operator. For example, the expression
<code class="literal">
//b|//c
</code>
matches all
<em class="replaceable">
<code>
b
</code>
</em>
and
<em class="replaceable">
<code>
c
</code>
</em>
elements in the XML target.
</p>
</li>
<li class="listitem">
<p>
It is also possible to match an element based on the value of
one or more of its attributes. This done using the syntax
<code class="literal">
<em class="replaceable">
<code>
tag
</code>
</em>
[@
<em class="replaceable">
<code>
attribute
</code>
</em>
="
<em class="replaceable">
<code>
value
</code>
</em>
"]
</code>
.
For example, the expression
<code class="literal">
//b[@id="idB"]
</code>
matches the second
<em class="replaceable">
<code>
b
</code>
</em>
element in the
fragment
<code class="literal">
<a><b id="idA"/><c/><b
id="idB"/></a>
</code>
. To match against
<span class="emphasis">
<em>
any
</em>
</span>
element having
<code class="literal">
<em class="replaceable">
<code>
attribute
</code>
</em>
="
<em class="replaceable">
<code>
value
</code>
</em>
"
</code>
,
use the XPath expression
<code class="literal">
//*[
<em class="replaceable">
<code>
attribute
</code>
</em>
="
<em class="replaceable">
<code>
value
</code>
</em>
"]
</code>
.
</p>
<p>
To filter multiple attribute values, simply use multiple
attribute-comparison clauses in succession. For example, the
expression
<code class="literal">
//b[@c="x"][@d="y"]
</code>
matches the
element
<code class="literal">
<b c="x" d="y"/>
</code>
occurring
anywhere in a given XML fragment.
</p>
<p>
To find elements for which the same attribute matches any of
several values, you can use multiple locators joined by the
<code class="literal">
|
</code>
operator. For example, to match all
<em class="replaceable">
<code>
b
</code>
</em>
elements whose
<em class="replaceable">
<code>
c
</code>
</em>
attributes have either of the
values 23 or 17, use the expression
<code class="literal">
//b[@c="23"]|//b[@c="17"]
</code>
. You can also use
the logical
<code class="literal">
or
</code>
operator for this purpose:
<code class="literal">
//b[@c="23" or @c="17"]
</code>
.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
The difference between
<code class="literal">
or
</code>
and
<code class="literal">
|
</code>
is that
<code class="literal">
or
</code>
joins
conditions, while
<code class="literal">
|
</code>
joins result sets.
</p>
</div>
</li>
</ul>
</div>
<p>
<b>
XPath Limitations.
</b>
The XPath syntax supported by these functions is currently
subject to the following limitations:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Nodeset-to-nodeset comparison (such as
<code class="literal">
'/a/b[@c=@d]'
</code>
) is not supported.
</p>
</li>
<li class="listitem">
<p>
All of the standard XPath comparison operators are supported.
(Bug #22823)
</p>
</li>
<li class="listitem">
<p>
Relative locator expressions are resolved in the context of
the root node. For example, consider the following query and
result:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa95116007"><div class="copy-help left">Press ⌘+C to 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">ExtractValue</span><span class="token punctuation">(</span>
<span class="token prompt"> -></span> <span class="token string">'<a><b c="1">X</b><b c="2">Y</b></a>'</span><span class="token punctuation">,</span>
<span class="token prompt"> -></span> <span class="token string">'a/b'</span>
<span class="token prompt"> -></span> <span class="token punctuation">)</span> <span class="token keyword">AS</span> result<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> result <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> X Y <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">1 row in set (0.03 sec)</span></code></pre>
</div>
<p>
In this case, the locator
<code class="literal">
a/b
</code>
resolves to
<code class="literal">
/a/b
</code>
.
</p>
<p>
Relative locators are also supported within predicates. In the
following example,
<code class="literal">
d[../@c="1"]
</code>
is resolved
as
<code class="literal">
/a/b[@c="1"]/d
</code>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa17366285"><div class="copy-help left">Press ⌘+C to 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">ExtractValue</span><span class="token punctuation">(</span>
<span class="token prompt"> -></span> <span class="token string">'<a>
-> <b c="1"><d>X</d></b>
-> <b c="2"><d>X</d></b>
-> </a>'</span><span class="token punctuation">,</span>
<span class="token prompt"> -></span> <span class="token string">'a/b/d[../@c="1"]'</span><span class="token punctuation">)</span>
<span class="token prompt"> -></span> <span class="token keyword">AS</span> result<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> result <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> 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 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>
Locators prefixed with expressions that evaluate as scalar
values—including variable references, literals, numbers,
and scalar function calls—are not permitted, and their
use results in an error.
</p>
</li>
<li class="listitem">
<p>
The
<code class="literal">
::
</code>
operator is not supported in
combination with node types such as the following:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<code class="literal">
<em class="replaceable">
<code>
axis
</code>
</em>
::comment()
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
<em class="replaceable">
<code>
axis
</code>
</em>
::text()
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
<em class="replaceable">
<code>
axis
</code>
</em>
::processing-instructions()
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
<em class="replaceable">
<code>
axis
</code>
</em>
::node()
</code>
</p>
</li>
</ul>
</div>
<p>
However, name tests (such as
<code class="literal">
<em class="replaceable">
<code>
axis
</code>
</em>
::
<em class="replaceable">
<code>
name
</code>
</em>
</code>
and
<code class="literal">
<em class="replaceable">
<code>
axis
</code>
</em>
::*
</code>
) are
supported, as shown in these examples:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa36578304"><div class="copy-help left">Press ⌘+C to 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">ExtractValue</span><span class="token punctuation">(</span><span class="token string">'<a><b>x</b><c>y</c></a>'</span><span class="token punctuation">,</span><span class="token string">'/a/child::b'</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 class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> ExtractValue('<a><b>x</b><c>y</c></a>','/a/child::b') <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> 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 class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">ExtractValue</span><span class="token punctuation">(</span><span class="token string">'<a><b>x</b><c>y</c></a>'</span><span class="token punctuation">,</span><span class="token string">'/a/child::*'</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 class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> ExtractValue('<a><b>x</b><c>y</c></a>','/a/child::*') <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> x y <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">1 row in set (0.01 sec)</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
<span class="quote">
“
<span class="quote">
Up-and-down
</span>
”
</span>
navigation is not supported in
cases where the path would lead
<span class="quote">
“
<span class="quote">
above
</span>
”
</span>
the root
element. That is, you cannot use expressions which match on
descendants of ancestors of a given element, where one or more
of the ancestors of the current element is also an ancestor of
the root element (see Bug #16321).
</p>
</li>
<li class="listitem">
<p>
The following XPath functions are not supported, or have known
issues as indicated:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<code class="literal">
id()
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
lang()
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
local-name()
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
name()
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
namespace-uri()
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
normalize-space()
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
starts-with()
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
string()
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
substring-after()
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
substring-before()
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
translate()
</code>
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
The following axes are not supported:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<code class="literal">
following-sibling
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
following
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
preceding-sibling
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
preceding
</code>
</p>
</li>
</ul>
</div>
</li>
</ul>
</div>
<p>
XPath expressions passed as arguments to
<a class="link" href="xml-functions.html#function_extractvalue">
<code class="literal">
ExtractValue()
</code>
</a>
and
<a class="link" href="xml-functions.html#function_updatexml">
<code class="literal">
UpdateXML()
</code>
</a>
may contain the colon
character (
<code class="literal">
:
</code>
) in element selectors, which
enables their use with markup employing XML namespaces notation.
For example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa81143472"><div class="copy-help left">Press ⌘+C to 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 variable">@xml</span> <span class="token operator">=</span> <span class="token string">'<a>111<b:c>222<d>333</d><e:f>444</e:f></b:c></a>'</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">ExtractValue</span><span class="token punctuation">(</span><span class="token variable">@xml</span><span class="token punctuation">,</span> <span class="token string">'//e:f'</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>
<span class="token output"><span class="token punctuation">|</span> ExtractValue(@xml, '//e:f') <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> 444 <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">1 row in set (0.00 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">UpdateXML</span><span class="token punctuation">(</span><span class="token variable">@xml</span><span class="token punctuation">,</span> <span class="token string">'//b:c'</span><span class="token punctuation">,</span> <span class="token string">'<g:h>555</g:h>'</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>
<span class="token output"><span class="token punctuation">|</span> UpdateXML(@xml, '//b:c', '<g:h>555</g:h>') <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>
<span class="token output"><span class="token punctuation">|</span> <a>111<g:h>555</g:h></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>
<span class="token output">1 row in set (0.00 sec)</span></code></pre>
</div>
<p>
This is similar in some respects to what is permitted by
<a class="ulink" href="http://xalan.apache.org/" target="_blank">
Apache Xalan
</a>
and
some other parsers, and is much simpler than requiring namespace
declarations or the use of the
<code class="literal">
namespace-uri()
</code>
and
<code class="literal">
local-name()
</code>
functions.
</p>
<p>
<b>
Error handling.
</b>
For both
<a class="link" href="xml-functions.html#function_extractvalue">
<code class="literal">
ExtractValue()
</code>
</a>
and
<a class="link" href="xml-functions.html#function_updatexml">
<code class="literal">
UpdateXML()
</code>
</a>
, the XPath locator
used must be valid and the XML to be searched must consist of
elements which are properly nested and closed. If the locator is
invalid, an error is generated:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa99660915"><div class="copy-help left">Press ⌘+C to 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">ExtractValue</span><span class="token punctuation">(</span><span class="token string">'<a>c</a><b/>'</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 output">ERROR 1105 (HY000)<span class="token punctuation">:</span> XPATH syntax error<span class="token punctuation">:</span> '&a'</span></code></pre>
</div>
<p>
If
<em class="replaceable">
<code>
xml_frag
</code>
</em>
does not consist of
elements which are properly nested and closed,
<code class="literal">
NULL
</code>
is returned and a warning is generated, as
shown in this example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa15578653"><div class="copy-help left">Press ⌘+C to 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">ExtractValue</span><span class="token punctuation">(</span><span class="token string">'<a>c</a><b'</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 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> ExtractValue('<a>c</a><b', '//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>
<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 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, 1 warning (0.00 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">SHOW</span> <span class="token keyword">WARNINGS</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>
Level<span class="token punctuation">:</span> Warning
Code<span class="token punctuation">:</span> 1525
Message<span class="token punctuation">:</span> Incorrect XML value<span class="token punctuation">:</span> 'parse error at line 1 pos 11<span class="token punctuation">:</span>
END-OF-INPUT unexpected ('>' wanted)'
</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">ExtractValue</span><span class="token punctuation">(</span><span class="token string">'<a>c</a><b/>'</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 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>
<span class="token output"><span class="token punctuation">|</span> ExtractValue('<a>c</a><b/>', '//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>
<span class="token output"><span class="token punctuation">|</span> c <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>
<span class="token output">1 row in set (0.00 sec)</span></code></pre>
</div>
<div class="important" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Important
</div>
<p>
The replacement XML used as the third argument to
<a class="link" href="xml-functions.html#function_updatexml">
<code class="literal">
UpdateXML()
</code>
</a>
is
<span class="emphasis">
<em>
not
</em>
</span>
checked to determine whether it
consists solely of elements which are properly nested and
closed.
</p>
</div>
<p>
<b>
XPath Injection.
</b>
<span class="firstterm">
code injection
</span>
occurs when
malicious code is introduced into the system to gain
unauthorized access to privileges and data. It is based on
exploiting assumptions made by developers about the type and
content of data input from users. XPath is no exception in this
regard.
</p>
<a class="indexterm" name="idm46045200043072">
</a>
<a class="indexterm" name="idm46045200042000">
</a>
<a class="indexterm" name="idm46045200040512">
</a>
<p>
A common scenario in which this can happen is the case of
application which handles authorization by matching the
combination of a login name and password with those found in an
XML file, using an XPath expression like this one:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-simple"><div class="docs-select-all right" id="sa3488336"><div class="copy-help left">Press ⌘+C to 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"><span class="token operator">/</span><span class="token operator">/</span>user<span class="token punctuation">[</span>login<span class="token operator">/</span>text<span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator">=</span>'neapolitan' and password<span class="token operator">/</span>text<span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator">=</span>'1c3cr34m'<span class="token punctuation">]</span><span class="token operator">/</span>attribute<span class="token operator">:</span><span class="token operator">:</span>id</code></pre>
</div>
<p>
This is the XPath equivalent of an SQL statement like this one:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa98359190"><div class="copy-help left">Press ⌘+C to 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> id <span class="token keyword">FROM</span> users <span class="token keyword">WHERE</span> login<span class="token operator">=</span><span class="token string">'neapolitan'</span> <span class="token operator">AND</span> <span class="token keyword">password</span><span class="token operator">=</span><span class="token string">'1c3cr34m'</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
A PHP application employing XPath might handle the login process
like this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-php"><div class="docs-select-all right" id="sa48763878"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-php"><span class="token php language-php"><span class="token delimiter important"><?php</span>
<span class="token variable">$file</span> <span class="token operator">=</span> <span class="token string">"users.xml"</span><span class="token punctuation">;</span>
<span class="token variable">$login</span> <span class="token operator">=</span> <span class="token variable">$POST</span><span class="token punctuation">[</span><span class="token string">"login"</span><span class="token punctuation">]</span><span class="token punctuation">;</span>
<span class="token variable">$password</span> <span class="token operator">=</span> <span class="token variable">$POST</span><span class="token punctuation">[</span><span class="token string">"password"</span><span class="token punctuation">]</span><span class="token punctuation">;</span>
<span class="token variable">$xpath</span> <span class="token operator">=</span> <span class="token string">"//user[login/text()=$login and password/text()=$password]/attribute::id"</span><span class="token punctuation">;</span>
<span class="token keyword">if</span><span class="token punctuation">(</span> <span class="token function">file_exists</span><span class="token punctuation">(</span><span class="token variable">$file</span><span class="token punctuation">)</span> <span class="token punctuation">)</span>
<span class="token punctuation">{</span>
<span class="token variable">$xml</span> <span class="token operator">=</span> <span class="token function">simplexml_load_file</span><span class="token punctuation">(</span><span class="token variable">$file</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">if</span><span class="token punctuation">(</span><span class="token variable">$result</span> <span class="token operator">=</span> <span class="token variable">$xml</span><span class="token operator">-</span><span class="token operator">></span><span class="token function">xpath</span><span class="token punctuation">(</span><span class="token variable">$xpath</span><span class="token punctuation">)</span><span class="token punctuation">)</span>
<span class="token keyword">echo</span> <span class="token string">"You are now logged in as user $result[0]."</span><span class="token punctuation">;</span>
<span class="token keyword">else</span>
<span class="token keyword">echo</span> <span class="token string">"Invalid login name or password."</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>
<span class="token keyword">else</span>
<span class="token function">exit</span><span class="token punctuation">(</span><span class="token string">"Failed to open $file."</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token delimiter important">?></span></span></code></pre>
</div>
<p>
No checks are performed on the input. This means that a malevolent
user can
<span class="quote">
“
<span class="quote">
short-circuit
</span>
”
</span>
the test by entering
<code class="literal">
' or 1=1
</code>
for both the login name and password,
resulting in
<code class="varname">
$xpath
</code>
being evaluated as shown
here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-simple"><div class="docs-select-all right" id="sa44796503"><div class="copy-help left">Press ⌘+C to 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"><span class="token operator">/</span><span class="token operator">/</span>user<span class="token punctuation">[</span>login<span class="token operator">/</span>text<span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator">=</span>'' or 1<span class="token operator">=</span>1 and password<span class="token operator">/</span>text<span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator">=</span>'' or 1<span class="token operator">=</span>1<span class="token punctuation">]</span><span class="token operator">/</span>attribute<span class="token operator">:</span><span class="token operator">:</span>id</code></pre>
</div>
<p>
Since the expression inside the square brackets always evaluates
as
<code class="literal">
true
</code>
, it is effectively the same as this
one, which matches the
<code class="literal">
id
</code>
attribute of every
<code class="literal">
user
</code>
element in the XML document:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-simple"><div class="docs-select-all right" id="sa3007568"><div class="copy-help left">Press ⌘+C to 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"><span class="token operator">/</span><span class="token operator">/</span>user<span class="token operator">/</span>attribute<span class="token operator">:</span><span class="token operator">:</span>id</code></pre>
</div>
<p>
One way in which this particular attack can be circumvented is
simply by quoting the variable names to be interpolated in the
definition of
<code class="literal">
$xpath
</code>
, forcing the values passed
from a Web form to be converted to strings:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-simple"><div class="docs-select-all right" id="sa15491836"><div class="copy-help left">Press ⌘+C to 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">$xpath <span class="token operator">=</span> "<span class="token operator">/</span><span class="token operator">/</span>user<span class="token punctuation">[</span>login<span class="token operator">/</span>text<span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator">=</span>'$login' and password<span class="token operator">/</span>text<span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator">=</span>'$password'<span class="token punctuation">]</span><span class="token operator">/</span>attribute<span class="token operator">:</span><span class="token operator">:</span>id"<span class="token punctuation">;</span></code></pre>
</div>
<p>
This is the same strategy that is often recommended for preventing
SQL injection attacks. In general, the practices you should follow
for preventing XPath injection attacks are the same as for
preventing SQL injection:
</p>
<a class="indexterm" name="idm46045200023984">
</a>
<a class="indexterm" name="idm46045200022912">
</a>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Never accepted untested data from users in your application.
</p>
</li>
<li class="listitem">
<p>
Check all user-submitted data for type; reject or convert data
that is of the wrong type
</p>
</li>
<li class="listitem">
<p>
Test numeric data for out of range values; truncate, round, or
reject values that are out of range. Test strings for illegal
characters and either strip them out or reject input
containing them.
</p>
</li>
<li class="listitem">
<p>
Do not output explicit error messages that might provide an
unauthorized user with clues that could be used to compromise
the system; log these to a file or database table instead.
</p>
</li>
</ul>
</div>
<p>
Just as SQL injection attacks can be used to obtain information
about database schemas, so can XPath injection be used to traverse
XML files to uncover their structure, as discussed in Amit
Klein's paper
<a class="ulink" href="http://www.packetstormsecurity.org/papers/bypass/Blind_XPath_Injection_20040518.pdf" target="_blank">
Blind
XPath Injection
</a>
(PDF file, 46KB).
</p>
<p>
It is also important to check the output being sent back to the
client. Consider what can happen when we use the MySQL
<a class="link" href="xml-functions.html#function_extractvalue">
<code class="literal">
ExtractValue()
</code>
</a>
function:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa50557669"><div class="copy-help left">Press ⌘+C to 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">ExtractValue</span><span class="token punctuation">(</span>
<span class="token prompt"> -></span> <span class="token function">LOAD_FILE</span><span class="token punctuation">(</span><span class="token string">'users.xml'</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token prompt"> -></span> <span class="token string">'//user[login/text()="" or 1=1 and password/text()="" or 1=1]/attribute::id'</span>
<span class="token prompt"> -></span> <span class="token punctuation">)</span> <span class="token keyword">AS</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 class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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 class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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> 00327 13579 02403 42354 28570 <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">1 row in set (0.01 sec)</span></code></pre>
</div>
<p>
Because
<a class="link" href="xml-functions.html#function_extractvalue">
<code class="literal">
ExtractValue()
</code>
</a>
returns
multiple matches as a single space-delimited string, this
injection attack provides every valid ID contained within
<code class="filename">
users.xml
</code>
to the user as a single row of
output. As an extra safeguard, you should also test output before
returning it to the user. Here is a simple example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa99825596"><div class="copy-help left">Press ⌘+C to 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 variable">@id</span> <span class="token operator">=</span> <span class="token function">ExtractValue</span><span class="token punctuation">(</span>
<span class="token prompt"> -></span> <span class="token function">LOAD_FILE</span><span class="token punctuation">(</span><span class="token string">'users.xml'</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token prompt"> -></span> <span class="token string">'//user[login/text()="" or 1=1 and password/text()="" or 1=1]/attribute::id'</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.00 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">IF</span><span class="token punctuation">(</span>
<span class="token prompt"> -></span> <span class="token function">INSTR</span><span class="token punctuation">(</span><span class="token variable">@id</span><span class="token punctuation">,</span> <span class="token string">' '</span><span class="token punctuation">)</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 variable">@id</span><span class="token punctuation">,</span>
<span class="token prompt"> -></span> <span class="token string">'Unable to retrieve user ID'</span><span class="token punctuation">)</span>
<span class="token prompt"> -></span> <span class="token keyword">AS</span> singleID<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> singleID <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> Unable to retrieve user 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 class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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 general, the guidelines for returning data to users securely
are the same as for accepting user input. These can be summed up
as:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Always test outgoing data for type and permissible values.
</p>
</li>
<li class="listitem">
<p>
Never permit unauthorized users to view error messages that
might provide information about the application that could be
used to exploit it.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/differences-from-ansi.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="differences-from-ansi">
</a>
1.7.2 MySQL Differences from Standard SQL
</h3>
</div>
</div>
</div>
<div class="toc">
<dl class="toc">
<dt>
<span class="section">
<a href="ansi-diff-select-into-table.html">
1.7.2.1 SELECT INTO TABLE Differences
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ansi-diff-update.html">
1.7.2.2 UPDATE Differences
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ansi-diff-foreign-keys.html">
1.7.2.3 FOREIGN KEY Constraint Differences
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ansi-diff-comments.html">
1.7.2.4 '--' as the Start of a Comment
</a>
</span>
</dt>
</dl>
</div>
<a class="indexterm" name="idm46045333288048">
</a>
<p>
We try to make MySQL Server follow the ANSI SQL standard and the
ODBC SQL standard, but MySQL Server performs operations
differently in some cases:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
There are several differences between the MySQL and standard
SQL privilege systems. For example, in MySQL, privileges for
a table are not automatically revoked when you delete a
table. You must explicitly issue a
<a class="link" href="revoke.html" title="15.7.1.8 REVOKE Statement">
<code class="literal">
REVOKE
</code>
</a>
statement to revoke
privileges for a table. For more information, see
<a class="xref" href="revoke.html" title="15.7.1.8 REVOKE Statement">
Section 15.7.1.8, “REVOKE Statement”
</a>
.
</p>
</li>
<li class="listitem">
<p>
The
<a class="link" href="cast-functions.html#function_cast">
<code class="literal">
CAST()
</code>
</a>
function does not
support cast to
<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>
or
<a class="link" href="integer-types.html" title="13.1.2 Integer Types (Exact Value) - INTEGER, INT, SMALLINT, TINYINT, MEDIUMINT, BIGINT">
<code class="literal">
BIGINT
</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>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/innodb-information-schema-examples-compression-sect.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="innodb-information-schema-examples-compression-sect">
</a>
17.15.1.3 Using the Compression Information Schema Tables
</h4>
</div>
</div>
</div>
<div class="example">
<a name="innodb-information-schema-examples-compression">
</a>
<p class="title">
<b>
Example 17.1 Using the Compression Information Schema Tables
</b>
</p>
<div class="example-contents">
<p>
The following is sample output from a database that contains
compressed tables (see
<a class="xref" href="innodb-compression.html" title="17.9 InnoDB Table and Page Compression">
Section 17.9, “InnoDB Table and Page Compression”
</a>
,
<a class="link" href="information-schema-innodb-cmp-table.html" title="28.4.6 The INFORMATION_SCHEMA INNODB_CMP and INNODB_CMP_RESET Tables">
<code class="literal">
INNODB_CMP
</code>
</a>
,
<a class="link" href="information-schema-innodb-cmp-per-index-table.html" title="28.4.8 The INFORMATION_SCHEMA INNODB_CMP_PER_INDEX and INNODB_CMP_PER_INDEX_RESET Tables">
<code class="literal">
INNODB_CMP_PER_INDEX
</code>
</a>
, and
<a class="link" href="information-schema-innodb-cmpmem-table.html" title="28.4.7 The INFORMATION_SCHEMA INNODB_CMPMEM and INNODB_CMPMEM_RESET Tables">
<code class="literal">
INNODB_CMPMEM
</code>
</a>
).
</p>
<p>
The following table shows the contents of
<a class="link" href="information-schema-innodb-cmp-table.html" title="28.4.6 The INFORMATION_SCHEMA INNODB_CMP and INNODB_CMP_RESET Tables">
<code class="literal">
INFORMATION_SCHEMA.INNODB_CMP
</code>
</a>
under a light
<a class="link" href="glossary.html#glos_workload" title="workload">
workload
</a>
.
The only compressed page size that the buffer pool contains is
8K. Compressing or uncompressing pages has consumed less than
a second since the time the statistics were reset, because the
columns
<code class="literal">
COMPRESS_TIME
</code>
and
<code class="literal">
UNCOMPRESS_TIME
</code>
are zero.
</p>
<div class="informaltable">
<a name="innodb-information-schema-sample-innodb_cmp">
</a>
<table summary="Sample data from the INFORMATION_SCHEMA.INNODB_CMP table, showing the internal workings of InnoDB table compression under a light workload.">
<colgroup>
<col style="width: 15%"/>
<col style="width: 15%"/>
<col style="width: 15%"/>
<col style="width: 15%"/>
<col style="width: 20%"/>
<col style="width: 20%"/>
</colgroup>
<thead>
<tr>
<th scope="col">
page size
</th>
<th scope="col">
compress ops
</th>
<th scope="col">
compress ops ok
</th>
<th scope="col">
compress time
</th>
<th scope="col">
uncompress ops
</th>
<th scope="col">
uncompress time
</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">
1024
</th>
<td>
0
</td>
<td>
0
</td>
<td>
0
</td>
<td>
0
</td>
<td>
0
</td>
</tr>
<tr>
<th scope="row">
2048
</th>
<td>
0
</td>
<td>
0
</td>
<td>
0
</td>
<td>
0
</td>
<td>
0
</td>
</tr>
<tr>
<th scope="row">
4096
</th>
<td>
0
</td>
<td>
0
</td>
<td>
0
</td>
<td>
0
</td>
<td>
0
</td>
</tr>
<tr>
<th scope="row">
8192
</th>
<td>
1048
</td>
<td>
921
</td>
<td>
0
</td>
<td>
61
</td>
<td>
0
</td>
</tr>
<tr>
<th scope="row">
16384
</th>
<td>
0
</td>
<td>
0
</td>
<td>
0
</td>
<td>
0
</td>
<td>
0
</td>
</tr>
</tbody>
</table>
</div>
<p>
According to
<a class="link" href="information-schema-innodb-cmpmem-table.html" title="28.4.7 The INFORMATION_SCHEMA INNODB_CMPMEM and INNODB_CMPMEM_RESET Tables">
<code class="literal">
INNODB_CMPMEM
</code>
</a>
, there
are 6169 compressed 8KB pages in the
<a class="link" href="glossary.html#glos_buffer_pool" title="buffer pool">
buffer pool
</a>
. The only
other allocated block size is 64 bytes. The smallest
<code class="literal">
PAGE_SIZE
</code>
in
<a class="link" href="information-schema-innodb-cmpmem-table.html" title="28.4.7 The INFORMATION_SCHEMA INNODB_CMPMEM and INNODB_CMPMEM_RESET Tables">
<code class="literal">
INNODB_CMPMEM
</code>
</a>
is used for block
descriptors of those compressed pages for which no
uncompressed page exists in the buffer pool. We see that there
are 5910 such pages. Indirectly, we see that 259 (6169-5910)
compressed pages also exist in the buffer pool in uncompressed
form.
</p>
<p>
The following table shows the contents of
<a class="link" href="information-schema-innodb-cmpmem-table.html" title="28.4.7 The INFORMATION_SCHEMA INNODB_CMPMEM and INNODB_CMPMEM_RESET Tables">
<code class="literal">
INFORMATION_SCHEMA.INNODB_CMPMEM
</code>
</a>
under a light
<a class="link" href="glossary.html#glos_workload" title="workload">
workload
</a>
.
Some memory is unusable due to fragmentation of the memory
allocator for compressed pages:
<code class="literal">
SUM(PAGE_SIZE*PAGES_FREE)=6784
</code>
. This is
because small memory allocation requests are fulfilled by
splitting bigger blocks, starting from the 16K blocks that are
allocated from the main buffer pool, using the buddy
allocation system. The fragmentation is this low because some
allocated blocks have been relocated (copied) to form bigger
adjacent free blocks. This copying of
<code class="literal">
SUM(PAGE_SIZE*RELOCATION_OPS)
</code>
bytes has
consumed less than a second
<code class="literal">
(SUM(RELOCATION_TIME)=0)
</code>
.
</p>
<div class="informaltable">
<a name="innodb-information-schema-sample-innodb_cmpmem">
</a>
<table summary="Sample data from the INFORMATION_SCHEMA.INNODB_CMPMEM table, showing buffer pool memory operations for InnoDB table compression under a light workload.">
<colgroup>
<col style="width: 15%"/>
<col style="width: 15%"/>
<col style="width: 20%"/>
<col style="width: 20%"/>
<col style="width: 20%"/>
</colgroup>
<thead>
<tr>
<th scope="col">
page size
</th>
<th scope="col">
pages used
</th>
<th scope="col">
pages free
</th>
<th scope="col">
relocation ops
</th>
<th scope="col">
relocation time
</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">
64
</th>
<td>
5910
</td>
<td>
0
</td>
<td>
2436
</td>
<td>
0
</td>
</tr>
<tr>
<th scope="row">
128
</th>
<td>
0
</td>
<td>
1
</td>
<td>
0
</td>
<td>
0
</td>
</tr>
<tr>
<th scope="row">
256
</th>
<td>
0
</td>
<td>
0
</td>
<td>
0
</td>
<td>
0
</td>
</tr>
<tr>
<th scope="row">
512
</th>
<td>
0
</td>
<td>
1
</td>
<td>
0
</td>
<td>
0
</td>
</tr>
<tr>
<th scope="row">
1024
</th>
<td>
0
</td>
<td>
0
</td>
<td>
0
</td>
<td>
0
</td>
</tr>
<tr>
<th scope="row">
2048
</th>
<td>
0
</td>
<td>
1
</td>
<td>
0
</td>
<td>
0
</td>
</tr>
<tr>
<th scope="row">
4096
</th>
<td>
0
</td>
<td>
1
</td>
<td>
0
</td>
<td>
0
</td>
</tr>
<tr>
<th scope="row">
8192
</th>
<td>
6169
</td>
<td>
0
</td>
<td>
5
</td>
<td>
0
</td>
</tr>
<tr>
<th scope="row">
16384
</th>
<td>
0
</td>
<td>
0
</td>
<td>
0
</td>
<td>
0
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<br class="example-break"/>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/built-in-function-reference.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title">
<a name="built-in-function-reference">
</a>
14.1 Built-In Function and Operator Reference
</h2>
</div>
</div>
</div>
<a class="indexterm" name="idm46045210262640">
</a>
<a class="indexterm" name="idm46045210261152">
</a>
<a class="indexterm" name="idm46045210259664">
</a>
<a class="indexterm" name="idm46045210258176">
</a>
<p>
The following table lists each built-in (native) function and
operator and provides a short description of each one. For a table
listing functions that are loadable at runtime, see
<a class="xref" href="loadable-function-reference.html" title="14.2 Loadable Function Reference">
Section 14.2, “Loadable Function Reference”
</a>
.
</p>
<div class="table">
<a name="idm46045210255376">
</a>
<p class="title">
<b>
Table 14.1 Built-In Functions and Operators
</b>
</p>
<div class="table-contents">
<table frame="box" rules="all" summary="A reference that lists all built-in functions and operators.">
<colgroup>
<col style="width: 25%"/>
<col style="width: 62%"/>
<col style="width: 12%"/>
</colgroup>
<thead>
<tr>
<th>
Name
</th>
<th>
Description
</th>
<th>
Deprecated
</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">
<a class="link" href="bit-functions.html#operator_bitwise-and">
<code class="literal">
&
</code>
</a>
</th>
<td>
Bitwise AND
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="comparison-operators.html#operator_greater-than">
<code class="literal">
>
</code>
</a>
</th>
<td>
Greater than operator
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="bit-functions.html#operator_right-shift">
<code class="literal">
>>
</code>
</a>
</th>
<td>
Right shift
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="comparison-operators.html#operator_greater-than-or-equal">
<code class="literal">
>=
</code>
</a>
</th>
<td>
Greater than or equal operator
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="comparison-operators.html#operator_less-than">
<code class="literal">
<
</code>
</a>
</th>
<td>
Less than operator
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="comparison-operators.html#operator_not-equal">
<code class="literal">
<>
</code>
,
<code class="literal">
!=
</code>
</a>
</th>
<td>
Not equal operator
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="bit-functions.html#operator_left-shift">
<code class="literal">
<<
</code>
</a>
</th>
<td>
Left shift
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="comparison-operators.html#operator_less-than-or-equal">
<code class="literal">
<=
</code>
</a>
</th>
<td>
Less than or equal operator
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="comparison-operators.html#operator_equal-to">
<code class="literal">
<=>
</code>
</a>
</th>
<td>
NULL-safe equal to operator
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="arithmetic-functions.html#operator_mod">
<code class="literal">
%
</code>
,
<code class="literal">
MOD
</code>
</a>
</th>
<td>
Modulo operator
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="arithmetic-functions.html#operator_times">
<code class="literal">
*
</code>
</a>
</th>
<td>
Multiplication operator
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="arithmetic-functions.html#operator_plus">
<code class="literal">
+
</code>
</a>
</th>
<td>
Addition operator
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="arithmetic-functions.html#operator_minus">
<code class="literal">
-
</code>
</a>
</th>
<td>
Minus operator
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="arithmetic-functions.html#operator_unary-minus">
<code class="literal">
-
</code>
</a>
</th>
<td>
Change the sign of the argument
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="json-search-functions.html#operator_json-column-path">
<code class="literal">
->
</code>
</a>
</th>
<td>
Return value from JSON column after evaluating path; equivalent to
JSON_EXTRACT().
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="json-search-functions.html#operator_json-inline-path">
<code class="literal">
->>
</code>
</a>
</th>
<td>
Return value from JSON column after evaluating path and unquoting
the result; equivalent to JSON_UNQUOTE(JSON_EXTRACT()).
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="arithmetic-functions.html#operator_divide">
<code class="literal">
/
</code>
</a>
</th>
<td>
Division operator
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="assignment-operators.html#operator_assign-value">
<code class="literal">
:=
</code>
</a>
</th>
<td>
Assign a value
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="assignment-operators.html#operator_assign-equal">
<code class="literal">
=
</code>
</a>
</th>
<td>
Assign a value (as part of 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, or as part of the
<code class="literal">
SET
</code>
clause in an
<a class="link" href="update.html" title="15.2.17 UPDATE Statement">
<code class="literal">
UPDATE
</code>
</a>
statement)
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="comparison-operators.html#operator_equal">
<code class="literal">
=
</code>
</a>
</th>
<td>
Equal operator
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="bit-functions.html#operator_bitwise-xor">
<code class="literal">
^
</code>
</a>
</th>
<td>
Bitwise XOR
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="mathematical-functions.html#function_abs">
<code class="literal">
ABS()
</code>
</a>
</th>
<td>
Return the absolute value
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="mathematical-functions.html#function_acos">
<code class="literal">
ACOS()
</code>
</a>
</th>
<td>
Return the arc cosine
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="date-and-time-functions.html#function_adddate">
<code class="literal">
ADDDATE()
</code>
</a>
</th>
<td>
Add time values (intervals) to a date value
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="date-and-time-functions.html#function_addtime">
<code class="literal">
ADDTIME()
</code>
</a>
</th>
<td>
Add time
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="encryption-functions.html#function_aes-decrypt">
<code class="literal">
AES_DECRYPT()
</code>
</a>
</th>
<td>
Decrypt using AES
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="encryption-functions.html#function_aes-encrypt">
<code class="literal">
AES_ENCRYPT()
</code>
</a>
</th>
<td>
Encrypt using AES
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="logical-operators.html#operator_and">
<code class="literal">
AND
</code>
,
<code class="literal">
&&
</code>
</a>
</th>
<td>
Logical AND
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="miscellaneous-functions.html#function_any-value">
<code class="literal">
ANY_VALUE()
</code>
</a>
</th>
<td>
Suppress ONLY_FULL_GROUP_BY value rejection
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="string-functions.html#function_ascii">
<code class="literal">
ASCII()
</code>
</a>
</th>
<td>
Return numeric value of left-most character
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="mathematical-functions.html#function_asin">
<code class="literal">
ASIN()
</code>
</a>
</th>
<td>
Return the arc sine
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="replication-functions-async-failover.html#function_asynchronous-connection-failover-add-managed">
<code class="literal">
asynchronous_connection_failover_add_managed()
</code>
</a>
</th>
<td>
Add group member source server configuration information to a
replication channel source list
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="replication-functions-async-failover.html#function_asynchronous-connection-failover-add-source">
<code class="literal">
asynchronous_connection_failover_add_source()
</code>
</a>
</th>
<td>
Add source server configuration information server to a
replication channel source list
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="replication-functions-async-failover.html#function_asynchronous-connection-failover-delete-managed">
<code class="literal">
asynchronous_connection_failover_delete_managed()
</code>
</a>
</th>
<td>
Remove a managed group from a replication channel source list
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="replication-functions-async-failover.html#function_asynchronous-connection-failover-delete-source">
<code class="literal">
asynchronous_connection_failover_delete_source()
</code>
</a>
</th>
<td>
Remove a source server from a replication channel source list
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="replication-functions-async-failover.html#function_asynchronous-connection-failover-reset">
<code class="literal">
asynchronous_connection_failover_reset()
</code>
</a>
</th>
<td>
Remove all settings relating to group replication asynchronous
failover
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="mathematical-functions.html#function_atan">
<code class="literal">
ATAN()
</code>
</a>
</th>
<td>
Return the arc tangent
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="mathematical-functions.html#function_atan2">
<code class="literal">
ATAN2()
</code>
,
<code class="literal">
ATAN()
</code>
</a>
</th>
<td>
Return the arc tangent of the two arguments
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="aggregate-functions.html#function_avg">
<code class="literal">
AVG()
</code>
</a>
</th>
<td>
Return the average value of the argument
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="information-functions.html#function_benchmark">
<code class="literal">
BENCHMARK()
</code>
</a>
</th>
<td>
Repeatedly execute an expression
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="comparison-operators.html#operator_between">
<code class="literal">
BETWEEN ... AND ...
</code>
</a>
</th>
<td>
Whether a value is within a range of values
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="string-functions.html#function_bin">
<code class="literal">
BIN()
</code>
</a>
</th>
<td>
Return a string containing binary representation of a number
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="miscellaneous-functions.html#function_bin-to-uuid">
<code class="literal">
BIN_TO_UUID()
</code>
</a>
</th>
<td>
Convert binary UUID to string
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="cast-functions.html#operator_binary">
<code class="literal">
BINARY
</code>
</a>
</th>
<td>
Cast a string to a binary string
</td>
<td>
Yes
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="aggregate-functions.html#function_bit-and">
<code class="literal">
BIT_AND()
</code>
</a>
</th>
<td>
Return bitwise AND
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="bit-functions.html#function_bit-count">
<code class="literal">
BIT_COUNT()
</code>
</a>
</th>
<td>
Return the number of bits that are set
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="string-functions.html#function_bit-length">
<code class="literal">
BIT_LENGTH()
</code>
</a>
</th>
<td>
Return length of argument in bits
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="aggregate-functions.html#function_bit-or">
<code class="literal">
BIT_OR()
</code>
</a>
</th>
<td>
Return bitwise OR
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="aggregate-functions.html#function_bit-xor">
<code class="literal">
BIT_XOR()
</code>
</a>
</th>
<td>
Return bitwise XOR
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="internal-functions.html#function_can-access-column">
<code class="literal">
CAN_ACCESS_COLUMN()
</code>
</a>
</th>
<td>
Internal use only
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="internal-functions.html#function_can-access-database">
<code class="literal">
CAN_ACCESS_DATABASE()
</code>
</a>
</th>
<td>
Internal use only
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="internal-functions.html#function_can-access-table">
<code class="literal">
CAN_ACCESS_TABLE()
</code>
</a>
</th>
<td>
Internal use only
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="internal-functions.html#function_can-access-user">
<code class="literal">
CAN_ACCESS_USER()
</code>
</a>
</th>
<td>
Internal use only
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="internal-functions.html#function_can-access-view">
<code class="literal">
CAN_ACCESS_VIEW()
</code>
</a>
</th>
<td>
Internal use only
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="flow-control-functions.html#operator_case">
<code class="literal">
CASE
</code>
</a>
</th>
<td>
Case operator
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="cast-functions.html#function_cast">
<code class="literal">
CAST()
</code>
</a>
</th>
<td>
Cast a value as a certain type
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="mathematical-functions.html#function_ceil">
<code class="literal">
CEIL()
</code>
</a>
</th>
<td>
Return the smallest integer value not less than the argument
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="mathematical-functions.html#function_ceiling">
<code class="literal">
CEILING()
</code>
</a>
</th>
<td>
Return the smallest integer value not less than the argument
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="string-functions.html#function_char">
<code class="literal">
CHAR()
</code>
</a>
</th>
<td>
Return the character for each integer passed
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="string-functions.html#function_char-length">
<code class="literal">
CHAR_LENGTH()
</code>
</a>
</th>
<td>
Return number of characters in argument
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="string-functions.html#function_character-length">
<code class="literal">
CHARACTER_LENGTH()
</code>
</a>
</th>
<td>
Synonym for CHAR_LENGTH()
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="information-functions.html#function_charset">
<code class="literal">
CHARSET()
</code>
</a>
</th>
<td>
Return the character set of the argument
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="comparison-operators.html#function_coalesce">
<code class="literal">
COALESCE()
</code>
</a>
</th>
<td>
Return the first non-NULL argument
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="information-functions.html#function_coercibility">
<code class="literal">
COERCIBILITY()
</code>
</a>
</th>
<td>
Return the collation coercibility value of the string argument
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="information-functions.html#function_collation">
<code class="literal">
COLLATION()
</code>
</a>
</th>
<td>
Return the collation of the string argument
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="encryption-functions.html#function_compress">
<code class="literal">
COMPRESS()
</code>
</a>
</th>
<td>
Return result as a binary string
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="string-functions.html#function_concat">
<code class="literal">
CONCAT()
</code>
</a>
</th>
<td>
Return concatenated string
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="string-functions.html#function_concat-ws">
<code class="literal">
CONCAT_WS()
</code>
</a>
</th>
<td>
Return concatenate with separator
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="information-functions.html#function_connection-id">
<code class="literal">
CONNECTION_ID()
</code>
</a>
</th>
<td>
Return the connection ID (thread ID) for the connection
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="mathematical-functions.html#function_conv">
<code class="literal">
CONV()
</code>
</a>
</th>
<td>
Convert numbers between different number bases
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="cast-functions.html#function_convert">
<code class="literal">
CONVERT()
</code>
</a>
</th>
<td>
Cast a value as a certain type
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="date-and-time-functions.html#function_convert-tz">
<code class="literal">
CONVERT_TZ()
</code>
</a>
</th>
<td>
Convert from one time zone to another
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="mathematical-functions.html#function_cos">
<code class="literal">
COS()
</code>
</a>
</th>
<td>
Return the cosine
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="mathematical-functions.html#function_cot">
<code class="literal">
COT()
</code>
</a>
</th>
<td>
Return the cotangent
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="aggregate-functions.html#function_count">
<code class="literal">
COUNT()
</code>
</a>
</th>
<td>
Return a count of the number of rows returned
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="aggregate-functions.html#function_count-distinct">
<code class="literal">
COUNT(DISTINCT)
</code>
</a>
</th>
<td>
Return the count of a number of different values
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="mathematical-functions.html#function_crc32">
<code class="literal">
CRC32()
</code>
</a>
</th>
<td>
Compute a cyclic redundancy check value
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="window-function-descriptions.html#function_cume-dist">
<code class="literal">
CUME_DIST()
</code>
</a>
</th>
<td>
Cumulative distribution value
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="date-and-time-functions.html#function_curdate">
<code class="literal">
CURDATE()
</code>
</a>
</th>
<td>
Return the current date
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="date-and-time-functions.html#function_current-date">
<code class="literal">
CURRENT_DATE()
</code>
,
<code class="literal">
CURRENT_DATE
</code>
</a>
</th>
<td>
Synonyms for CURDATE()
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="information-functions.html#function_current-role">
<code class="literal">
CURRENT_ROLE()
</code>
</a>
</th>
<td>
Return the current active roles
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="date-and-time-functions.html#function_current-time">
<code class="literal">
CURRENT_TIME()
</code>
,
<code class="literal">
CURRENT_TIME
</code>
</a>
</th>
<td>
Synonyms for CURTIME()
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="date-and-time-functions.html#function_current-timestamp">
<code class="literal">
CURRENT_TIMESTAMP()
</code>
,
<code class="literal">
CURRENT_TIMESTAMP
</code>
</a>
</th>
<td>
Synonyms for NOW()
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="information-functions.html#function_current-user">
<code class="literal">
CURRENT_USER()
</code>
,
<code class="literal">
CURRENT_USER
</code>
</a>
</th>
<td>
The authenticated user name and host name
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="date-and-time-functions.html#function_curtime">
<code class="literal">
CURTIME()
</code>
</a>
</th>
<td>
Return the current time
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="information-functions.html#function_database">
<code class="literal">
DATABASE()
</code>
</a>
</th>
<td>
Return the default (current) database name
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="date-and-time-functions.html#function_date">
<code class="literal">
DATE()
</code>
</a>
</th>
<td>
Extract the date part of a date or datetime expression
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="date-and-time-functions.html#function_date-add">
<code class="literal">
DATE_ADD()
</code>
</a>
</th>
<td>
Add time values (intervals) to a date value
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="date-and-time-functions.html#function_date-format">
<code class="literal">
DATE_FORMAT()
</code>
</a>
</th>
<td>
Format date as specified
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="date-and-time-functions.html#function_date-sub">
<code class="literal">
DATE_SUB()
</code>
</a>
</th>
<td>
Subtract a time value (interval) from a date
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="date-and-time-functions.html#function_datediff">
<code class="literal">
DATEDIFF()
</code>
</a>
</th>
<td>
Subtract two dates
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="date-and-time-functions.html#function_day">
<code class="literal">
DAY()
</code>
</a>
</th>
<td>
Synonym for DAYOFMONTH()
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="date-and-time-functions.html#function_dayname">
<code class="literal">
DAYNAME()
</code>
</a>
</th>
<td>
Return the name of the weekday
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="date-and-time-functions.html#function_dayofmonth">
<code class="literal">
DAYOFMONTH()
</code>
</a>
</th>
<td>
Return the day of the month (0-31)
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="date-and-time-functions.html#function_dayofweek">
<code class="literal">
DAYOFWEEK()
</code>
</a>
</th>
<td>
Return the weekday index of the argument
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="date-and-time-functions.html#function_dayofyear">
<code class="literal">
DAYOFYEAR()
</code>
</a>
</th>
<td>
Return the day of the year (1-366)
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="miscellaneous-functions.html#function_default">
<code class="literal">
DEFAULT()
</code>
</a>
</th>
<td>
Return the default value for a table column
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="mathematical-functions.html#function_degrees">
<code class="literal">
DEGREES()
</code>
</a>
</th>
<td>
Convert radians to degrees
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="window-function-descriptions.html#function_dense-rank">
<code class="literal">
DENSE_RANK()
</code>
</a>
</th>
<td>
Rank of current row within its partition, without gaps
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="arithmetic-functions.html#operator_div">
<code class="literal">
DIV
</code>
</a>
</th>
<td>
Integer division
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="string-functions.html#function_elt">
<code class="literal">
ELT()
</code>
</a>
</th>
<td>
Return string at index number
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="comparison-operators.html#operator_exists">
<code class="literal">
EXISTS()
</code>
</a>
</th>
<td>
Whether the result of a query contains any rows
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="mathematical-functions.html#function_exp">
<code class="literal">
EXP()
</code>
</a>
</th>
<td>
Raise to the power of
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="string-functions.html#function_export-set">
<code class="literal">
EXPORT_SET()
</code>
</a>
</th>
<td>
Return a string such that for every bit set in the value bits, you
get an on string and for every unset bit, you get an off string
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="date-and-time-functions.html#function_extract">
<code class="literal">
EXTRACT()
</code>
</a>
</th>
<td>
Extract part of a date
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="xml-functions.html#function_extractvalue">
<code class="literal">
ExtractValue()
</code>
</a>
</th>
<td>
Extract a value from an XML string using XPath notation
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="string-functions.html#function_field">
<code class="literal">
FIELD()
</code>
</a>
</th>
<td>
Index (position) of first argument in subsequent arguments
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="string-functions.html#function_find-in-set">
<code class="literal">
FIND_IN_SET()
</code>
</a>
</th>
<td>
Index (position) of first argument within second argument
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="window-function-descriptions.html#function_first-value">
<code class="literal">
FIRST_VALUE()
</code>
</a>
</th>
<td>
Value of argument from first row of window frame
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="mathematical-functions.html#function_floor">
<code class="literal">
FLOOR()
</code>
</a>
</th>
<td>
Return the largest integer value not greater than the argument
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="string-functions.html#function_format">
<code class="literal">
FORMAT()
</code>
</a>
</th>
<td>
Return a number formatted to specified number of decimal places
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="performance-schema-functions.html#function_format-bytes">
<code class="literal">
FORMAT_BYTES()
</code>
</a>
</th>
<td>
Convert byte count to value with units
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="performance-schema-functions.html#function_format-pico-time">
<code class="literal">
FORMAT_PICO_TIME()
</code>
</a>
</th>
<td>
Convert time in picoseconds to value with units
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="information-functions.html#function_found-rows">
<code class="literal">
FOUND_ROWS()
</code>
</a>
</th>
<td>
For a SELECT with a LIMIT clause, the number of rows that would be
returned were there no LIMIT clause
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="date-and-time-functions.html#function_from-days">
<code class="literal">
FROM_DAYS()
</code>
</a>
</th>
<td>
Convert a day number to a date
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="date-and-time-functions.html#function_from-unixtime">
<code class="literal">
FROM_UNIXTIME()
</code>
</a>
</th>
<td>
Format Unix timestamp as a date
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="gis-mysql-specific-functions.html#function_geomcollection">
<code class="literal">
GeomCollection()
</code>
</a>
</th>
<td>
Construct geometry collection from geometries
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="gis-mysql-specific-functions.html#function_geometrycollection">
<code class="literal">
GeometryCollection()
</code>
</a>
</th>
<td>
Construct geometry collection from geometries
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="internal-functions.html#function_get-dd-column-privileges">
<code class="literal">
GET_DD_COLUMN_PRIVILEGES()
</code>
</a>
</th>
<td>
Internal use only
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="internal-functions.html#function_get-dd-create-options">
<code class="literal">
GET_DD_CREATE_OPTIONS()
</code>
</a>
</th>
<td>
Internal use only
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="internal-functions.html#function_get-dd-index-sub-part-length">
<code class="literal">
GET_DD_INDEX_SUB_PART_LENGTH()
</code>
</a>
</th>
<td>
Internal use only
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="date-and-time-functions.html#function_get-format">
<code class="literal">
GET_FORMAT()
</code>
</a>
</th>
<td>
Return a date format string
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="locking-functions.html#function_get-lock">
<code class="literal">
GET_LOCK()
</code>
</a>
</th>
<td>
Get a named lock
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="comparison-operators.html#function_greatest">
<code class="literal">
GREATEST()
</code>
</a>
</th>
<td>
Return the largest argument
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="aggregate-functions.html#function_group-concat">
<code class="literal">
GROUP_CONCAT()
</code>
</a>
</th>
<td>
Return a concatenated string
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="group-replication-functions-for-member-actions.html#function_group-replication-disable-member-action">
<code class="literal">
group_replication_disable_member_action()
</code>
</a>
</th>
<td>
Disable member action for event specified
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="group-replication-functions-for-member-actions.html#function_group-replication-enable-member-action">
<code class="literal">
group_replication_enable_member_action()
</code>
</a>
</th>
<td>
Enable member action for event specified
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<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>
</th>
<td>
Get version of group replication communication protocol currently
in use
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="group-replication-functions-for-maximum-consensus.html#function_group-replication-get-write-concurrency">
<code class="literal">
group_replication_get_write_concurrency()
</code>
</a>
</th>
<td>
Get maximum number of consensus instances currently set for group
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="group-replication-functions-for-member-actions.html#function_group-replication-reset-member-actions">
<code class="literal">
group_replication_reset_member_actions()
</code>
</a>
</th>
<td>
Reset all member actions to defaults and configuration version
number to 1
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="group-replication-functions-for-new-primary.html#function_group-replication-set-as-primary">
<code class="literal">
group_replication_set_as_primary()
</code>
</a>
</th>
<td>
Make a specific group member the primary
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<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>
</th>
<td>
Set version for group replication communication protocol to use
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="group-replication-functions-for-maximum-consensus.html#function_group-replication-set-write-concurrency">
<code class="literal">
group_replication_set_write_concurrency()
</code>
</a>
</th>
<td>
Set maximum number of consensus instances that can be executed in
parallel
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="group-replication-functions-for-mode.html#function_group-replication-switch-to-multi-primary-mode">
<code class="literal">
group_replication_switch_to_multi_primary_mode()
</code>
</a>
</th>
<td>
Changes the mode of a group running in single-primary mode to
multi-primary mode
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="group-replication-functions-for-mode.html#function_group-replication-switch-to-single-primary-mode">
<code class="literal">
group_replication_switch_to_single_primary_mode()
</code>
</a>
</th>
<td>
Changes the mode of a group running in multi-primary mode to
single-primary mode
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="miscellaneous-functions.html#function_grouping">
<code class="literal">
GROUPING()
</code>
</a>
</th>
<td>
Distinguish super-aggregate ROLLUP rows from regular rows
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="string-functions.html#function_hex">
<code class="literal">
HEX()
</code>
</a>
</th>
<td>
Hexadecimal representation of decimal or string value
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="date-and-time-functions.html#function_hour">
<code class="literal">
HOUR()
</code>
</a>
</th>
<td>
Extract the hour
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="information-functions.html#function_icu-version">
<code class="literal">
ICU_VERSION()
</code>
</a>
</th>
<td>
ICU library version
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="flow-control-functions.html#function_if">
<code class="literal">
IF()
</code>
</a>
</th>
<td>
If/else construct
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="flow-control-functions.html#function_ifnull">
<code class="literal">
IFNULL()
</code>
</a>
</th>
<td>
Null if/else construct
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="comparison-operators.html#operator_in">
<code class="literal">
IN()
</code>
</a>
</th>
<td>
Whether a value is within a set of values
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="miscellaneous-functions.html#function_inet-aton">
<code class="literal">
INET_ATON()
</code>
</a>
</th>
<td>
Return the numeric value of an IP address
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="miscellaneous-functions.html#function_inet-ntoa">
<code class="literal">
INET_NTOA()
</code>
</a>
</th>
<td>
Return the IP address from a numeric value
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="string-functions.html#function_insert">
<code class="literal">
INSERT()
</code>
</a>
</th>
<td>
Insert substring at specified position up to specified number of
characters
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="string-functions.html#function_instr">
<code class="literal">
INSTR()
</code>
</a>
</th>
<td>
Return the index of the first occurrence of substring
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="internal-functions.html#function_internal-auto-increment">
<code class="literal">
INTERNAL_AUTO_INCREMENT()
</code>
</a>
</th>
<td>
Internal use only
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="internal-functions.html#function_internal-avg-row-length">
<code class="literal">
INTERNAL_AVG_ROW_LENGTH()
</code>
</a>
</th>
<td>
Internal use only
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="internal-functions.html#function_internal-check-time">
<code class="literal">
INTERNAL_CHECK_TIME()
</code>
</a>
</th>
<td>
Internal use only
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="internal-functions.html#function_internal-checksum">
<code class="literal">
INTERNAL_CHECKSUM()
</code>
</a>
</th>
<td>
Internal use only
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="internal-functions.html#function_internal-data-free">
<code class="literal">
INTERNAL_DATA_FREE()
</code>
</a>
</th>
<td>
Internal use only
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="internal-functions.html#function_internal-data-length">
<code class="literal">
INTERNAL_DATA_LENGTH()
</code>
</a>
</th>
<td>
Internal use only
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="internal-functions.html#function_internal-dd-char-length">
<code class="literal">
INTERNAL_DD_CHAR_LENGTH()
</code>
</a>
</th>
<td>
Internal use only
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="internal-functions.html#function_internal-get-comment-or-error">
<code class="literal">
INTERNAL_GET_COMMENT_OR_ERROR()
</code>
</a>
</th>
<td>
Internal use only
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="internal-functions.html#function_internal-get-enabled-role-json">
<code class="literal">
INTERNAL_GET_ENABLED_ROLE_JSON()
</code>
</a>
</th>
<td>
Internal use only
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="internal-functions.html#function_internal-get-hostname">
<code class="literal">
INTERNAL_GET_HOSTNAME()
</code>
</a>
</th>
<td>
Internal use only
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="internal-functions.html#function_internal-get-username">
<code class="literal">
INTERNAL_GET_USERNAME()
</code>
</a>
</th>
<td>
Internal use only
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="internal-functions.html#function_internal-get-view-warning-or-error">
<code class="literal">
INTERNAL_GET_VIEW_WARNING_OR_ERROR()
</code>
</a>
</th>
<td>
Internal use only
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="internal-functions.html#function_internal-index-column-cardinality">
<code class="literal">
INTERNAL_INDEX_COLUMN_CARDINALITY()
</code>
</a>
</th>
<td>
Internal use only
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="internal-functions.html#function_internal-index-length">
<code class="literal">
INTERNAL_INDEX_LENGTH()
</code>
</a>
</th>
<td>
Internal use only
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="internal-functions.html#function_internal-is-enabled-role">
<code class="literal">
INTERNAL_IS_ENABLED_ROLE()
</code>
</a>
</th>
<td>
Internal use only
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="internal-functions.html#function_internal-is-mandatory-role">
<code class="literal">
INTERNAL_IS_MANDATORY_ROLE()
</code>
</a>
</th>
<td>
Internal use only
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="internal-functions.html#function_internal-keys-disabled">
<code class="literal">
INTERNAL_KEYS_DISABLED()
</code>
</a>
</th>
<td>
Internal use only
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="internal-functions.html#function_internal-max-data-length">
<code class="literal">
INTERNAL_MAX_DATA_LENGTH()
</code>
</a>
</th>
<td>
Internal use only
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="internal-functions.html#function_internal-table-rows">
<code class="literal">
INTERNAL_TABLE_ROWS()
</code>
</a>
</th>
<td>
Internal use only
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="internal-functions.html#function_internal-update-time">
<code class="literal">
INTERNAL_UPDATE_TIME()
</code>
</a>
</th>
<td>
Internal use only
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="comparison-operators.html#function_interval">
<code class="literal">
INTERVAL()
</code>
</a>
</th>
<td>
Return the index of the argument that is less than the first
argument
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="comparison-operators.html#operator_is">
<code class="literal">
IS
</code>
</a>
</th>
<td>
Test a value against a boolean
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="locking-functions.html#function_is-free-lock">
<code class="literal">
IS_FREE_LOCK()
</code>
</a>
</th>
<td>
Whether the named lock is free
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="comparison-operators.html#operator_is-not">
<code class="literal">
IS NOT
</code>
</a>
</th>
<td>
Test a value against a boolean
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="comparison-operators.html#operator_is-not-null">
<code class="literal">
IS NOT NULL
</code>
</a>
</th>
<td>
NOT NULL value test
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="comparison-operators.html#operator_is-null">
<code class="literal">
IS NULL
</code>
</a>
</th>
<td>
NULL value test
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="locking-functions.html#function_is-used-lock">
<code class="literal">
IS_USED_LOCK()
</code>
</a>
</th>
<td>
Whether the named lock is in use; return connection identifier if
true
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="miscellaneous-functions.html#function_is-uuid">
<code class="literal">
IS_UUID()
</code>
</a>
</th>
<td>
Whether argument is a valid UUID
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="comparison-operators.html#function_isnull">
<code class="literal">
ISNULL()
</code>
</a>
</th>
<td>
Test whether the argument is NULL
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="json-creation-functions.html#function_json-array">
<code class="literal">
JSON_ARRAY()
</code>
</a>
</th>
<td>
Create JSON array
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="json-modification-functions.html#function_json-array-append">
<code class="literal">
JSON_ARRAY_APPEND()
</code>
</a>
</th>
<td>
Append data to JSON document
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="json-modification-functions.html#function_json-array-insert">
<code class="literal">
JSON_ARRAY_INSERT()
</code>
</a>
</th>
<td>
Insert into JSON array
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="aggregate-functions.html#function_json-arrayagg">
<code class="literal">
JSON_ARRAYAGG()
</code>
</a>
</th>
<td>
Return result set as a single JSON array
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="json-search-functions.html#function_json-contains">
<code class="literal">
JSON_CONTAINS()
</code>
</a>
</th>
<td>
Whether JSON document contains specific object at path
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="json-search-functions.html#function_json-contains-path">
<code class="literal">
JSON_CONTAINS_PATH()
</code>
</a>
</th>
<td>
Whether JSON document contains any data at path
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="json-attribute-functions.html#function_json-depth">
<code class="literal">
JSON_DEPTH()
</code>
</a>
</th>
<td>
Maximum depth of JSON document
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="json-search-functions.html#function_json-extract">
<code class="literal">
JSON_EXTRACT()
</code>
</a>
</th>
<td>
Return data from JSON document
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="json-modification-functions.html#function_json-insert">
<code class="literal">
JSON_INSERT()
</code>
</a>
</th>
<td>
Insert data into JSON document
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="json-search-functions.html#function_json-keys">
<code class="literal">
JSON_KEYS()
</code>
</a>
</th>
<td>
Array of keys from JSON document
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="json-attribute-functions.html#function_json-length">
<code class="literal">
JSON_LENGTH()
</code>
</a>
</th>
<td>
Number of elements in JSON document
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="json-modification-functions.html#function_json-merge">
<code class="literal">
JSON_MERGE()
</code>
</a>
</th>
<td>
Merge JSON documents, preserving duplicate keys. Deprecated
synonym for JSON_MERGE_PRESERVE()
</td>
<td>
Yes
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="json-modification-functions.html#function_json-merge-patch">
<code class="literal">
JSON_MERGE_PATCH()
</code>
</a>
</th>
<td>
Merge JSON documents, replacing values of duplicate keys
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="json-modification-functions.html#function_json-merge-preserve">
<code class="literal">
JSON_MERGE_PRESERVE()
</code>
</a>
</th>
<td>
Merge JSON documents, preserving duplicate keys
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="json-creation-functions.html#function_json-object">
<code class="literal">
JSON_OBJECT()
</code>
</a>
</th>
<td>
Create JSON object
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="aggregate-functions.html#function_json-objectagg">
<code class="literal">
JSON_OBJECTAGG()
</code>
</a>
</th>
<td>
Return result set as a single JSON object
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="json-search-functions.html#function_json-overlaps">
<code class="literal">
JSON_OVERLAPS()
</code>
</a>
</th>
<td>
Compares two JSON documents, returns TRUE (1) if these have any
key-value pairs or array elements in common, otherwise FALSE (0)
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="json-utility-functions.html#function_json-pretty">
<code class="literal">
JSON_PRETTY()
</code>
</a>
</th>
<td>
Print a JSON document in human-readable format
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="json-creation-functions.html#function_json-quote">
<code class="literal">
JSON_QUOTE()
</code>
</a>
</th>
<td>
Quote JSON document
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="json-modification-functions.html#function_json-remove">
<code class="literal">
JSON_REMOVE()
</code>
</a>
</th>
<td>
Remove data from JSON document
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="json-modification-functions.html#function_json-replace">
<code class="literal">
JSON_REPLACE()
</code>
</a>
</th>
<td>
Replace values in JSON document
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="json-validation-functions.html#function_json-schema-valid">
<code class="literal">
JSON_SCHEMA_VALID()
</code>
</a>
</th>
<td>
Validate JSON document against JSON schema; returns TRUE/1 if
document validates against schema, or FALSE/0 if it does not
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="json-validation-functions.html#function_json-schema-validation-report">
<code class="literal">
JSON_SCHEMA_VALIDATION_REPORT()
</code>
</a>
</th>
<td>
Validate JSON document against JSON schema; returns report in JSON
format on outcome on validation including success or failure and
reasons for failure
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="json-search-functions.html#function_json-search">
<code class="literal">
JSON_SEARCH()
</code>
</a>
</th>
<td>
Path to value within JSON document
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="json-modification-functions.html#function_json-set">
<code class="literal">
JSON_SET()
</code>
</a>
</th>
<td>
Insert data into JSON document
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="json-utility-functions.html#function_json-storage-free">
<code class="literal">
JSON_STORAGE_FREE()
</code>
</a>
</th>
<td>
Freed space within binary representation of JSON column value
following partial update
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="json-utility-functions.html#function_json-storage-size">
<code class="literal">
JSON_STORAGE_SIZE()
</code>
</a>
</th>
<td>
Space used for storage of binary representation of a JSON document
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="json-table-functions.html#function_json-table">
<code class="literal">
JSON_TABLE()
</code>
</a>
</th>
<td>
Return data from a JSON expression as a relational table
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="json-attribute-functions.html#function_json-type">
<code class="literal">
JSON_TYPE()
</code>
</a>
</th>
<td>
Type of JSON value
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="json-modification-functions.html#function_json-unquote">
<code class="literal">
JSON_UNQUOTE()
</code>
</a>
</th>
<td>
Unquote JSON value
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="json-attribute-functions.html#function_json-valid">
<code class="literal">
JSON_VALID()
</code>
</a>
</th>
<td>
Whether JSON value is valid
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="json-search-functions.html#function_json-value">
<code class="literal">
JSON_VALUE()
</code>
</a>
</th>
<td>
Extract value from JSON document at location pointed to by path
provided; return this value as VARCHAR(512) or specified type
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="window-function-descriptions.html#function_lag">
<code class="literal">
LAG()
</code>
</a>
</th>
<td>
Value of argument from row lagging current row within partition
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="date-and-time-functions.html#function_last-day">
<code class="literal">
LAST_DAY
</code>
</a>
</th>
<td>
Return the last day of the month for the argument
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="information-functions.html#function_last-insert-id">
<code class="literal">
LAST_INSERT_ID()
</code>
</a>
</th>
<td>
Value of the AUTOINCREMENT column for the last INSERT
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="window-function-descriptions.html#function_last-value">
<code class="literal">
LAST_VALUE()
</code>
</a>
</th>
<td>
Value of argument from last row of window frame
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="string-functions.html#function_lcase">
<code class="literal">
LCASE()
</code>
</a>
</th>
<td>
Synonym for LOWER()
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="window-function-descriptions.html#function_lead">
<code class="literal">
LEAD()
</code>
</a>
</th>
<td>
Value of argument from row leading current row within partition
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="comparison-operators.html#function_least">
<code class="literal">
LEAST()
</code>
</a>
</th>
<td>
Return the smallest argument
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="string-functions.html#function_left">
<code class="literal">
LEFT()
</code>
</a>
</th>
<td>
Return the leftmost number of characters as specified
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="string-functions.html#function_length">
<code class="literal">
LENGTH()
</code>
</a>
</th>
<td>
Return the length of a string in bytes
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="string-comparison-functions.html#operator_like">
<code class="literal">
LIKE
</code>
</a>
</th>
<td>
Simple pattern matching
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="gis-mysql-specific-functions.html#function_linestring">
<code class="literal">
LineString()
</code>
</a>
</th>
<td>
Construct LineString from Point values
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="mathematical-functions.html#function_ln">
<code class="literal">
LN()
</code>
</a>
</th>
<td>
Return the natural logarithm of the argument
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="string-functions.html#function_load-file">
<code class="literal">
LOAD_FILE()
</code>
</a>
</th>
<td>
Load the named file
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="date-and-time-functions.html#function_localtime">
<code class="literal">
LOCALTIME()
</code>
,
<code class="literal">
LOCALTIME
</code>
</a>
</th>
<td>
Synonym for NOW()
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="date-and-time-functions.html#function_localtimestamp">
<code class="literal">
LOCALTIMESTAMP
</code>
,
<code class="literal">
LOCALTIMESTAMP()
</code>
</a>
</th>
<td>
Synonym for NOW()
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="string-functions.html#function_locate">
<code class="literal">
LOCATE()
</code>
</a>
</th>
<td>
Return the position of the first occurrence of substring
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="mathematical-functions.html#function_log">
<code class="literal">
LOG()
</code>
</a>
</th>
<td>
Return the natural logarithm of the first argument
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="mathematical-functions.html#function_log10">
<code class="literal">
LOG10()
</code>
</a>
</th>
<td>
Return the base-10 logarithm of the argument
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="mathematical-functions.html#function_log2">
<code class="literal">
LOG2()
</code>
</a>
</th>
<td>
Return the base-2 logarithm of the argument
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="string-functions.html#function_lower">
<code class="literal">
LOWER()
</code>
</a>
</th>
<td>
Return the argument in lowercase
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="string-functions.html#function_lpad">
<code class="literal">
LPAD()
</code>
</a>
</th>
<td>
Return the string argument, left-padded with the specified string
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="string-functions.html#function_ltrim">
<code class="literal">
LTRIM()
</code>
</a>
</th>
<td>
Remove leading spaces
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="string-functions.html#function_make-set">
<code class="literal">
MAKE_SET()
</code>
</a>
</th>
<td>
Return a set of comma-separated strings that have the
corresponding bit in bits set
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="date-and-time-functions.html#function_makedate">
<code class="literal">
MAKEDATE()
</code>
</a>
</th>
<td>
Create a date from the year and day of year
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="date-and-time-functions.html#function_maketime">
<code class="literal">
MAKETIME()
</code>
</a>
</th>
<td>
Create time from hour, minute, second
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="replication-functions-synchronization.html#function_master-pos-wait">
<code class="literal">
MASTER_POS_WAIT()
</code>
</a>
</th>
<td>
Block until the replica has read and applied all updates up to the
specified position
</td>
<td>
Yes
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="fulltext-search.html#function_match">
<code class="literal">
MATCH()
</code>
</a>
</th>
<td>
Perform full-text search
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="aggregate-functions.html#function_max">
<code class="literal">
MAX()
</code>
</a>
</th>
<td>
Return the maximum value
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="spatial-relation-functions-mbr.html#function_mbrcontains">
<code class="literal">
MBRContains()
</code>
</a>
</th>
<td>
Whether MBR of one geometry contains MBR of another
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="spatial-relation-functions-mbr.html#function_mbrcoveredby">
<code class="literal">
MBRCoveredBy()
</code>
</a>
</th>
<td>
Whether one MBR is covered by another
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="spatial-relation-functions-mbr.html#function_mbrcovers">
<code class="literal">
MBRCovers()
</code>
</a>
</th>
<td>
Whether one MBR covers another
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="spatial-relation-functions-mbr.html#function_mbrdisjoint">
<code class="literal">
MBRDisjoint()
</code>
</a>
</th>
<td>
Whether MBRs of two geometries are disjoint
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="spatial-relation-functions-mbr.html#function_mbrequals">
<code class="literal">
MBREquals()
</code>
</a>
</th>
<td>
Whether MBRs of two geometries are equal
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="spatial-relation-functions-mbr.html#function_mbrintersects">
<code class="literal">
MBRIntersects()
</code>
</a>
</th>
<td>
Whether MBRs of two geometries intersect
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="spatial-relation-functions-mbr.html#function_mbroverlaps">
<code class="literal">
MBROverlaps()
</code>
</a>
</th>
<td>
Whether MBRs of two geometries overlap
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="spatial-relation-functions-mbr.html#function_mbrtouches">
<code class="literal">
MBRTouches()
</code>
</a>
</th>
<td>
Whether MBRs of two geometries touch
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="spatial-relation-functions-mbr.html#function_mbrwithin">
<code class="literal">
MBRWithin()
</code>
</a>
</th>
<td>
Whether MBR of one geometry is within MBR of another
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="encryption-functions.html#function_md5">
<code class="literal">
MD5()
</code>
</a>
</th>
<td>
Calculate MD5 checksum
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="json-search-functions.html#operator_member-of">
<code class="literal">
MEMBER OF()
</code>
</a>
</th>
<td>
Returns true (1) if first operand matches any element of JSON
array passed as second operand, otherwise returns false (0)
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="date-and-time-functions.html#function_microsecond">
<code class="literal">
MICROSECOND()
</code>
</a>
</th>
<td>
Return the microseconds from argument
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="string-functions.html#function_mid">
<code class="literal">
MID()
</code>
</a>
</th>
<td>
Return a substring starting from the specified position
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="aggregate-functions.html#function_min">
<code class="literal">
MIN()
</code>
</a>
</th>
<td>
Return the minimum value
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="date-and-time-functions.html#function_minute">
<code class="literal">
MINUTE()
</code>
</a>
</th>
<td>
Return the minute from the argument
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="mathematical-functions.html#function_mod">
<code class="literal">
MOD()
</code>
</a>
</th>
<td>
Return the remainder
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="date-and-time-functions.html#function_month">
<code class="literal">
MONTH()
</code>
</a>
</th>
<td>
Return the month from the date passed
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="date-and-time-functions.html#function_monthname">
<code class="literal">
MONTHNAME()
</code>
</a>
</th>
<td>
Return the name of the month
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="gis-mysql-specific-functions.html#function_multilinestring">
<code class="literal">
MultiLineString()
</code>
</a>
</th>
<td>
Contruct MultiLineString from LineString values
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="gis-mysql-specific-functions.html#function_multipoint">
<code class="literal">
MultiPoint()
</code>
</a>
</th>
<td>
Construct MultiPoint from Point values
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="gis-mysql-specific-functions.html#function_multipolygon">
<code class="literal">
MultiPolygon()
</code>
</a>
</th>
<td>
Construct MultiPolygon from Polygon values
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="miscellaneous-functions.html#function_name-const">
<code class="literal">
NAME_CONST()
</code>
</a>
</th>
<td>
Cause the column to have the given name
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="logical-operators.html#operator_not">
<code class="literal">
NOT
</code>
,
<code class="literal">
!
</code>
</a>
</th>
<td>
Negates value
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="comparison-operators.html#operator_not-between">
<code class="literal">
NOT BETWEEN ... AND ...
</code>
</a>
</th>
<td>
Whether a value is not within a range of values
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="comparison-operators.html#operator_not-exists">
<code class="literal">
NOT EXISTS()
</code>
</a>
</th>
<td>
Whether the result of a query contains no rows
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="comparison-operators.html#operator_not-in">
<code class="literal">
NOT IN()
</code>
</a>
</th>
<td>
Whether a value is not within a set of values
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="string-comparison-functions.html#operator_not-like">
<code class="literal">
NOT LIKE
</code>
</a>
</th>
<td>
Negation of simple pattern matching
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="regexp.html#operator_not-regexp">
<code class="literal">
NOT REGEXP
</code>
</a>
</th>
<td>
Negation of REGEXP
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="date-and-time-functions.html#function_now">
<code class="literal">
NOW()
</code>
</a>
</th>
<td>
Return the current date and time
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="window-function-descriptions.html#function_nth-value">
<code class="literal">
NTH_VALUE()
</code>
</a>
</th>
<td>
Value of argument from N-th row of window frame
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="window-function-descriptions.html#function_ntile">
<code class="literal">
NTILE()
</code>
</a>
</th>
<td>
Bucket number of current row within its partition.
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="flow-control-functions.html#function_nullif">
<code class="literal">
NULLIF()
</code>
</a>
</th>
<td>
Return NULL if expr1 = expr2
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="string-functions.html#function_oct">
<code class="literal">
OCT()
</code>
</a>
</th>
<td>
Return a string containing octal representation of a number
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="string-functions.html#function_octet-length">
<code class="literal">
OCTET_LENGTH()
</code>
</a>
</th>
<td>
Synonym for LENGTH()
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="logical-operators.html#operator_or">
<code class="literal">
OR
</code>
,
<code class="literal">
||
</code>
</a>
</th>
<td>
Logical OR
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="string-functions.html#function_ord">
<code class="literal">
ORD()
</code>
</a>
</th>
<td>
Return character code for leftmost character of the argument
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="window-function-descriptions.html#function_percent-rank">
<code class="literal">
PERCENT_RANK()
</code>
</a>
</th>
<td>
Percentage rank value
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="date-and-time-functions.html#function_period-add">
<code class="literal">
PERIOD_ADD()
</code>
</a>
</th>
<td>
Add a period to a year-month
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="date-and-time-functions.html#function_period-diff">
<code class="literal">
PERIOD_DIFF()
</code>
</a>
</th>
<td>
Return the number of months between periods
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="mathematical-functions.html#function_pi">
<code class="literal">
PI()
</code>
</a>
</th>
<td>
Return the value of pi
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="gis-mysql-specific-functions.html#function_point">
<code class="literal">
Point()
</code>
</a>
</th>
<td>
Construct Point from coordinates
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="gis-mysql-specific-functions.html#function_polygon">
<code class="literal">
Polygon()
</code>
</a>
</th>
<td>
Construct Polygon from LineString arguments
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="string-functions.html#function_position">
<code class="literal">
POSITION()
</code>
</a>
</th>
<td>
Synonym for LOCATE()
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="mathematical-functions.html#function_pow">
<code class="literal">
POW()
</code>
</a>
</th>
<td>
Return the argument raised to the specified power
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="mathematical-functions.html#function_power">
<code class="literal">
POWER()
</code>
</a>
</th>
<td>
Return the argument raised to the specified power
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="performance-schema-functions.html#function_ps-current-thread-id">
<code class="literal">
PS_CURRENT_THREAD_ID()
</code>
</a>
</th>
<td>
Performance Schema thread ID for current thread
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="performance-schema-functions.html#function_ps-thread-id">
<code class="literal">
PS_THREAD_ID()
</code>
</a>
</th>
<td>
Performance Schema thread ID for given thread
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="date-and-time-functions.html#function_quarter">
<code class="literal">
QUARTER()
</code>
</a>
</th>
<td>
Return the quarter from a date argument
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="string-functions.html#function_quote">
<code class="literal">
QUOTE()
</code>
</a>
</th>
<td>
Escape the argument for use in an SQL statement
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="mathematical-functions.html#function_radians">
<code class="literal">
RADIANS()
</code>
</a>
</th>
<td>
Return argument converted to radians
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="mathematical-functions.html#function_rand">
<code class="literal">
RAND()
</code>
</a>
</th>
<td>
Return a random floating-point value
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="encryption-functions.html#function_random-bytes">
<code class="literal">
RANDOM_BYTES()
</code>
</a>
</th>
<td>
Return a random byte vector
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="window-function-descriptions.html#function_rank">
<code class="literal">
RANK()
</code>
</a>
</th>
<td>
Rank of current row within its partition, with gaps
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="regexp.html#operator_regexp">
<code class="literal">
REGEXP
</code>
</a>
</th>
<td>
Whether string matches regular expression
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="regexp.html#function_regexp-instr">
<code class="literal">
REGEXP_INSTR()
</code>
</a>
</th>
<td>
Starting index of substring matching regular expression
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="regexp.html#function_regexp-like">
<code class="literal">
REGEXP_LIKE()
</code>
</a>
</th>
<td>
Whether string matches regular expression
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="regexp.html#function_regexp-replace">
<code class="literal">
REGEXP_REPLACE()
</code>
</a>
</th>
<td>
Replace substrings matching regular expression
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="regexp.html#function_regexp-substr">
<code class="literal">
REGEXP_SUBSTR()
</code>
</a>
</th>
<td>
Return substring matching regular expression
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="locking-functions.html#function_release-all-locks">
<code class="literal">
RELEASE_ALL_LOCKS()
</code>
</a>
</th>
<td>
Release all current named locks
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="locking-functions.html#function_release-lock">
<code class="literal">
RELEASE_LOCK()
</code>
</a>
</th>
<td>
Release the named lock
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="string-functions.html#function_repeat">
<code class="literal">
REPEAT()
</code>
</a>
</th>
<td>
Repeat a string the specified number of times
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="string-functions.html#function_replace">
<code class="literal">
REPLACE()
</code>
</a>
</th>
<td>
Replace occurrences of a specified string
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="string-functions.html#function_reverse">
<code class="literal">
REVERSE()
</code>
</a>
</th>
<td>
Reverse the characters in a string
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="string-functions.html#function_right">
<code class="literal">
RIGHT()
</code>
</a>
</th>
<td>
Return the specified rightmost number of characters
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="regexp.html#operator_regexp">
<code class="literal">
RLIKE
</code>
</a>
</th>
<td>
Whether string matches regular expression
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="information-functions.html#function_roles-graphml">
<code class="literal">
ROLES_GRAPHML()
</code>
</a>
</th>
<td>
Return a GraphML document representing memory role subgraphs
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="mathematical-functions.html#function_round">
<code class="literal">
ROUND()
</code>
</a>
</th>
<td>
Round the argument
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="information-functions.html#function_row-count">
<code class="literal">
ROW_COUNT()
</code>
</a>
</th>
<td>
The number of rows updated
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="window-function-descriptions.html#function_row-number">
<code class="literal">
ROW_NUMBER()
</code>
</a>
</th>
<td>
Number of current row within its partition
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="string-functions.html#function_rpad">
<code class="literal">
RPAD()
</code>
</a>
</th>
<td>
Append string the specified number of times
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="string-functions.html#function_rtrim">
<code class="literal">
RTRIM()
</code>
</a>
</th>
<td>
Remove trailing spaces
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="information-functions.html#function_schema">
<code class="literal">
SCHEMA()
</code>
</a>
</th>
<td>
Synonym for DATABASE()
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="date-and-time-functions.html#function_sec-to-time">
<code class="literal">
SEC_TO_TIME()
</code>
</a>
</th>
<td>
Converts seconds to 'hh:mm:ss' format
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="date-and-time-functions.html#function_second">
<code class="literal">
SECOND()
</code>
</a>
</th>
<td>
Return the second (0-59)
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="information-functions.html#function_session-user">
<code class="literal">
SESSION_USER()
</code>
</a>
</th>
<td>
Synonym for USER()
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="encryption-functions.html#function_sha1">
<code class="literal">
SHA1()
</code>
,
<code class="literal">
SHA()
</code>
</a>
</th>
<td>
Calculate an SHA-1 160-bit checksum
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="encryption-functions.html#function_sha2">
<code class="literal">
SHA2()
</code>
</a>
</th>
<td>
Calculate an SHA-2 checksum
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="mathematical-functions.html#function_sign">
<code class="literal">
SIGN()
</code>
</a>
</th>
<td>
Return the sign of the argument
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="mathematical-functions.html#function_sin">
<code class="literal">
SIN()
</code>
</a>
</th>
<td>
Return the sine of the argument
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="miscellaneous-functions.html#function_sleep">
<code class="literal">
SLEEP()
</code>
</a>
</th>
<td>
Sleep for a number of seconds
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="string-functions.html#function_soundex">
<code class="literal">
SOUNDEX()
</code>
</a>
</th>
<td>
Return a soundex string
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="string-functions.html#operator_sounds-like">
<code class="literal">
SOUNDS LIKE
</code>
</a>
</th>
<td>
Compare sounds
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="replication-functions-synchronization.html#function_source-pos-wait">
<code class="literal">
SOURCE_POS_WAIT()
</code>
</a>
</th>
<td>
Block until the replica has read and applied all updates up to the
specified position
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="string-functions.html#function_space">
<code class="literal">
SPACE()
</code>
</a>
</th>
<td>
Return a string of the specified number of spaces
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="mathematical-functions.html#function_sqrt">
<code class="literal">
SQRT()
</code>
</a>
</th>
<td>
Return the square root of the argument
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="gis-polygon-property-functions.html#function_st-area">
<code class="literal">
ST_Area()
</code>
</a>
</th>
<td>
Return Polygon or MultiPolygon area
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="gis-format-conversion-functions.html#function_st-asbinary">
<code class="literal">
ST_AsBinary()
</code>
,
<code class="literal">
ST_AsWKB()
</code>
</a>
</th>
<td>
Convert from internal geometry format to WKB
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="spatial-geojson-functions.html#function_st-asgeojson">
<code class="literal">
ST_AsGeoJSON()
</code>
</a>
</th>
<td>
Generate GeoJSON object from geometry
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="gis-format-conversion-functions.html#function_st-astext">
<code class="literal">
ST_AsText()
</code>
,
<code class="literal">
ST_AsWKT()
</code>
</a>
</th>
<td>
Convert from internal geometry format to WKT
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="spatial-operator-functions.html#function_st-buffer">
<code class="literal">
ST_Buffer()
</code>
</a>
</th>
<td>
Return geometry of points within given distance from geometry
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="spatial-operator-functions.html#function_st-buffer-strategy">
<code class="literal">
ST_Buffer_Strategy()
</code>
</a>
</th>
<td>
Produce strategy option for ST_Buffer()
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="gis-polygon-property-functions.html#function_st-centroid">
<code class="literal">
ST_Centroid()
</code>
</a>
</th>
<td>
Return centroid as a point
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="spatial-aggregate-functions.html#function_st-collect">
<code class="literal">
ST_Collect()
</code>
</a>
</th>
<td>
Aggregate spatial values into collection
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="spatial-relation-functions-object-shapes.html#function_st-contains">
<code class="literal">
ST_Contains()
</code>
</a>
</th>
<td>
Whether one geometry contains another
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="spatial-operator-functions.html#function_st-convexhull">
<code class="literal">
ST_ConvexHull()
</code>
</a>
</th>
<td>
Return convex hull of geometry
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="spatial-relation-functions-object-shapes.html#function_st-crosses">
<code class="literal">
ST_Crosses()
</code>
</a>
</th>
<td>
Whether one geometry crosses another
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="spatial-operator-functions.html#function_st-difference">
<code class="literal">
ST_Difference()
</code>
</a>
</th>
<td>
Return point set difference of two geometries
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="gis-general-property-functions.html#function_st-dimension">
<code class="literal">
ST_Dimension()
</code>
</a>
</th>
<td>
Dimension of geometry
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="spatial-relation-functions-object-shapes.html#function_st-disjoint">
<code class="literal">
ST_Disjoint()
</code>
</a>
</th>
<td>
Whether one geometry is disjoint from another
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="spatial-relation-functions-object-shapes.html#function_st-distance">
<code class="literal">
ST_Distance()
</code>
</a>
</th>
<td>
The distance of one geometry from another
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="spatial-convenience-functions.html#function_st-distance-sphere">
<code class="literal">
ST_Distance_Sphere()
</code>
</a>
</th>
<td>
Minimum distance on earth between two geometries
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="gis-linestring-property-functions.html#function_st-endpoint">
<code class="literal">
ST_EndPoint()
</code>
</a>
</th>
<td>
End Point of LineString
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="gis-general-property-functions.html#function_st-envelope">
<code class="literal">
ST_Envelope()
</code>
</a>
</th>
<td>
Return MBR of geometry
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="spatial-relation-functions-object-shapes.html#function_st-equals">
<code class="literal">
ST_Equals()
</code>
</a>
</th>
<td>
Whether one geometry is equal to another
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="gis-polygon-property-functions.html#function_st-exteriorring">
<code class="literal">
ST_ExteriorRing()
</code>
</a>
</th>
<td>
Return exterior ring of Polygon
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="spatial-relation-functions-object-shapes.html#function_st-frechetdistance">
<code class="literal">
ST_FrechetDistance()
</code>
</a>
</th>
<td>
The discrete Fréchet distance of one geometry from another
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="spatial-geohash-functions.html#function_st-geohash">
<code class="literal">
ST_GeoHash()
</code>
</a>
</th>
<td>
Produce a geohash value
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="gis-wkt-functions.html#function_st-geomcollfromtext">
<code class="literal">
ST_GeomCollFromText()
</code>
,
<code class="literal">
ST_GeometryCollectionFromText()
</code>
,
<code class="literal">
ST_GeomCollFromTxt()
</code>
</a>
</th>
<td>
Return geometry collection from WKT
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="gis-wkb-functions.html#function_st-geomcollfromwkb">
<code class="literal">
ST_GeomCollFromWKB()
</code>
,
<code class="literal">
ST_GeometryCollectionFromWKB()
</code>
</a>
</th>
<td>
Return geometry collection from WKB
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="gis-geometrycollection-property-functions.html#function_st-geometryn">
<code class="literal">
ST_GeometryN()
</code>
</a>
</th>
<td>
Return N-th geometry from geometry collection
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="gis-general-property-functions.html#function_st-geometrytype">
<code class="literal">
ST_GeometryType()
</code>
</a>
</th>
<td>
Return name of geometry type
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="spatial-geojson-functions.html#function_st-geomfromgeojson">
<code class="literal">
ST_GeomFromGeoJSON()
</code>
</a>
</th>
<td>
Generate geometry from GeoJSON object
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="gis-wkt-functions.html#function_st-geomfromtext">
<code class="literal">
ST_GeomFromText()
</code>
,
<code class="literal">
ST_GeometryFromText()
</code>
</a>
</th>
<td>
Return geometry from WKT
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="gis-wkb-functions.html#function_st-geomfromwkb">
<code class="literal">
ST_GeomFromWKB()
</code>
,
<code class="literal">
ST_GeometryFromWKB()
</code>
</a>
</th>
<td>
Return geometry from WKB
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="spatial-relation-functions-object-shapes.html#function_st-hausdorffdistance">
<code class="literal">
ST_HausdorffDistance()
</code>
</a>
</th>
<td>
The discrete Hausdorff distance of one geometry from another
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="gis-polygon-property-functions.html#function_st-interiorringn">
<code class="literal">
ST_InteriorRingN()
</code>
</a>
</th>
<td>
Return N-th interior ring of Polygon
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="spatial-operator-functions.html#function_st-intersection">
<code class="literal">
ST_Intersection()
</code>
</a>
</th>
<td>
Return point set intersection of two geometries
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="spatial-relation-functions-object-shapes.html#function_st-intersects">
<code class="literal">
ST_Intersects()
</code>
</a>
</th>
<td>
Whether one geometry intersects another
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="gis-linestring-property-functions.html#function_st-isclosed">
<code class="literal">
ST_IsClosed()
</code>
</a>
</th>
<td>
Whether a geometry is closed and simple
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="gis-general-property-functions.html#function_st-isempty">
<code class="literal">
ST_IsEmpty()
</code>
</a>
</th>
<td>
Whether a geometry is empty
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="gis-general-property-functions.html#function_st-issimple">
<code class="literal">
ST_IsSimple()
</code>
</a>
</th>
<td>
Whether a geometry is simple
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="spatial-convenience-functions.html#function_st-isvalid">
<code class="literal">
ST_IsValid()
</code>
</a>
</th>
<td>
Whether a geometry is valid
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="spatial-geohash-functions.html#function_st-latfromgeohash">
<code class="literal">
ST_LatFromGeoHash()
</code>
</a>
</th>
<td>
Return latitude from geohash value
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="gis-point-property-functions.html#function_st-latitude">
<code class="literal">
ST_Latitude()
</code>
</a>
</th>
<td>
Return latitude of Point
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="gis-linestring-property-functions.html#function_st-length">
<code class="literal">
ST_Length()
</code>
</a>
</th>
<td>
Return length of LineString
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="gis-wkt-functions.html#function_st-linefromtext">
<code class="literal">
ST_LineFromText()
</code>
,
<code class="literal">
ST_LineStringFromText()
</code>
</a>
</th>
<td>
Construct LineString from WKT
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="gis-wkb-functions.html#function_st-linefromwkb">
<code class="literal">
ST_LineFromWKB()
</code>
,
<code class="literal">
ST_LineStringFromWKB()
</code>
</a>
</th>
<td>
Construct LineString from WKB
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="spatial-operator-functions.html#function_st-lineinterpolatepoint">
<code class="literal">
ST_LineInterpolatePoint()
</code>
</a>
</th>
<td>
The point a given percentage along a LineString
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="spatial-operator-functions.html#function_st-lineinterpolatepoints">
<code class="literal">
ST_LineInterpolatePoints()
</code>
</a>
</th>
<td>
The points a given percentage along a LineString
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="spatial-geohash-functions.html#function_st-longfromgeohash">
<code class="literal">
ST_LongFromGeoHash()
</code>
</a>
</th>
<td>
Return longitude from geohash value
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="gis-point-property-functions.html#function_st-longitude">
<code class="literal">
ST_Longitude()
</code>
</a>
</th>
<td>
Return longitude of Point
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="spatial-convenience-functions.html#function_st-makeenvelope">
<code class="literal">
ST_MakeEnvelope()
</code>
</a>
</th>
<td>
Rectangle around two points
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="gis-wkt-functions.html#function_st-mlinefromtext">
<code class="literal">
ST_MLineFromText()
</code>
,
<code class="literal">
ST_MultiLineStringFromText()
</code>
</a>
</th>
<td>
Construct MultiLineString from WKT
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="gis-wkb-functions.html#function_st-mlinefromwkb">
<code class="literal">
ST_MLineFromWKB()
</code>
,
<code class="literal">
ST_MultiLineStringFromWKB()
</code>
</a>
</th>
<td>
Construct MultiLineString from WKB
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="gis-wkt-functions.html#function_st-mpointfromtext">
<code class="literal">
ST_MPointFromText()
</code>
,
<code class="literal">
ST_MultiPointFromText()
</code>
</a>
</th>
<td>
Construct MultiPoint from WKT
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="gis-wkb-functions.html#function_st-mpointfromwkb">
<code class="literal">
ST_MPointFromWKB()
</code>
,
<code class="literal">
ST_MultiPointFromWKB()
</code>
</a>
</th>
<td>
Construct MultiPoint from WKB
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="gis-wkt-functions.html#function_st-mpolyfromtext">
<code class="literal">
ST_MPolyFromText()
</code>
,
<code class="literal">
ST_MultiPolygonFromText()
</code>
</a>
</th>
<td>
Construct MultiPolygon from WKT
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="gis-wkb-functions.html#function_st-mpolyfromwkb">
<code class="literal">
ST_MPolyFromWKB()
</code>
,
<code class="literal">
ST_MultiPolygonFromWKB()
</code>
</a>
</th>
<td>
Construct MultiPolygon from WKB
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="gis-geometrycollection-property-functions.html#function_st-numgeometries">
<code class="literal">
ST_NumGeometries()
</code>
</a>
</th>
<td>
Return number of geometries in geometry collection
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="gis-polygon-property-functions.html#function_st-numinteriorrings">
<code class="literal">
ST_NumInteriorRing()
</code>
,
<code class="literal">
ST_NumInteriorRings()
</code>
</a>
</th>
<td>
Return number of interior rings in Polygon
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="gis-linestring-property-functions.html#function_st-numpoints">
<code class="literal">
ST_NumPoints()
</code>
</a>
</th>
<td>
Return number of points in LineString
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="spatial-relation-functions-object-shapes.html#function_st-overlaps">
<code class="literal">
ST_Overlaps()
</code>
</a>
</th>
<td>
Whether one geometry overlaps another
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="spatial-operator-functions.html#function_st-pointatdistance">
<code class="literal">
ST_PointAtDistance()
</code>
</a>
</th>
<td>
The point a given distance along a LineString
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="spatial-geohash-functions.html#function_st-pointfromgeohash">
<code class="literal">
ST_PointFromGeoHash()
</code>
</a>
</th>
<td>
Convert geohash value to POINT value
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="gis-wkt-functions.html#function_st-pointfromtext">
<code class="literal">
ST_PointFromText()
</code>
</a>
</th>
<td>
Construct Point from WKT
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="gis-wkb-functions.html#function_st-pointfromwkb">
<code class="literal">
ST_PointFromWKB()
</code>
</a>
</th>
<td>
Construct Point from WKB
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="gis-linestring-property-functions.html#function_st-pointn">
<code class="literal">
ST_PointN()
</code>
</a>
</th>
<td>
Return N-th point from LineString
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="gis-wkt-functions.html#function_st-polyfromtext">
<code class="literal">
ST_PolyFromText()
</code>
,
<code class="literal">
ST_PolygonFromText()
</code>
</a>
</th>
<td>
Construct Polygon from WKT
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="gis-wkb-functions.html#function_st-polyfromwkb">
<code class="literal">
ST_PolyFromWKB()
</code>
,
<code class="literal">
ST_PolygonFromWKB()
</code>
</a>
</th>
<td>
Construct Polygon from WKB
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="spatial-convenience-functions.html#function_st-simplify">
<code class="literal">
ST_Simplify()
</code>
</a>
</th>
<td>
Return simplified geometry
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="gis-general-property-functions.html#function_st-srid">
<code class="literal">
ST_SRID()
</code>
</a>
</th>
<td>
Return spatial reference system ID for geometry
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="gis-linestring-property-functions.html#function_st-startpoint">
<code class="literal">
ST_StartPoint()
</code>
</a>
</th>
<td>
Start Point of LineString
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="gis-format-conversion-functions.html#function_st-swapxy">
<code class="literal">
ST_SwapXY()
</code>
</a>
</th>
<td>
Return argument with X/Y coordinates swapped
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="spatial-operator-functions.html#function_st-symdifference">
<code class="literal">
ST_SymDifference()
</code>
</a>
</th>
<td>
Return point set symmetric difference of two geometries
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="spatial-relation-functions-object-shapes.html#function_st-touches">
<code class="literal">
ST_Touches()
</code>
</a>
</th>
<td>
Whether one geometry touches another
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="spatial-operator-functions.html#function_st-transform">
<code class="literal">
ST_Transform()
</code>
</a>
</th>
<td>
Transform coordinates of geometry
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="spatial-operator-functions.html#function_st-union">
<code class="literal">
ST_Union()
</code>
</a>
</th>
<td>
Return point set union of two geometries
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="spatial-convenience-functions.html#function_st-validate">
<code class="literal">
ST_Validate()
</code>
</a>
</th>
<td>
Return validated geometry
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="spatial-relation-functions-object-shapes.html#function_st-within">
<code class="literal">
ST_Within()
</code>
</a>
</th>
<td>
Whether one geometry is within another
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="gis-point-property-functions.html#function_st-x">
<code class="literal">
ST_X()
</code>
</a>
</th>
<td>
Return X coordinate of Point
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="gis-point-property-functions.html#function_st-y">
<code class="literal">
ST_Y()
</code>
</a>
</th>
<td>
Return Y coordinate of Point
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="encryption-functions.html#function_statement-digest">
<code class="literal">
STATEMENT_DIGEST()
</code>
</a>
</th>
<td>
Compute statement digest hash value
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="encryption-functions.html#function_statement-digest-text">
<code class="literal">
STATEMENT_DIGEST_TEXT()
</code>
</a>
</th>
<td>
Compute normalized statement digest
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="aggregate-functions.html#function_std">
<code class="literal">
STD()
</code>
</a>
</th>
<td>
Return the population standard deviation
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="aggregate-functions.html#function_stddev">
<code class="literal">
STDDEV()
</code>
</a>
</th>
<td>
Return the population standard deviation
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="aggregate-functions.html#function_stddev-pop">
<code class="literal">
STDDEV_POP()
</code>
</a>
</th>
<td>
Return the population standard deviation
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="aggregate-functions.html#function_stddev-samp">
<code class="literal">
STDDEV_SAMP()
</code>
</a>
</th>
<td>
Return the sample standard deviation
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="date-and-time-functions.html#function_str-to-date">
<code class="literal">
STR_TO_DATE()
</code>
</a>
</th>
<td>
Convert a string to a date
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="string-comparison-functions.html#function_strcmp">
<code class="literal">
STRCMP()
</code>
</a>
</th>
<td>
Compare two strings
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="date-and-time-functions.html#function_subdate">
<code class="literal">
SUBDATE()
</code>
</a>
</th>
<td>
Synonym for DATE_SUB() when invoked with three arguments
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="string-functions.html#function_substr">
<code class="literal">
SUBSTR()
</code>
</a>
</th>
<td>
Return the substring as specified
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="string-functions.html#function_substring">
<code class="literal">
SUBSTRING()
</code>
</a>
</th>
<td>
Return the substring as specified
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="string-functions.html#function_substring-index">
<code class="literal">
SUBSTRING_INDEX()
</code>
</a>
</th>
<td>
Return a substring from a string before the specified number of
occurrences of the delimiter
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="date-and-time-functions.html#function_subtime">
<code class="literal">
SUBTIME()
</code>
</a>
</th>
<td>
Subtract times
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="aggregate-functions.html#function_sum">
<code class="literal">
SUM()
</code>
</a>
</th>
<td>
Return the sum
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="date-and-time-functions.html#function_sysdate">
<code class="literal">
SYSDATE()
</code>
</a>
</th>
<td>
Return the time at which the function executes
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="information-functions.html#function_system-user">
<code class="literal">
SYSTEM_USER()
</code>
</a>
</th>
<td>
Synonym for USER()
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="mathematical-functions.html#function_tan">
<code class="literal">
TAN()
</code>
</a>
</th>
<td>
Return the tangent of the argument
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="date-and-time-functions.html#function_time">
<code class="literal">
TIME()
</code>
</a>
</th>
<td>
Extract the time portion of the expression passed
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="date-and-time-functions.html#function_time-format">
<code class="literal">
TIME_FORMAT()
</code>
</a>
</th>
<td>
Format as time
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="date-and-time-functions.html#function_time-to-sec">
<code class="literal">
TIME_TO_SEC()
</code>
</a>
</th>
<td>
Return the argument converted to seconds
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="date-and-time-functions.html#function_timediff">
<code class="literal">
TIMEDIFF()
</code>
</a>
</th>
<td>
Subtract time
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="date-and-time-functions.html#function_timestamp">
<code class="literal">
TIMESTAMP()
</code>
</a>
</th>
<td>
With a single argument, this function returns the date or datetime
expression; with two arguments, the sum of the arguments
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="date-and-time-functions.html#function_timestampadd">
<code class="literal">
TIMESTAMPADD()
</code>
</a>
</th>
<td>
Add an interval to a datetime expression
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="date-and-time-functions.html#function_timestampdiff">
<code class="literal">
TIMESTAMPDIFF()
</code>
</a>
</th>
<td>
Return the difference of two datetime expressions, using the units
specified
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="date-and-time-functions.html#function_to-days">
<code class="literal">
TO_DAYS()
</code>
</a>
</th>
<td>
Return the date argument converted to days
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="date-and-time-functions.html#function_to-seconds">
<code class="literal">
TO_SECONDS()
</code>
</a>
</th>
<td>
Return the date or datetime argument converted to seconds since
Year 0
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="string-functions.html#function_trim">
<code class="literal">
TRIM()
</code>
</a>
</th>
<td>
Remove leading and trailing spaces
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="mathematical-functions.html#function_truncate">
<code class="literal">
TRUNCATE()
</code>
</a>
</th>
<td>
Truncate to specified number of decimal places
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="string-functions.html#function_ucase">
<code class="literal">
UCASE()
</code>
</a>
</th>
<td>
Synonym for UPPER()
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="encryption-functions.html#function_uncompress">
<code class="literal">
UNCOMPRESS()
</code>
</a>
</th>
<td>
Uncompress a string compressed
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="encryption-functions.html#function_uncompressed-length">
<code class="literal">
UNCOMPRESSED_LENGTH()
</code>
</a>
</th>
<td>
Return the length of a string before compression
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="string-functions.html#function_unhex">
<code class="literal">
UNHEX()
</code>
</a>
</th>
<td>
Return a string containing hex representation of a number
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="date-and-time-functions.html#function_unix-timestamp">
<code class="literal">
UNIX_TIMESTAMP()
</code>
</a>
</th>
<td>
Return a Unix timestamp
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="xml-functions.html#function_updatexml">
<code class="literal">
UpdateXML()
</code>
</a>
</th>
<td>
Return replaced XML fragment
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="string-functions.html#function_upper">
<code class="literal">
UPPER()
</code>
</a>
</th>
<td>
Convert to uppercase
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="information-functions.html#function_user">
<code class="literal">
USER()
</code>
</a>
</th>
<td>
The user name and host name provided by the client
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="date-and-time-functions.html#function_utc-date">
<code class="literal">
UTC_DATE()
</code>
</a>
</th>
<td>
Return the current UTC date
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="date-and-time-functions.html#function_utc-time">
<code class="literal">
UTC_TIME()
</code>
</a>
</th>
<td>
Return the current UTC time
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="date-and-time-functions.html#function_utc-timestamp">
<code class="literal">
UTC_TIMESTAMP()
</code>
</a>
</th>
<td>
Return the current UTC date and time
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="miscellaneous-functions.html#function_uuid">
<code class="literal">
UUID()
</code>
</a>
</th>
<td>
Return a Universal Unique Identifier (UUID)
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="miscellaneous-functions.html#function_uuid-short">
<code class="literal">
UUID_SHORT()
</code>
</a>
</th>
<td>
Return an integer-valued universal identifier
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="miscellaneous-functions.html#function_uuid-to-bin">
<code class="literal">
UUID_TO_BIN()
</code>
</a>
</th>
<td>
Convert string UUID to binary
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="encryption-functions.html#function_validate-password-strength">
<code class="literal">
VALIDATE_PASSWORD_STRENGTH()
</code>
</a>
</th>
<td>
Determine strength of password
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="miscellaneous-functions.html#function_values">
<code class="literal">
VALUES()
</code>
</a>
</th>
<td>
Define the values to be used during an INSERT
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="aggregate-functions.html#function_var-pop">
<code class="literal">
VAR_POP()
</code>
</a>
</th>
<td>
Return the population standard variance
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="aggregate-functions.html#function_var-samp">
<code class="literal">
VAR_SAMP()
</code>
</a>
</th>
<td>
Return the sample variance
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="aggregate-functions.html#function_variance">
<code class="literal">
VARIANCE()
</code>
</a>
</th>
<td>
Return the population standard variance
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="information-functions.html#function_version">
<code class="literal">
VERSION()
</code>
</a>
</th>
<td>
Return a string that indicates the MySQL server version
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="gtid-functions.html#function_wait-for-executed-gtid-set">
<code class="literal">
WAIT_FOR_EXECUTED_GTID_SET()
</code>
</a>
</th>
<td>
Wait until the given GTIDs have executed on the replica.
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="date-and-time-functions.html#function_week">
<code class="literal">
WEEK()
</code>
</a>
</th>
<td>
Return the week number
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="date-and-time-functions.html#function_weekday">
<code class="literal">
WEEKDAY()
</code>
</a>
</th>
<td>
Return the weekday index
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="date-and-time-functions.html#function_weekofyear">
<code class="literal">
WEEKOFYEAR()
</code>
</a>
</th>
<td>
Return the calendar week of the date (1-53)
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="string-functions.html#function_weight-string">
<code class="literal">
WEIGHT_STRING()
</code>
</a>
</th>
<td>
Return the weight string for a string
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="logical-operators.html#operator_xor">
<code class="literal">
XOR
</code>
</a>
</th>
<td>
Logical XOR
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="date-and-time-functions.html#function_year">
<code class="literal">
YEAR()
</code>
</a>
</th>
<td>
Return the year
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="date-and-time-functions.html#function_yearweek">
<code class="literal">
YEARWEEK()
</code>
</a>
</th>
<td>
Return the year and week
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="bit-functions.html#operator_bitwise-or">
<code class="literal">
|
</code>
</a>
</th>
<td>
Bitwise OR
</td>
<td>
</td>
</tr>
<tr>
<th scope="row">
<a class="link" href="bit-functions.html#operator_bitwise-invert">
<code class="literal">
~
</code>
</a>
</th>
<td>
Bitwise inversion
</td>
<td>
</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: 405.156px;">
Name
</th>
<th style="width: 243.688px;">
Description
</th>
<th style="width: 89.1562px;">
Deprecated
</th>
</tr>
</thead>
</table>
</div>
</div>
<br class="table-break"/>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/innodb-transaction-isolation-levels.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="innodb-transaction-isolation-levels">
</a>
17.7.2.1 Transaction Isolation Levels
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045164403328">
</a>
<a class="indexterm" name="idm46045164401936">
</a>
<p>
Transaction isolation is one of the foundations of database
processing. Isolation is the I in the acronym
<a class="link" href="glossary.html#glos_acid" title="ACID">
ACID
</a>
; the isolation level is
the setting that fine-tunes the balance between performance and
reliability, consistency, and reproducibility of results when
multiple transactions are making changes and performing queries
at the same time.
</p>
<p>
<code class="literal">
InnoDB
</code>
offers all four transaction isolation
levels described by the SQL:1992 standard:
<a class="link" href="innodb-transaction-isolation-levels.html#isolevel_read-uncommitted">
<code class="literal">
READ UNCOMMITTED
</code>
</a>
,
<a class="link" href="innodb-transaction-isolation-levels.html#isolevel_read-committed">
<code class="literal">
READ COMMITTED
</code>
</a>
,
<a class="link" href="innodb-transaction-isolation-levels.html#isolevel_repeatable-read">
<code class="literal">
REPEATABLE READ
</code>
</a>
, and
<a class="link" href="innodb-transaction-isolation-levels.html#isolevel_serializable">
<code class="literal">
SERIALIZABLE
</code>
</a>
. The default
isolation level for
<code class="literal">
InnoDB
</code>
is
<a class="link" href="innodb-transaction-isolation-levels.html#isolevel_repeatable-read">
<code class="literal">
REPEATABLE READ
</code>
</a>
.
</p>
<p>
A user can change the isolation level for a single session or
for all subsequent connections with the
<a class="link" href="set-transaction.html" title="15.3.7 SET TRANSACTION Statement">
<code class="literal">
SET
TRANSACTION
</code>
</a>
statement. To set the server's default
isolation level for all connections, use the
<a class="link" href="server-options.html#option_mysqld_transaction-isolation">
<code class="option">
--transaction-isolation
</code>
</a>
option on
the command line or in an option file. For detailed information
about isolation levels and level-setting syntax, see
<a class="xref" href="set-transaction.html" title="15.3.7 SET TRANSACTION Statement">
Section 15.3.7, “SET TRANSACTION Statement”
</a>
.
</p>
<p>
<code class="literal">
InnoDB
</code>
supports each of the transaction
isolation levels described here using different
<a class="link" href="glossary.html#glos_locking" title="locking">
locking
</a>
strategies. You can
enforce a high degree of consistency with the default
<a class="link" href="innodb-transaction-isolation-levels.html#isolevel_repeatable-read">
<code class="literal">
REPEATABLE READ
</code>
</a>
level, for
operations on crucial data where
<a class="link" href="glossary.html#glos_acid" title="ACID">
ACID
</a>
compliance is important.
Or you can relax the consistency rules with
<a class="link" href="innodb-transaction-isolation-levels.html#isolevel_read-committed">
<code class="literal">
READ COMMITTED
</code>
</a>
or even
<a class="link" href="innodb-transaction-isolation-levels.html#isolevel_read-uncommitted">
<code class="literal">
READ UNCOMMITTED
</code>
</a>
, in
situations such as bulk reporting where precise consistency and
repeatable results are less important than minimizing the amount
of overhead for locking.
<a class="link" href="innodb-transaction-isolation-levels.html#isolevel_serializable">
<code class="literal">
SERIALIZABLE
</code>
</a>
enforces even
stricter rules than
<a class="link" href="innodb-transaction-isolation-levels.html#isolevel_repeatable-read">
<code class="literal">
REPEATABLE
READ
</code>
</a>
, and is used mainly in specialized situations,
such as with
<a class="link" href="glossary.html#glos_xa" title="XA">
XA
</a>
transactions and
for troubleshooting issues with concurrency and
<a class="link" href="glossary.html#glos_deadlock" title="deadlock">
deadlocks
</a>
.
</p>
<p>
The following list describes how MySQL supports the different
transaction levels. The list goes from the most commonly used
level to the least used.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a name="isolevel_repeatable-read">
</a>
<code class="literal">
REPEATABLE READ
</code>
</p>
<a class="indexterm" name="idm46045164378160">
</a>
<a class="indexterm" name="idm46045164376768">
</a>
<p>
This is the default isolation level for
<code class="literal">
InnoDB
</code>
.
<a class="link" href="glossary.html#glos_consistent_read" title="consistent read">
Consistent reads
</a>
within the same transaction read the
<a class="link" href="glossary.html#glos_snapshot" title="snapshot">
snapshot
</a>
established by
the first read. This means that if you issue several plain
(nonlocking)
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
statements within the same transaction, these
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
statements are
consistent also with respect to each other. See
<a class="xref" href="innodb-consistent-read.html" title="17.7.2.3 Consistent Nonlocking Reads">
Section 17.7.2.3, “Consistent Nonlocking Reads”
</a>
.
</p>
<p>
For
<a class="link" href="glossary.html#glos_locking_read" title="locking read">
locking reads
</a>
(
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
with
<code class="literal">
FOR
UPDATE
</code>
or
<code class="literal">
FOR SHARE
</code>
),
<a class="link" href="update.html" title="15.2.17 UPDATE Statement">
<code class="literal">
UPDATE
</code>
</a>
, and
<a class="link" href="delete.html" title="15.2.2 DELETE Statement">
<code class="literal">
DELETE
</code>
</a>
statements, locking
depends on whether the statement uses a unique index with a
unique search condition, or a range-type search condition.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
For a unique index with a unique search condition,
<code class="literal">
InnoDB
</code>
locks only the index record
found, not the
<a class="link" href="glossary.html#glos_gap" title="gap">
gap
</a>
before it.
</p>
</li>
<li class="listitem">
<p>
For other search conditions,
<code class="literal">
InnoDB
</code>
locks the index range scanned, using
<a class="link" href="glossary.html#glos_gap_lock" title="gap lock">
gap locks
</a>
or
<a class="link" href="glossary.html#glos_next_key_lock" title="next-key lock">
next-key locks
</a>
to block insertions by other sessions into the gaps
covered by the range. For information about gap locks
and next-key locks, see
<a class="xref" href="innodb-locking.html" title="17.7.1 InnoDB Locking">
Section 17.7.1, “InnoDB Locking”
</a>
.
</p>
</li>
</ul>
</div>
<p>
It is not recommended to mix locking statements
(
<a class="link" href="update.html" title="15.2.17 UPDATE Statement">
<code class="literal">
UPDATE
</code>
</a>
,
<a class="link" href="insert.html" title="15.2.7 INSERT Statement">
<code class="literal">
INSERT
</code>
</a>
,
<a class="link" href="delete.html" title="15.2.2 DELETE Statement">
<code class="literal">
DELETE
</code>
</a>
, or
<code class="literal">
SELECT
... FOR ...
</code>
) with non-locking
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
statements in a single
<a class="link" href="innodb-transaction-isolation-levels.html#isolevel_repeatable-read">
<code class="literal">
REPEATABLE READ
</code>
</a>
transaction, because typically in such cases you want
<a class="link" href="innodb-transaction-isolation-levels.html#isolevel_serializable">
<code class="literal">
SERIALIZABLE
</code>
</a>
. This is
because a non-locking
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
statement presents the state of the database from a read
view which consists of transactions committed before the
read view was created, and before the current transaction's
own writes, while the locking statements use the most recent
state of the database to use locking. In general, these two
different table states are inconsistent with each other and
difficult to parse.
</p>
</li>
<li class="listitem">
<p>
<a name="isolevel_read-committed">
</a>
<code class="literal">
READ COMMITTED
</code>
</p>
<a class="indexterm" name="idm46045164348480">
</a>
<a class="indexterm" name="idm46045164347088">
</a>
<p>
Each consistent read, even within the same transaction, sets
and reads its own fresh snapshot. For information about
consistent reads, see
<a class="xref" href="innodb-consistent-read.html" title="17.7.2.3 Consistent Nonlocking Reads">
Section 17.7.2.3, “Consistent Nonlocking Reads”
</a>
.
</p>
<p>
For locking reads (
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
with
<code class="literal">
FOR UPDATE
</code>
or
<code class="literal">
FOR
SHARE
</code>
),
<a class="link" href="update.html" title="15.2.17 UPDATE Statement">
<code class="literal">
UPDATE
</code>
</a>
statements, and
<a class="link" href="delete.html" title="15.2.2 DELETE Statement">
<code class="literal">
DELETE
</code>
</a>
statements,
<code class="literal">
InnoDB
</code>
locks only index
records, not the gaps before them, and thus permits the free
insertion of new records next to locked records. Gap locking
is only used for foreign-key constraint checking and
duplicate-key checking.
</p>
<p>
Because gap locking is disabled, phantom row problems may
occur, as other sessions can insert new rows into the gaps.
For information about phantom rows, see
<a class="xref" href="innodb-next-key-locking.html" title="17.7.4 Phantom Rows">
Section 17.7.4, “Phantom Rows”
</a>
.
</p>
<p>
Only row-based binary logging is supported with the
<code class="literal">
READ COMMITTED
</code>
isolation level. If you
use
<code class="literal">
READ COMMITTED
</code>
with
<a class="link" href="replication-options-binary-log.html#sysvar_binlog_format">
<code class="literal">
binlog_format=MIXED
</code>
</a>
, the
server automatically uses row-based logging.
</p>
<p>
Using
<code class="literal">
READ COMMITTED
</code>
has additional
effects:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
For
<a class="link" href="update.html" title="15.2.17 UPDATE Statement">
<code class="literal">
UPDATE
</code>
</a>
or
<a class="link" href="delete.html" title="15.2.2 DELETE Statement">
<code class="literal">
DELETE
</code>
</a>
statements,
<code class="literal">
InnoDB
</code>
holds locks only for rows that
it updates or deletes. Record locks for nonmatching rows
are released after MySQL has evaluated the
<code class="literal">
WHERE
</code>
condition. This greatly reduces
the probability of deadlocks, but they can still happen.
</p>
</li>
<li class="listitem">
<p>
For
<a class="link" href="update.html" title="15.2.17 UPDATE Statement">
<code class="literal">
UPDATE
</code>
</a>
statements, if
a row is already locked,
<code class="literal">
InnoDB
</code>
performs a
<span class="quote">
“
<span class="quote">
semi-consistent
</span>
”
</span>
read,
returning the latest committed version to MySQL so that
MySQL can determine whether the row matches the
<code class="literal">
WHERE
</code>
condition of the
<a class="link" href="update.html" title="15.2.17 UPDATE Statement">
<code class="literal">
UPDATE
</code>
</a>
. If the row
matches (must be updated), MySQL reads the row again and
this time
<code class="literal">
InnoDB
</code>
either locks it or
waits for a lock on it.
</p>
</li>
</ul>
</div>
<p>
Consider the table created and populated like this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa45664830"><div class="copy-help left">Press ⌘+C to 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>a <span class="token datatype">INT</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span><span class="token punctuation">,</span> b <span class="token datatype">INT</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 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">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">2</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 number">3</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">4</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 number">5</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">COMMIT</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
In this case, the table has no indexes, so searches and
index scans use the hidden clustered index for record
locking (see
<a class="xref" href="innodb-index-types.html" title="17.6.2.1 Clustered and Secondary Indexes">
Section 17.6.2.1, “Clustered and Secondary Indexes”
</a>
) rather
than indexed columns.
</p>
<p>
Suppose that one session performs an
<a class="link" href="update.html" title="15.2.17 UPDATE Statement">
<code class="literal">
UPDATE
</code>
</a>
using these
statements:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa10568338"><div class="copy-help left">Press ⌘+C to 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"># Session A</span>
<span class="token keyword">START</span> <span class="token keyword">TRANSACTION</span><span class="token punctuation">;</span>
<span class="token keyword">UPDATE</span> t <span class="token keyword">SET</span> b <span class="token operator">=</span> <span class="token number">5</span> <span class="token keyword">WHERE</span> b <span class="token operator">=</span> <span class="token number">3</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Suppose also that a second session performs an
<a class="link" href="update.html" title="15.2.17 UPDATE Statement">
<code class="literal">
UPDATE
</code>
</a>
by executing these
statements following those of the first session:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa82696483"><div class="copy-help left">Press ⌘+C to 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"># Session B</span>
<span class="token keyword">UPDATE</span> t <span class="token keyword">SET</span> b <span class="token operator">=</span> <span class="token number">4</span> <span class="token keyword">WHERE</span> b <span class="token operator">=</span> <span class="token number">2</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
As
<a class="link" href="innodb-storage-engine.html" title="Chapter 17 The InnoDB Storage Engine">
<code class="literal">
InnoDB
</code>
</a>
executes each
<a class="link" href="update.html" title="15.2.17 UPDATE Statement">
<code class="literal">
UPDATE
</code>
</a>
, it first acquires an
exclusive lock for each row, and then determines whether to
modify it. If
<a class="link" href="innodb-storage-engine.html" title="Chapter 17 The InnoDB Storage Engine">
<code class="literal">
InnoDB
</code>
</a>
does not
modify the row, it releases the lock. Otherwise,
<a class="link" href="innodb-storage-engine.html" title="Chapter 17 The InnoDB Storage Engine">
<code class="literal">
InnoDB
</code>
</a>
retains the lock until
the end of the transaction. This affects transaction
processing as follows.
</p>
<p>
When using the default
<code class="literal">
REPEATABLE READ
</code>
isolation level, the first
<a class="link" href="update.html" title="15.2.17 UPDATE Statement">
<code class="literal">
UPDATE
</code>
</a>
acquires an x-lock on
each row that it reads and does not release any of them:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-none"><div class="docs-select-all right" id="sa22680521"><div class="copy-help left">Press ⌘+C to 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">x-lock(1,2); retain x-lock
x-lock(2,3); update(2,3) to (2,5); retain x-lock
x-lock(3,2); retain x-lock
x-lock(4,3); update(4,3) to (4,5); retain x-lock
x-lock(5,2); retain x-lock</code></pre>
</div>
<p>
The second
<a class="link" href="update.html" title="15.2.17 UPDATE Statement">
<code class="literal">
UPDATE
</code>
</a>
blocks as
soon as it tries to acquire any locks (because first update
has retained locks on all rows), and does not proceed until
the first
<a class="link" href="update.html" title="15.2.17 UPDATE Statement">
<code class="literal">
UPDATE
</code>
</a>
commits or
rolls back:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-none"><div class="docs-select-all right" id="sa70066600"><div class="copy-help left">Press ⌘+C to 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">x-lock(1,2); block and wait for first UPDATE to commit or roll back</code></pre>
</div>
<p>
If
<code class="literal">
READ COMMITTED
</code>
is used instead, the
first
<a class="link" href="update.html" title="15.2.17 UPDATE Statement">
<code class="literal">
UPDATE
</code>
</a>
acquires an
x-lock on each row that it reads and releases those for rows
that it does not modify:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-none"><div class="docs-select-all right" id="sa17028125"><div class="copy-help left">Press ⌘+C to 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">x-lock(1,2); unlock(1,2)
x-lock(2,3); update(2,3) to (2,5); retain x-lock
x-lock(3,2); unlock(3,2)
x-lock(4,3); update(4,3) to (4,5); retain x-lock
x-lock(5,2); unlock(5,2)</code></pre>
</div>
<p>
For the second
<code class="literal">
UPDATE
</code>
,
<code class="literal">
InnoDB
</code>
does a
<span class="quote">
“
<span class="quote">
semi-consistent
</span>
”
</span>
read, returning the latest
committed version of each row that it reads to MySQL so that
MySQL can determine whether the row matches the
<code class="literal">
WHERE
</code>
condition of the
<a class="link" href="update.html" title="15.2.17 UPDATE Statement">
<code class="literal">
UPDATE
</code>
</a>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-none"><div class="docs-select-all right" id="sa45028722"><div class="copy-help left">Press ⌘+C to 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">x-lock(1,2); update(1,2) to (1,4); retain x-lock
x-lock(2,3); unlock(2,3)
x-lock(3,2); update(3,2) to (3,4); retain x-lock
x-lock(4,3); unlock(4,3)
x-lock(5,2); update(5,2) to (5,4); retain x-lock</code></pre>
</div>
<p>
However, if the
<code class="literal">
WHERE
</code>
condition includes
an indexed column, and
<code class="literal">
InnoDB
</code>
uses the
index, only the indexed column is considered when taking and
retaining record locks. In the following example, the first
<a class="link" href="update.html" title="15.2.17 UPDATE Statement">
<code class="literal">
UPDATE
</code>
</a>
takes and retains an
x-lock on each row where b = 2. The second
<a class="link" href="update.html" title="15.2.17 UPDATE Statement">
<code class="literal">
UPDATE
</code>
</a>
blocks when it tries
to acquire x-locks on the same records, as it also uses the
index defined on column b.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa78443093"><div class="copy-help left">Press ⌘+C to 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>a <span class="token datatype">INT</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</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">INDEX</span> <span class="token punctuation">(</span>b<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 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">1</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 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 number">4</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">COMMIT</span><span class="token punctuation">;</span>
<span class="token comment" spellcheck="true"># Session A</span>
<span class="token keyword">START</span> <span class="token keyword">TRANSACTION</span><span class="token punctuation">;</span>
<span class="token keyword">UPDATE</span> t <span class="token keyword">SET</span> b <span class="token operator">=</span> <span class="token number">3</span> <span class="token keyword">WHERE</span> b <span class="token operator">=</span> <span class="token number">2</span> <span class="token operator">AND</span> c <span class="token operator">=</span> <span class="token number">3</span><span class="token punctuation">;</span>
<span class="token comment" spellcheck="true"># Session B</span>
<span class="token keyword">UPDATE</span> t <span class="token keyword">SET</span> b <span class="token operator">=</span> <span class="token number">4</span> <span class="token keyword">WHERE</span> b <span class="token operator">=</span> <span class="token number">2</span> <span class="token operator">AND</span> c <span class="token operator">=</span> <span class="token number">4</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
The
<code class="literal">
READ COMMITTED
</code>
isolation level can be
set at startup or changed at runtime. At runtime, it can be
set globally for all sessions, or individually per session.
</p>
</li>
<li class="listitem">
<p>
<a name="isolevel_read-uncommitted">
</a>
<code class="literal">
READ UNCOMMITTED
</code>
</p>
<a class="indexterm" name="idm46045164289040">
</a>
<a class="indexterm" name="idm46045164287648">
</a>
<p>
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
statements are
performed in a nonlocking fashion, but a possible earlier
version of a row might be used. Thus, using this isolation
level, such reads are not consistent. This is also called a
<a class="link" href="glossary.html#glos_dirty_read" title="dirty read">
dirty read
</a>
.
Otherwise, this isolation level works like
<a class="link" href="innodb-transaction-isolation-levels.html#isolevel_read-committed">
<code class="literal">
READ COMMITTED
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="isolevel_serializable">
</a>
<code class="literal">
SERIALIZABLE
</code>
</p>
<a class="indexterm" name="idm46045164281296">
</a>
<a class="indexterm" name="idm46045164279904">
</a>
<p>
This level is like
<a class="link" href="innodb-transaction-isolation-levels.html#isolevel_repeatable-read">
<code class="literal">
REPEATABLE
READ
</code>
</a>
, but
<code class="literal">
InnoDB
</code>
implicitly
converts all plain
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
statements to
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
... FOR SHARE
</code>
</a>
if
<a class="link" href="server-system-variables.html#sysvar_autocommit">
<code class="literal">
autocommit
</code>
</a>
is disabled. If
<a class="link" href="server-system-variables.html#sysvar_autocommit">
<code class="literal">
autocommit
</code>
</a>
is enabled, the
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
is its own
transaction. It therefore is known to be read only and can
be serialized if performed as a consistent (nonlocking) read
and need not block for other transactions. (To force a plain
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
to block if other
transactions have modified the selected rows, disable
<a class="link" href="server-system-variables.html#sysvar_autocommit">
<code class="literal">
autocommit
</code>
</a>
.)
</p>
<p>
DML operations that read data from MySQL grant tables
(through a join list or subquery) but do not modify them do
not acquire read locks on the MySQL grant tables, regardless
of the isolation level. For more information, see
<a class="xref" href="grant-tables.html#grant-tables-concurrency" title="Grant Table Concurrency">
Grant Table Concurrency
</a>
.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/information-schema-applicable-roles-table.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="information-schema-applicable-roles-table">
</a>
28.3.3 The INFORMATION_SCHEMA APPLICABLE_ROLES Table
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045080361792">
</a>
<p>
The
<a class="link" href="information-schema-applicable-roles-table.html" title="28.3.3 The INFORMATION_SCHEMA APPLICABLE_ROLES Table">
<code class="literal">
APPLICABLE_ROLES
</code>
</a>
table provides
information about the roles that are applicable for the current
user.
</p>
<p>
The
<a class="link" href="information-schema-applicable-roles-table.html" title="28.3.3 The INFORMATION_SCHEMA APPLICABLE_ROLES Table">
<code class="literal">
APPLICABLE_ROLES
</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">
USER
</code>
</p>
<p>
The user name part of the current user account.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
HOST
</code>
</p>
<p>
The host name part of the current user account.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
GRANTEE
</code>
</p>
<p>
The user name part of the account to which the role is
granted.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
GRANTEE_HOST
</code>
</p>
<p>
The host name part of the account to which the role is
granted.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
ROLE_NAME
</code>
</p>
<p>
The user name part of the granted role.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
ROLE_HOST
</code>
</p>
<p>
The host name part of the granted role.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
IS_GRANTABLE
</code>
</p>
<p>
<code class="literal">
YES
</code>
or
<code class="literal">
NO
</code>
, depending on
whether the role is grantable to other accounts.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
IS_DEFAULT
</code>
</p>
<p>
<code class="literal">
YES
</code>
or
<code class="literal">
NO
</code>
, depending on
whether the role is a default role.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
IS_MANDATORY
</code>
</p>
<p>
<code class="literal">
YES
</code>
or
<code class="literal">
NO
</code>
, depending on
whether the role is mandatory.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/show-privileges.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="show-privileges">
</a>
15.7.7.28 SHOW PRIVILEGES Statement
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045170002240">
</a>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa561572"><div class="copy-help left">Press ⌘+C to 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 keyword">PRIVILEGES</span></code></pre>
</div>
<p>
<a class="link" href="show-privileges.html" title="15.7.7.28 SHOW PRIVILEGES Statement">
<code class="literal">
SHOW PRIVILEGES
</code>
</a>
shows the list of
system privileges that the MySQL server supports. The privileges
displayed include all static privileges, and all currently
registered dynamic privileges.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa96387338"><div class="copy-help left">Press ⌘+C to 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">PRIVILEGES</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>
Privilege<span class="token punctuation">:</span> Alter
Context<span class="token punctuation">:</span> Tables
Comment<span class="token punctuation">:</span> To alter the table
<span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span 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>
Privilege<span class="token punctuation">:</span> Alter routine
Context<span class="token punctuation">:</span> Functions,Procedures
Comment<span class="token punctuation">:</span> To alter or drop stored functions/procedures
<span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span 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>
Privilege<span class="token punctuation">:</span> Create
Context<span class="token punctuation">:</span> Databases,Tables,Indexes
Comment<span class="token punctuation">:</span> To create new databases and tables
<span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span 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>
Privilege<span class="token punctuation">:</span> Create routine
Context<span class="token punctuation">:</span> Databases
Comment<span class="token punctuation">:</span> To use CREATE FUNCTION/PROCEDURE
<span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span 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>
Privilege<span class="token punctuation">:</span> Create role
Context<span class="token punctuation">:</span> Server Admin
Comment<span class="token punctuation">:</span> To create new roles
...</span></code></pre>
</div>
<p>
Privileges belonging to a specific user are displayed by the
<a class="link" href="show-grants.html" title="15.7.7.22 SHOW GRANTS Statement">
<code class="literal">
SHOW GRANTS
</code>
</a>
statement. See
<a class="xref" href="show-grants.html" title="15.7.7.22 SHOW GRANTS Statement">
Section 15.7.7.22, “SHOW GRANTS Statement”
</a>
, for more information.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/create-table-generated-columns.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="create-table-generated-columns">
</a>
15.1.20.8 CREATE TABLE and Generated Columns
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045184799888">
</a>
<p>
<a class="link" href="create-table.html" title="15.1.20 CREATE TABLE Statement">
<code class="literal">
CREATE TABLE
</code>
</a>
supports the
specification of generated columns. Values of a generated column
are computed from an expression included in the column
definition.
</p>
<p>
Generated columns are also supported by the
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
storage engine.
</p>
<p>
The following simple example shows a table that stores the
lengths of the sides of right triangles in the
<code class="literal">
sidea
</code>
and
<code class="literal">
sideb
</code>
columns,
and computes the length of the hypotenuse in
<code class="literal">
sidec
</code>
(the square root of the sums of the
squares of the other sides):
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa21017922"><div class="copy-help left">Press ⌘+C to 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> triangle <span class="token punctuation">(</span>
sidea <span class="token datatype">DOUBLE</span><span class="token punctuation">,</span>
sideb <span class="token datatype">DOUBLE</span><span class="token punctuation">,</span>
sidec <span class="token datatype">DOUBLE</span> <span class="token keyword">AS</span> <span class="token punctuation">(</span><span class="token function">SQRT</span><span class="token punctuation">(</span>sidea <span class="token operator">*</span> sidea <span class="token operator">+</span> sideb <span class="token operator">*</span> sideb<span class="token punctuation">)</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> triangle <span class="token punctuation">(</span>sidea<span class="token punctuation">,</span> sideb<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</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 number">6</span><span class="token punctuation">,</span><span class="token number">8</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Selecting from the table yields this result:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa69452357"><div class="copy-help left">Press ⌘+C to 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> triangle<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> sidea <span class="token punctuation">|</span> sideb <span class="token punctuation">|</span> sidec <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> 1 <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> 1.4142135623730951 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 3 <span class="token punctuation">|</span> 4 <span class="token punctuation">|</span> 5 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 6 <span class="token punctuation">|</span> 8 <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 class="token punctuation">-</span><span class="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>
Any application that uses the
<code class="literal">
triangle
</code>
table
has access to the hypotenuse values without having to specify
the expression that calculates them.
</p>
<p>
Generated column definitions have this syntax:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa75877956"><div class="copy-help left">Press ⌘+C to 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">col_name</em> <em class="replaceable">data_type</em> <span class="token punctuation">[</span><span class="token keyword">GENERATED</span> <span class="token keyword">ALWAYS</span><span class="token punctuation">]</span> <span class="token keyword">AS</span> <span class="token punctuation">(</span><em class="replaceable">expr</em><span class="token punctuation">)</span>
<span class="token punctuation">[</span><span class="token keyword">VIRTUAL</span> <span class="token operator">|</span> <span class="token keyword">STORED</span><span class="token punctuation">]</span> <span class="token punctuation">[</span><span class="token operator">NOT</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 punctuation">[</span><span class="token keyword">UNIQUE</span> <span class="token punctuation">[</span><span class="token keyword">KEY</span><span class="token punctuation">]</span><span class="token punctuation">]</span> <span class="token punctuation">[</span><span class="token punctuation">[</span><span class="token keyword">PRIMARY</span><span class="token punctuation">]</span> <span class="token keyword">KEY</span><span class="token punctuation">]</span>
<span class="token punctuation">[</span><span class="token keyword">COMMENT</span> <span class="token string">'<em class="replaceable">string</em>'</span><span class="token punctuation">]</span></code></pre>
</div>
<p>
<code class="literal">
AS (
<em class="replaceable">
<code>
expr
</code>
</em>
)
</code>
indicates that the column is generated and defines the
expression used to compute column values.
<code class="literal">
AS
</code>
may be preceded by
<code class="literal">
GENERATED ALWAYS
</code>
to make
the generated nature of the column more explicit. Constructs
that are permitted or prohibited in the expression are discussed
later.
</p>
<p>
The
<code class="literal">
VIRTUAL
</code>
or
<code class="literal">
STORED
</code>
keyword indicates how column values are stored, which has
implications for column use:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
VIRTUAL
</code>
: Column values are not stored,
but are evaluated when rows are read, immediately after any
<code class="literal">
BEFORE
</code>
triggers. A virtual column takes
no storage.
</p>
<p>
<code class="literal">
InnoDB
</code>
supports secondary indexes on
virtual columns. See
<a class="xref" href="create-table-secondary-indexes.html" title="15.1.20.9 Secondary Indexes and Generated Columns">
Section 15.1.20.9, “Secondary Indexes and Generated Columns”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
STORED
</code>
: Column values are evaluated and
stored when rows are inserted or updated. A stored column
does require storage space and can be indexed.
</p>
</li>
</ul>
</div>
<p>
The default is
<code class="literal">
VIRTUAL
</code>
if neither keyword is
specified.
</p>
<p>
It is permitted to mix
<code class="literal">
VIRTUAL
</code>
and
<code class="literal">
STORED
</code>
columns within a table.
</p>
<p>
Other attributes may be given to indicate whether the column is
indexed or can be
<code class="literal">
NULL
</code>
, or provide a comment.
</p>
<p>
Generated column expressions must adhere to the following rules.
An error occurs if an expression contains disallowed constructs.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Literals, deterministic built-in functions, and operators
are permitted. A function is deterministic if, given the
same data in tables, multiple invocations produce the same
result, independently of the connected user. Examples of
functions that are nondeterministic and fail this
definition:
<a class="link" href="information-functions.html#function_connection-id">
<code class="literal">
CONNECTION_ID()
</code>
</a>
,
<a class="link" href="information-functions.html#function_current-user">
<code class="literal">
CURRENT_USER()
</code>
</a>
,
<a class="link" href="date-and-time-functions.html#function_now">
<code class="literal">
NOW()
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
Stored functions and loadable functions are not permitted.
</p>
</li>
<li class="listitem">
<p>
Stored procedure and function parameters are not permitted.
</p>
</li>
<li class="listitem">
<p>
Variables (system variables, user-defined variables, and
stored program local variables) are not permitted.
</p>
</li>
<li class="listitem">
<p>
Subqueries are not permitted.
</p>
</li>
<li class="listitem">
<p>
A generated column definition can refer to other generated
columns, but only those occurring earlier in the table
definition. A generated column definition can refer to any
base (nongenerated) column in the table whether its
definition occurs earlier or later.
</p>
</li>
<li class="listitem">
<p>
The
<code class="literal">
AUTO_INCREMENT
</code>
attribute cannot be
used in a generated column definition.
</p>
</li>
<li class="listitem">
<p>
An
<code class="literal">
AUTO_INCREMENT
</code>
column cannot be used
as a base column in a generated column definition.
</p>
</li>
<li class="listitem">
<p>
If expression evaluation causes truncation or provides
incorrect input to a function, the
<a class="link" href="create-table.html" title="15.1.20 CREATE TABLE Statement">
<code class="literal">
CREATE TABLE
</code>
</a>
statement
terminates with an error and the DDL operation is rejected.
</p>
</li>
</ul>
</div>
<p>
If the expression evaluates to a data type that differs from the
declared column type, implicit coercion to the declared type
occurs according to the usual MySQL type-conversion rules. See
<a class="xref" href="type-conversion.html" title="14.3 Type Conversion in Expression Evaluation">
Section 14.3, “Type Conversion in Expression Evaluation”
</a>
.
</p>
<p>
If a generated column uses the
<a class="link" href="datetime.html" title="13.2.2 The DATE, DATETIME, and TIMESTAMP Types">
<code class="literal">
TIMESTAMP
</code>
</a>
data type, the setting
for
<a class="link" href="server-system-variables.html#sysvar_explicit_defaults_for_timestamp">
<code class="literal">
explicit_defaults_for_timestamp
</code>
</a>
is ignored. In such cases, if this variable is disabled then
<code class="literal">
NULL
</code>
is not converted to
<a class="link" href="date-and-time-functions.html#function_current-timestamp">
<code class="literal">
CURRENT_TIMESTAMP
</code>
</a>
. If the column
is also declared as
<code class="literal">
NOT NULL
</code>
, attempting to
insert
<code class="literal">
NULL
</code>
is explicitly rejected with
<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>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
Expression evaluation uses the SQL mode in effect at
evaluation time. If any component of the expression depends on
the SQL mode, different results may occur for different uses
of the table unless the SQL mode is the same during all uses.
</p>
</div>
<p>
For
<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>
, the destination table preserves
generated column information from the original table.
</p>
<p>
For
<a class="link" href="create-table-select.html" title="15.1.20.4 CREATE TABLE ... SELECT Statement">
<code class="literal">
CREATE
TABLE ... SELECT
</code>
</a>
, the destination table does not
preserve information about whether columns in the selected-from
table are generated columns. The
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
part of the statement
cannot assign values to generated columns in the destination
table.
</p>
<p>
Partitioning by generated columns is permitted. See
<a class="xref" href="create-table.html#create-table-partitioning" title="Table Partitioning">
Table Partitioning
</a>
.
</p>
<p>
A foreign key constraint on a stored generated column cannot use
<code class="literal">
CASCADE
</code>
,
<code class="literal">
SET NULL
</code>
, or
<code class="literal">
SET DEFAULT
</code>
as
<code class="literal">
ON UPDATE
</code>
referential actions, nor can it use
<code class="literal">
SET NULL
</code>
or
<code class="literal">
SET DEFAULT
</code>
as
<code class="literal">
ON
DELETE
</code>
referential actions.
</p>
<p>
A foreign key constraint on the base column of a stored
generated column cannot use
<code class="literal">
CASCADE
</code>
,
<code class="literal">
SET NULL
</code>
, or
<code class="literal">
SET DEFAULT
</code>
as
<code class="literal">
ON UPDATE
</code>
or
<code class="literal">
ON DELETE
</code>
referential actions.
</p>
<p>
A foreign key constraint cannot reference a virtual generated
column.
</p>
<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.
</p>
<p>
For
<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>
, if a generated column is
inserted into, replaced, or updated explicitly, the only
permitted value is
<code class="literal">
DEFAULT
</code>
.
</p>
<p>
A generated column in a view is considered updatable because it
is possible to assign to it. However, if such a column is
updated explicitly, the only permitted value is
<code class="literal">
DEFAULT
</code>
.
</p>
<p>
Generated columns have several use cases, such as these:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Virtual generated columns can be used as a way to simplify
and unify queries. A complicated condition can be defined as
a generated column and referred to from multiple queries on
the table to ensure that all of them use exactly the same
condition.
</p>
</li>
<li class="listitem">
<p>
Stored generated columns can be used as a materialized cache
for complicated conditions that are costly to calculate on
the fly.
</p>
</li>
<li class="listitem">
<p>
Generated columns can simulate functional indexes: Use a
generated column to define a functional expression and index
it. This can be useful for working with columns of types
that cannot be indexed directly, such as
<a class="link" href="json.html" title="13.5 The JSON Data Type">
<code class="literal">
JSON
</code>
</a>
columns; see
<a class="xref" href="create-table-secondary-indexes.html#json-column-indirect-index" title="Indexing a Generated Column to Provide a JSON Column Index">
Indexing a Generated Column to Provide a JSON Column Index
</a>
, for a detailed
example.
</p>
<p>
For stored generated columns, the disadvantage of this
approach is that values are stored twice; once as the value
of the generated column and once in the index.
</p>
</li>
<li class="listitem">
<p>
If a generated column is indexed, the optimizer recognizes
query expressions that match the column definition and uses
indexes from the column as appropriate during query
execution, even if a query does not refer to the column
directly by name. For details, see
<a class="xref" href="generated-column-index-optimizations.html" title="10.3.11 Optimizer Use of Generated Column Indexes">
Section 10.3.11, “Optimizer Use of Generated Column Indexes”
</a>
.
</p>
</li>
</ul>
</div>
<p>
Example:
</p>
<p>
Suppose that a table
<code class="literal">
t1
</code>
contains
<code class="literal">
first_name
</code>
and
<code class="literal">
last_name
</code>
columns and that applications frequently construct the full name
using an expression like this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa74826322"><div class="copy-help left">Press ⌘+C to 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">CONCAT</span><span class="token punctuation">(</span>first_name<span class="token punctuation">,</span><span class="token string">' '</span><span class="token punctuation">,</span>last_name<span class="token punctuation">)</span> <span class="token keyword">AS</span> full_name <span class="token keyword">FROM</span> t1<span class="token punctuation">;</span></code></pre>
</div>
<p>
One way to avoid writing out the expression is to create a view
<code class="literal">
v1
</code>
on
<code class="literal">
t1
</code>
, which simplifies
applications by enabling them to select
<code class="literal">
full_name
</code>
directly without using an
expression:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa11279815"><div class="copy-help left">Press ⌘+C to 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">VIEW</span> v1 <span class="token keyword">AS</span>
<span class="token keyword">SELECT</span> <span class="token operator">*</span><span class="token punctuation">,</span> <span class="token function">CONCAT</span><span class="token punctuation">(</span>first_name<span class="token punctuation">,</span><span class="token string">' '</span><span class="token punctuation">,</span>last_name<span class="token punctuation">)</span> <span class="token keyword">AS</span> full_name <span class="token keyword">FROM</span> t1<span class="token punctuation">;</span>
<span class="token keyword">SELECT</span> full_name <span class="token keyword">FROM</span> v1<span class="token punctuation">;</span></code></pre>
</div>
<p>
A generated column also enables applications to select
<code class="literal">
full_name
</code>
directly without the need to define
a view:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa89834980"><div class="copy-help left">Press ⌘+C to 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>
first_name <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">10</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
last_name <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">10</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
full_name <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">255</span><span class="token punctuation">)</span> <span class="token keyword">AS</span> <span class="token punctuation">(</span><span class="token function">CONCAT</span><span class="token punctuation">(</span>first_name<span class="token punctuation">,</span><span class="token string">' '</span><span class="token punctuation">,</span>last_name<span class="token punctuation">)</span><span class="token punctuation">)</span>
<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">SELECT</span> full_name <span class="token keyword">FROM</span> t1<span class="token punctuation">;</span></code></pre>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/host-cache.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="host-cache">
</a>
7.1.12.3 DNS Lookups and the Host Cache
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045260889136">
</a>
<a class="indexterm" name="idm46045260888080">
</a>
<a class="indexterm" name="idm46045260887008">
</a>
<a class="indexterm" name="idm46045260885936">
</a>
<a class="indexterm" name="idm46045260884864">
</a>
<a class="indexterm" name="idm46045260883376">
</a>
<p>
The MySQL server maintains an in-memory host cache that contains
information about clients: IP address, host name, and error
information. The Performance Schema
<a class="link" href="performance-schema-host-cache-table.html" title="29.12.22.3 The host_cache Table">
<code class="literal">
host_cache
</code>
</a>
table exposes the
contents of the host cache so that it can be examined using
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
statements. This may help
you diagnose the causes of connection problems. See
<a class="xref" href="performance-schema-host-cache-table.html" title="29.12.22.3 The host_cache Table">
Section 29.12.22.3, “The host_cache Table”
</a>
.
</p>
<p>
The following sections discuss how the host cache works, as well
as other topics such as how to configure and monitor the cache.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="xref" href="host-cache.html#host-cache-operation" title="Host Cache Operation">
Host Cache Operation
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="host-cache.html#host-cache-configuration" title="Configuring the Host Cache">
Configuring the Host Cache
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="host-cache.html#host-cache-monitoring" title="Monitoring the Host Cache">
Monitoring the Host Cache
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="host-cache.html#host-cache-flushing" title="Flushing the Host Cache">
Flushing the Host Cache
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="host-cache.html#blocked-host" title="Dealing with Blocked Hosts">
Dealing with Blocked Hosts
</a>
</p>
</li>
</ul>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="host-cache-operation">
</a>
Host Cache Operation
</h5>
</div>
</div>
</div>
<p>
The server uses the host cache only for non-localhost TCP
connections. It does not use the cache for TCP connections
established using a loopback interface address (for example,
<code class="literal">
127.0.0.1
</code>
or
<code class="literal">
::1
</code>
), or
for connections established using a Unix socket file, named
pipe, or shared memory.
</p>
<p>
The server uses the host cache for several purposes:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
By caching the results of IP-to-host name lookups, the
server avoids doing a Domain Name System (DNS) lookup for
each client connection. Instead, for a given host, it
needs to perform a lookup only for the first connection
from that host.
</p>
</li>
<li class="listitem">
<p>
The cache contains information about errors that occur
during the client connection process. Some errors are
considered
<span class="quote">
“
<span class="quote">
blocking.
</span>
”
</span>
If too many of these
occur successively from a given host without a successful
connection, the server blocks further connections from
that host. The
<a class="link" href="server-system-variables.html#sysvar_max_connect_errors">
<code class="literal">
max_connect_errors
</code>
</a>
system
variable determines the permitted number of successive
errors before blocking occurs.
</p>
</li>
</ul>
</div>
<p>
For each applicable new client connection, the server uses the
client IP address to check whether the client host name is in
the host cache. If so, the server refuses or continues to
process the connection request depending on whether or not the
host is blocked. If the host is not in the cache, the server
attempts to resolve the host name. First, it resolves the IP
address to a host name and resolves that host name back to an
IP address. Then it compares the result to the original IP
address to ensure that they are the same. The server stores
information about the result of this operation in the host
cache. If the cache is full, the least recently used entry is
discarded.
</p>
<p>
The server performs host name resolution using the
<code class="literal">
getaddrinfo()
</code>
system call.
</p>
<p>
The server handles entries in the host cache like this:
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
When the first TCP client connection reaches the server
from a given IP address, a new cache entry is created to
record the client IP, host name, and client lookup
validation flag. Initially, the host name is set to
<code class="literal">
NULL
</code>
and the flag is false. This entry
is also used for subsequent client TCP connections from
the same originating IP.
</p>
</li>
<li class="listitem">
<p>
If the validation flag for the client IP entry is false,
the server attempts an IP-to-host name-to-IP DNS
resolution. If that is successful, the host name is
updated with the resolved host name and the validation
flag is set to true. If resolution is unsuccessful, the
action taken depends on whether the error is permanent or
transient. For permanent failures, the host name remains
<code class="literal">
NULL
</code>
and the validation flag is set to
true. For transient failures, the host name and validation
flag remain unchanged. (In this case, another DNS
resolution attempt occurs the next time a client connects
from this IP.)
</p>
</li>
<li class="listitem">
<p>
If an error occurs while processing an incoming client
connection from a given IP address, the server updates the
corresponding error counters in the entry for that IP. For
a description of the errors recorded, see
<a class="xref" href="performance-schema-host-cache-table.html" title="29.12.22.3 The host_cache Table">
Section 29.12.22.3, “The host_cache Table”
</a>
.
</p>
</li>
</ol>
</div>
<p>
To unblock blocked hosts, flush the host cache; see
<a class="xref" href="host-cache.html#blocked-host" title="Dealing with Blocked Hosts">
Dealing with Blocked Hosts
</a>
.
</p>
<p>
It is possible for a blocked host to become unblocked even
without flushing the host cache if activity from other hosts
occurs:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
If the cache is full when a connection arrives from a
client IP not in the cache, the server discards the least
recently used cache entry to make room for the new entry.
</p>
</li>
<li class="listitem">
<p>
If the discarded entry is for a blocked host, that host
becomes unblocked.
</p>
</li>
</ul>
</div>
<p>
Some connection errors are not associated with TCP
connections, occur very early in the connection process (even
before an IP address is known), or are not specific to any
particular IP address (such as out-of-memory conditions). For
information about these errors, check the
<a class="link" href="server-status-variables.html#statvar_Connection_errors_xxx">
<code class="literal">
Connection_errors_
<em class="replaceable">
<code>
xxx
</code>
</em>
</code>
</a>
status variables (see
<a class="xref" href="server-status-variables.html" title="7.1.10 Server Status Variables">
Section 7.1.10, “Server Status Variables”
</a>
).
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="host-cache-configuration">
</a>
Configuring the Host Cache
</h5>
</div>
</div>
</div>
<p>
The host cache is enabled by default. The
<a class="link" href="server-system-variables.html#sysvar_host_cache_size">
<code class="literal">
host_cache_size
</code>
</a>
system
variable controls its size, as well as the size of the
Performance Schema
<a class="link" href="performance-schema-host-cache-table.html" title="29.12.22.3 The host_cache Table">
<code class="literal">
host_cache
</code>
</a>
table that exposes the cache contents. The cache size can be
set at server startup and changed at runtime. For example, to
set the size to 100 at startup, put these lines in the server
<code class="filename">
my.cnf
</code>
file:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-ini"><div class="docs-select-all right" id="sa7001526"><div class="copy-help left">Press ⌘+C to 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">host_cache_size</span><span class="token attr-value"><span class="token punctuation">=</span>200</span></code></pre>
</div>
<p>
To change the size to 300 at runtime, do this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa79665398"><div class="copy-help left">Press ⌘+C to 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> host_cache_size<span class="token operator">=</span><span class="token number">300</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Setting
<code class="literal">
host_cache_size
</code>
to 0, either at
server startup or at runtime, disables the host cache. With
the cache disabled, the server performs a DNS lookup every
time a client connects.
</p>
<p>
Changing the cache size at runtime causes an implicit host
cache flushing operation that clears the host cache, truncates
the
<a class="link" href="performance-schema-host-cache-table.html" title="29.12.22.3 The host_cache Table">
<code class="literal">
host_cache
</code>
</a>
table, and
unblocks any blocked hosts; see
<a class="xref" href="host-cache.html#host-cache-flushing" title="Flushing the Host Cache">
Flushing the Host Cache
</a>
.
</p>
<p>
To disable DNS host name lookups, start the server with the
<a class="link" href="server-system-variables.html#sysvar_skip_name_resolve">
<code class="literal">
skip_name_resolve
</code>
</a>
system
variable enabled. In this case, the server uses only IP
addresses and not host names to match connecting hosts to rows
in the MySQL grant tables. Only accounts specified in those
tables using IP addresses can be used. (A client may not be
able to connect if no account exists that specifies the client
IP address.)
</p>
<p>
If you have a very slow DNS and many hosts, you might be able
to improve performance either by enabling
<a class="link" href="server-system-variables.html#sysvar_skip_name_resolve">
<code class="literal">
skip_name_resolve
</code>
</a>
to disable
DNS lookups, or by increasing the value of
<a class="link" href="server-system-variables.html#sysvar_host_cache_size">
<code class="literal">
host_cache_size
</code>
</a>
to make the
host cache larger.
</p>
<p>
To disallow TCP/IP connections entirely, start the server with
the
<a class="link" href="server-system-variables.html#sysvar_skip_networking">
<code class="literal">
skip_networking
</code>
</a>
system
variable enabled.
</p>
<p>
To adjust the permitted number of successive connection errors
before host blocking occurs, set the
<a class="link" href="server-system-variables.html#sysvar_max_connect_errors">
<code class="literal">
max_connect_errors
</code>
</a>
system
variable. For example, to set the value at startup put these
lines in the server
<code class="filename">
my.cnf
</code>
file:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-ini"><div class="docs-select-all right" id="sa36141605"><div class="copy-help left">Press ⌘+C to 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">max_connect_errors</span><span class="token attr-value"><span class="token punctuation">=</span>10000</span></code></pre>
</div>
<p>
To change the value at runtime, do this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa12827751"><div class="copy-help left">Press ⌘+C to 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> max_connect_errors<span class="token operator">=</span><span class="token number">10000</span><span class="token punctuation">;</span></code></pre>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="host-cache-monitoring">
</a>
Monitoring the Host Cache
</h5>
</div>
</div>
</div>
<p>
The Performance Schema
<a class="link" href="performance-schema-host-cache-table.html" title="29.12.22.3 The host_cache Table">
<code class="literal">
host_cache
</code>
</a>
table exposes the contents of the host cache. This table can
be examined using
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
statements, which may help you diagnose the causes of
connection problems. For information about this table, see
<a class="xref" href="performance-schema-host-cache-table.html" title="29.12.22.3 The host_cache Table">
Section 29.12.22.3, “The host_cache Table”
</a>
.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="host-cache-flushing">
</a>
Flushing the Host Cache
</h5>
</div>
</div>
</div>
<p>
Flushing the host cache might be advisable or desirable under
these conditions:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Some of your client hosts change IP address.
</p>
</li>
<li class="listitem">
<p>
The error message
<code class="literal">
Host
'
<em class="replaceable">
<code>
host_name
</code>
</em>
' is
blocked
</code>
occurs for connections from legitimate
hosts. (See
<a class="xref" href="host-cache.html#blocked-host" title="Dealing with Blocked Hosts">
Dealing with Blocked Hosts
</a>
.)
</p>
</li>
</ul>
</div>
<p>
Flushing the host cache has these effects:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
It clears the in-memory host cache.
</p>
</li>
<li class="listitem">
<p>
It removes all rows from the Performance Schema
<a class="link" href="performance-schema-host-cache-table.html" title="29.12.22.3 The host_cache Table">
<code class="literal">
host_cache
</code>
</a>
table that exposes
the cache contents.
</p>
</li>
<li class="listitem">
<p>
It unblocks any blocked hosts. This enables further
connection attempts from those hosts.
</p>
</li>
</ul>
</div>
<p>
To flush the host cache, use any of these methods:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Change the value of the
<a class="link" href="server-system-variables.html#sysvar_host_cache_size">
<code class="literal">
host_cache_size
</code>
</a>
system
variable. This 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).
</p>
</li>
<li class="listitem">
<p>
Execute a
<a class="link" href="truncate-table.html" title="15.1.37 TRUNCATE TABLE Statement">
<code class="literal">
TRUNCATE TABLE
</code>
</a>
statement that truncates the Performance Schema
<a class="link" href="performance-schema-host-cache-table.html" title="29.12.22.3 The host_cache Table">
<code class="literal">
host_cache
</code>
</a>
table. This
requires the
<a class="link" href="privileges-provided.html#priv_drop">
<code class="literal">
DROP
</code>
</a>
privilege
for the table.
</p>
</li>
<li class="listitem">
<p>
Execute a
<a class="link" href="mysqladmin.html" title="6.5.2 mysqladmin — A MySQL Server Administration Program">
<span class="command">
<strong>
mysqladmin flush-hosts
</strong>
</span>
</a>
command. This requires the
<a class="link" href="privileges-provided.html#priv_drop">
<code class="literal">
DROP
</code>
</a>
privilege for the
Performance Schema
<a class="link" href="performance-schema-host-cache-table.html" title="29.12.22.3 The host_cache Table">
<code class="literal">
host_cache
</code>
</a>
table or the
<a class="link" href="privileges-provided.html#priv_reload">
<code class="literal">
RELOAD
</code>
</a>
privilege.
</p>
</li>
</ul>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="blocked-host">
</a>
Dealing with Blocked Hosts
</h5>
</div>
</div>
</div>
<a class="indexterm" name="idm46045260791408">
</a>
<a class="indexterm" name="idm46045260790352">
</a>
<p>
The server uses the host cache to track errors that occur
during the client connection process. If the following error
occurs, it means that
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
has received
many connection requests from the given host that were
interrupted in the middle:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-none"><div class="docs-select-all right" id="sa6741470"><div class="copy-help left">Press ⌘+C to 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">Host '<em class="replaceable">host_name</em>' is blocked because of many connection errors.
Unblock with 'mysqladmin flush-hosts'</code></pre>
</div>
<p>
The value of the
<a class="link" href="server-system-variables.html#sysvar_max_connect_errors">
<code class="literal">
max_connect_errors
</code>
</a>
system
variable determines how many successive interrupted connection
requests the server permits before blocking a host. After
<a class="link" href="server-system-variables.html#sysvar_max_connect_errors">
<code class="literal">
max_connect_errors
</code>
</a>
failed
requests without a successful connection, the server assumes
that something is wrong (for example, that someone is trying
to break in), and blocks the host from further connection
requests.
</p>
<p>
To unblock blocked hosts, flush the host cache; see
<a class="xref" href="host-cache.html#host-cache-flushing" title="Flushing the Host Cache">
Flushing the Host Cache
</a>
.
</p>
<p>
Alternatively, to avoid having the error message occur, set
<a class="link" href="server-system-variables.html#sysvar_max_connect_errors">
<code class="literal">
max_connect_errors
</code>
</a>
as
described in
<a class="xref" href="host-cache.html#host-cache-configuration" title="Configuring the Host Cache">
Configuring the Host Cache
</a>
. The
default value of
<a class="link" href="server-system-variables.html#sysvar_max_connect_errors">
<code class="literal">
max_connect_errors
</code>
</a>
is 100.
Increasing
<a class="link" href="server-system-variables.html#sysvar_max_connect_errors">
<code class="literal">
max_connect_errors
</code>
</a>
to a large value makes it less likely that a host reaches the
threshold and becomes blocked. However, if the
<code class="literal">
Host
'
<em class="replaceable">
<code>
host_name
</code>
</em>
' is blocked
</code>
error message occurs, first verify that there is nothing wrong
with TCP/IP connections from the blocked hosts. It does no
good to increase the value of
<a class="link" href="server-system-variables.html#sysvar_max_connect_errors">
<code class="literal">
max_connect_errors
</code>
</a>
if there
are network problems.
</p>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/ignoring-user.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="ignoring-user">
</a>
B.3.2.13 Ignoring user
</h4>
</div>
</div>
</div>
<p>
If you get the following error, it means that when
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
was started or when it reloaded the
grant tables, it found an account in the
<code class="literal">
user
</code>
table that had an invalid password.
</p>
<p>
<code class="literal">
Found wrong password for user
'
<em class="replaceable">
<code>
some_user
</code>
</em>
'@'
<em class="replaceable">
<code>
some_host
</code>
</em>
';
ignoring user
</code>
</p>
<p>
As a result, the account is simply ignored by the permission
system. To fix this problem, assign a new, valid password to
the account.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/replica-sql-thread-states.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="replica-sql-thread-states">
</a>
10.14.6 Replication SQL Thread States
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045221129840">
</a>
<a class="indexterm" name="idm46045221128352">
</a>
<p>
The following list shows the most common states you may see in
the
<code class="literal">
State
</code>
column for a replication SQL thread
on a replica server.
</p>
<p>
In MySQL 8.0, incompatible changes were made to instrumentation
names. Monitoring tools that work with these instrumentation
names might be impacted. If the incompatible changes have an
impact for you, set the
<a class="link" href="replication-options-replica.html#sysvar_terminology_use_previous">
<code class="literal">
terminology_use_previous
</code>
</a>
system
variable to
<code class="literal">
BEFORE_8_0_26
</code>
to make MySQL
Server use the old versions of the names for the objects
specified in the previous list. This enables monitoring tools
that rely on the old names to continue working until they can be
updated to use the new names.
</p>
<p>
Set the
<a class="link" href="replication-options-replica.html#sysvar_terminology_use_previous">
<code class="literal">
terminology_use_previous
</code>
</a>
system
variable with session scope to support individual functions, or
global scope to be a default for all new sessions. When global
scope is used, the slow query log contains the old versions of
the names.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="indexterm" name="idm46045221119248">
</a>
<a class="indexterm" name="idm46045221117712">
</a>
<code class="literal">
Making temporary file (append) before replaying
LOAD DATA INFILE
</code>
</p>
<p>
The thread is executing a
<a class="link" href="load-data.html" title="15.2.9 LOAD DATA Statement">
<code class="literal">
LOAD
DATA
</code>
</a>
statement and is appending the data to a
temporary file containing the data from which the replica
reads rows.
</p>
</li>
<li class="listitem">
<p>
<a class="indexterm" name="idm46045221112864">
</a>
<a class="indexterm" name="idm46045221111328">
</a>
<code class="literal">
Making temporary file (create) before replaying
LOAD DATA INFILE
</code>
</p>
<p>
The thread is executing a
<a class="link" href="load-data.html" title="15.2.9 LOAD DATA Statement">
<code class="literal">
LOAD
DATA
</code>
</a>
statement and is creating a temporary file
containing the data from which the replica reads rows. This
state can only be encountered if the original
<a class="link" href="load-data.html" title="15.2.9 LOAD DATA Statement">
<code class="literal">
LOAD DATA
</code>
</a>
statement was
logged by a source running a version of MySQL lower than
MySQL 5.0.3.
</p>
</li>
<li class="listitem">
<p>
<a class="indexterm" name="idm46045221105104">
</a>
<a class="indexterm" name="idm46045221103600">
</a>
<code class="literal">
Reading event from the relay log
</code>
</p>
<p>
The thread has read an event from the relay log so that the
event can be processed.
</p>
</li>
<li class="listitem">
<p>
<a class="indexterm" name="idm46045221100112">
</a>
<a class="indexterm" name="idm46045221098592">
</a>
<code class="literal">
Slave has read all relay log; waiting for more
updates
</code>
</p>
<p>
<a class="indexterm" name="idm46045221095952">
</a>
<a class="indexterm" name="idm46045221094416">
</a>
<code class="literal">
Replica has read all relay log; waiting for more
updates
</code>
</p>
<p>
The thread has processed all events in the relay log files,
and is now waiting for the I/O (receiver) thread to write
new events to the relay log.
</p>
</li>
<li class="listitem">
<p>
<a class="indexterm" name="idm46045221090784">
</a>
<a class="indexterm" name="idm46045221089280">
</a>
<code class="literal">
Waiting for an event from Coordinator
</code>
</p>
<p>
Using the multithreaded replica
(
<a class="link" href="replication-options-replica.html#sysvar_replica_parallel_workers">
<code class="literal">
replica_parallel_workers
</code>
</a>
is greater than 1), one of the replica worker threads is
waiting for an event from the coordinator thread.
</p>
</li>
<li class="listitem">
<p>
<a class="indexterm" name="idm46045221084432">
</a>
<a class="indexterm" name="idm46045221082928">
</a>
<code class="literal">
Waiting for slave mutex on exit
</code>
</p>
<p>
<a class="indexterm" name="idm46045221080336">
</a>
<a class="indexterm" name="idm46045221078832">
</a>
<code class="literal">
Waiting for replica mutex on exit
</code>
</p>
<p>
A very brief state that occurs as the thread is stopping.
</p>
</li>
<li class="listitem">
<p>
<a class="indexterm" name="idm46045221075376">
</a>
<a class="indexterm" name="idm46045221073856">
</a>
<code class="literal">
Waiting for Slave Workers to free pending
events
</code>
</p>
<p>
<a class="indexterm" name="idm46045221071216">
</a>
<a class="indexterm" name="idm46045221069696">
</a>
<code class="literal">
Waiting for Replica Workers to free pending
events
</code>
</p>
<p>
This waiting action occurs when the total size of events
being processed by Workers exceeds the size of the
<a class="link" href="replication-options-replica.html#sysvar_replica_pending_jobs_size_max">
<code class="literal">
replica_pending_jobs_size_max
</code>
</a>
system variable. The Coordinator resumes scheduling when the
size drops below this limit. This state occurs only when
<a class="link" href="replication-options-replica.html#sysvar_replica_parallel_workers">
<code class="literal">
replica_parallel_workers
</code>
</a>
is
set greater than 0.
</p>
</li>
<li class="listitem">
<p>
<a class="indexterm" name="idm46045221063392">
</a>
<a class="indexterm" name="idm46045221061888">
</a>
<code class="literal">
Waiting for the next event in relay log
</code>
</p>
<p>
The initial state before
<code class="literal">
Reading event from the
relay log
</code>
.
</p>
</li>
<li class="listitem">
<p>
<a class="indexterm" name="idm46045221057728">
</a>
<a class="indexterm" name="idm46045221056192">
</a>
<code class="literal">
Waiting until SOURCE_DELAY seconds after source
executed event
</code>
</p>
<p>
The SQL thread has read an event but is waiting for the
replica delay to lapse. This delay is set with the
<code class="literal">
SOURCE_DELAY
</code>
option of 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>
.
</p>
</li>
</ul>
</div>
<p>
The
<code class="literal">
Info
</code>
column for the SQL thread may also
show the text of a statement. This indicates that the thread has
read an event from the relay log, extracted the statement from
it, and may be executing it.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/charset-se-me-sets.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="charset-se-me-sets">
</a>
12.10.4 South European and Middle East Character Sets
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045215881568">
</a>
<a class="indexterm" name="idm46045215880112">
</a>
<a class="indexterm" name="idm46045215878624">
</a>
<a class="indexterm" name="idm46045215877136">
</a>
<p>
South European and Middle Eastern character sets supported by
MySQL include Armenian, Arabic, Georgian, Greek, Hebrew, and
Turkish.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
armscii8
</code>
(ARMSCII-8 Armenian) collations:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<code class="literal">
armscii8_bin
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
armscii8_general_ci
</code>
(default)
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
<code class="literal">
cp1256
</code>
(Windows Arabic) collations:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<code class="literal">
cp1256_bin
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
cp1256_general_ci
</code>
(default)
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
<code class="literal">
geostd8
</code>
(GEOSTD8 Georgian) collations:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<code class="literal">
geostd8_bin
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
geostd8_general_ci
</code>
(default)
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
<code class="literal">
greek
</code>
(ISO 8859-7 Greek) collations:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<code class="literal">
greek_bin
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
greek_general_ci
</code>
(default)
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
<code class="literal">
hebrew
</code>
(ISO 8859-8 Hebrew) collations:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<code class="literal">
hebrew_bin
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
hebrew_general_ci
</code>
(default)
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
<code class="literal">
latin5
</code>
(ISO 8859-9 Turkish) collations:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<code class="literal">
latin5_bin
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
latin5_turkish_ci
</code>
(default)
</p>
</li>
</ul>
</div>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/fulltext-fine-tuning.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="fulltext-fine-tuning">
</a>
14.9.6 Fine-Tuning MySQL Full-Text Search
</h3>
</div>
</div>
</div>
<p>
MySQL's full-text search capability has few user-tunable
parameters. You can exert more control over full-text searching
behavior if you have a MySQL source distribution because some
changes require source code modifications. See
<a class="xref" href="source-installation.html" title="2.8 Installing MySQL from Source">
Section 2.8, “Installing MySQL from Source”
</a>
.
</p>
<p>
Full-text search is carefully tuned for effectiveness. Modifying
the default behavior in most cases can actually decrease
effectiveness.
<span class="emphasis">
<em>
Do not alter the MySQL sources unless
you know what you are doing
</em>
</span>
.
</p>
<p>
Most full-text variables described in this section must be set
at server startup time. A server restart is required to change
them; they cannot be modified while the server is running.
</p>
<p>
Some variable changes require that you rebuild the
<code class="literal">
FULLTEXT
</code>
indexes in your tables. Instructions
for doing so are given later in this section.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="xref" href="fulltext-fine-tuning.html#fulltext-word-length" title="Configuring Minimum and Maximum Word Length">
Configuring Minimum and Maximum Word Length
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="fulltext-fine-tuning.html#fulltext-natural-language-threshold" title="Configuring the Natural Language Search Threshold">
Configuring the Natural Language Search Threshold
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="fulltext-fine-tuning.html#fulltext-modify-boolean-operators" title="Modifying Boolean Full-Text Search Operators">
Modifying Boolean Full-Text Search Operators
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="fulltext-fine-tuning.html#fulltext-modify-character-set" title="Character Set Modifications">
Character Set Modifications
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="fulltext-fine-tuning.html#fulltext-rebuild-innodb-indexes" title="Rebuilding InnoDB Full-Text Indexes">
Rebuilding InnoDB Full-Text Indexes
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="fulltext-fine-tuning.html#fulltext-optimize" title="Optimizing InnoDB Full-Text Indexes">
Optimizing InnoDB Full-Text Indexes
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="fulltext-fine-tuning.html#fulltext-rebuild-myisam-indexes" title="Rebuilding MyISAM Full-Text Indexes">
Rebuilding MyISAM Full-Text Indexes
</a>
</p>
</li>
</ul>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="fulltext-word-length">
</a>
Configuring Minimum and Maximum Word Length
</h4>
</div>
</div>
</div>
<p>
The minimum and maximum lengths of words to be indexed are
defined by the
<a class="link" href="innodb-parameters.html#sysvar_innodb_ft_min_token_size">
<code class="literal">
innodb_ft_min_token_size
</code>
</a>
and
<a class="link" href="innodb-parameters.html#sysvar_innodb_ft_max_token_size">
<code class="literal">
innodb_ft_max_token_size
</code>
</a>
for
<code class="literal">
InnoDB
</code>
search indexes, and
<a class="link" href="server-system-variables.html#sysvar_ft_min_word_len">
<code class="literal">
ft_min_word_len
</code>
</a>
and
<a class="link" href="server-system-variables.html#sysvar_ft_max_word_len">
<code class="literal">
ft_max_word_len
</code>
</a>
for
<code class="literal">
MyISAM
</code>
ones.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
Minimum and maximum word length full-text parameters do not
apply to
<code class="literal">
FULLTEXT
</code>
indexes created using
the ngram parser. ngram token size is defined by the
<a class="link" href="server-system-variables.html#sysvar_ngram_token_size">
<code class="literal">
ngram_token_size
</code>
</a>
option.
</p>
</div>
<p>
After changing any of these options, rebuild your
<code class="literal">
FULLTEXT
</code>
indexes for the change to take
effect. For example, to make two-character words searchable,
you could put the following lines in an option file:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-ini"><div class="docs-select-all right" id="sa84008437"><div class="copy-help left">Press ⌘+C to 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_ft_min_token_size</span><span class="token attr-value"><span class="token punctuation">=</span>2</span>
<span class="token constant">ft_min_word_len</span><span class="token attr-value"><span class="token punctuation">=</span>2</span></code></pre>
</div>
<p>
Then restart the server and rebuild your
<code class="literal">
FULLTEXT
</code>
indexes. For
<code class="literal">
MyISAM
</code>
tables, note the remarks regarding
<a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
<span class="command">
<strong>
myisamchk
</strong>
</span>
</a>
in the instructions that follow
for rebuilding
<code class="literal">
MyISAM
</code>
full-text indexes.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="fulltext-natural-language-threshold">
</a>
Configuring the Natural Language Search Threshold
</h4>
</div>
</div>
</div>
<p>
For
<code class="literal">
MyISAM
</code>
search indexes, the 50%
threshold for natural language searches is determined by the
particular weighting scheme chosen. To disable it, look for
the following line in
<code class="filename">
storage/myisam/ftdefs.h
</code>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-c"><div class="docs-select-all right" id="sa94197938"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-c"><span class="token macro property">#<span class="token directive keyword">define</span> GWS_IN_USE GWS_PROB</span></code></pre>
</div>
<p>
Change that line to this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-c"><div class="docs-select-all right" id="sa22025074"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-c"><span class="token macro property">#<span class="token directive keyword">define</span> GWS_IN_USE GWS_FREQ</span></code></pre>
</div>
<p>
Then recompile MySQL. There is no need to rebuild the indexes
in this case.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
By making this change, you
<span class="emphasis">
<em>
severely
</em>
</span>
decrease MySQL's ability to provide adequate relevance
values for the
<a class="link" href="fulltext-search.html#function_match">
<code class="literal">
MATCH()
</code>
</a>
function. If you really need to search for such common
words, it would be better to search using
<code class="literal">
IN
BOOLEAN MODE
</code>
instead, which does not observe the
50% threshold.
</p>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="fulltext-modify-boolean-operators">
</a>
Modifying Boolean Full-Text Search Operators
</h4>
</div>
</div>
</div>
<p>
To change the operators used for boolean full-text searches on
<code class="literal">
MyISAM
</code>
tables, set the
<a class="link" href="server-system-variables.html#sysvar_ft_boolean_syntax">
<code class="literal">
ft_boolean_syntax
</code>
</a>
system
variable. (
<code class="literal">
InnoDB
</code>
does not have an
equivalent setting.) This variable can be changed while the
server is running, but you must have privileges sufficient to
set global 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>
). No rebuilding
of indexes is necessary in this case.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="fulltext-modify-character-set">
</a>
Character Set Modifications
</h4>
</div>
</div>
</div>
<p>
For the built-in full-text parser, you can change the set of
characters that are considered word characters in several
ways, as described in the following list. After making the
modification, rebuild the indexes for each table that contains
any
<code class="literal">
FULLTEXT
</code>
indexes. Suppose that you want
to treat the hyphen character ('-') as a word character. Use
one of these methods:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Modify the MySQL source: In
<code class="filename">
storage/innobase/handler/ha_innodb.cc
</code>
(for
<code class="literal">
InnoDB
</code>
), or in
<code class="filename">
storage/myisam/ftdefs.h
</code>
(for
<code class="literal">
MyISAM
</code>
), see the
<code class="literal">
true_word_char()
</code>
and
<code class="literal">
misc_word_char()
</code>
macros. Add
<code class="literal">
'-'
</code>
to one of those macros and
recompile MySQL.
</p>
</li>
<li class="listitem">
<p>
Modify a character set file: This requires no
recompilation. The
<code class="literal">
true_word_char()
</code>
macro uses a
<span class="quote">
“
<span class="quote">
character type
</span>
”
</span>
table to
distinguish letters and numbers from other characters. .
You can edit the contents of the
<code class="literal">
<ctype><map>
</code>
array in one
of the character set XML files to specify that
<code class="literal">
'-'
</code>
is a
<span class="quote">
“
<span class="quote">
letter.
</span>
”
</span>
Then
use the given character set for your
<code class="literal">
FULLTEXT
</code>
indexes. For information about
the
<code class="literal">
<ctype><map>
</code>
array
format, see
<a class="xref" href="character-arrays.html" title="12.13.1 Character Definition Arrays">
Section 12.13.1, “Character Definition Arrays”
</a>
.
</p>
</li>
<li class="listitem">
<p>
Add a new collation for the character set used by the
indexed columns, and alter the columns to use that
collation. For general information about adding
collations, see
<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>
. For an
example specific to full-text indexing, see
<a class="xref" href="full-text-adding-collation.html" title="14.9.7 Adding a User-Defined Collation for Full-Text Indexing">
Section 14.9.7, “Adding a User-Defined Collation for Full-Text Indexing”
</a>
.
</p>
</li>
</ul>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="fulltext-rebuild-innodb-indexes">
</a>
Rebuilding InnoDB Full-Text Indexes
</h4>
</div>
</div>
</div>
<p>
For the changes to take effect,
<code class="literal">
FULLTEXT
</code>
indexes must be rebuilt after modifying any of the following
full-text index variables:
<a class="link" href="innodb-parameters.html#sysvar_innodb_ft_min_token_size">
<code class="literal">
innodb_ft_min_token_size
</code>
</a>
;
<a class="link" href="innodb-parameters.html#sysvar_innodb_ft_max_token_size">
<code class="literal">
innodb_ft_max_token_size
</code>
</a>
;
<a class="link" href="innodb-parameters.html#sysvar_innodb_ft_server_stopword_table">
<code class="literal">
innodb_ft_server_stopword_table
</code>
</a>
;
<a class="link" href="innodb-parameters.html#sysvar_innodb_ft_user_stopword_table">
<code class="literal">
innodb_ft_user_stopword_table
</code>
</a>
;
<a class="link" href="innodb-parameters.html#sysvar_innodb_ft_enable_stopword">
<code class="literal">
innodb_ft_enable_stopword
</code>
</a>
;
<a class="link" href="server-system-variables.html#sysvar_ngram_token_size">
<code class="literal">
ngram_token_size
</code>
</a>
. Modifying
<a class="link" href="innodb-parameters.html#sysvar_innodb_ft_min_token_size">
<code class="literal">
innodb_ft_min_token_size
</code>
</a>
,
<a class="link" href="innodb-parameters.html#sysvar_innodb_ft_max_token_size">
<code class="literal">
innodb_ft_max_token_size
</code>
</a>
, or
<a class="link" href="server-system-variables.html#sysvar_ngram_token_size">
<code class="literal">
ngram_token_size
</code>
</a>
requires
restarting the server.
</p>
<p>
To rebuild
<code class="literal">
FULLTEXT
</code>
indexes for an
<code class="literal">
InnoDB
</code>
table, use
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER TABLE
</code>
</a>
with the
<code class="literal">
DROP INDEX
</code>
and
<code class="literal">
ADD INDEX
</code>
options to drop and re-create each index.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="fulltext-optimize">
</a>
Optimizing InnoDB Full-Text Indexes
</h4>
</div>
</div>
</div>
<p>
Running
<a class="link" href="optimize-table.html" title="15.7.3.4 OPTIMIZE TABLE Statement">
<code class="literal">
OPTIMIZE TABLE
</code>
</a>
on a
table with a full-text index rebuilds the full-text index,
removing deleted Document IDs and consolidating multiple
entries for the same word, where possible.
</p>
<p>
To optimize a full-text index, enable
<a class="link" href="innodb-parameters.html#sysvar_innodb_optimize_fulltext_only">
<code class="literal">
innodb_optimize_fulltext_only
</code>
</a>
and run
<code class="literal">
OPTIMIZE TABLE
</code>
.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa99712482"><div class="copy-help left">Press ⌘+C to 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">GLOBAL</span> innodb_optimize_fulltext_only<span class="token operator">=</span><span class="token keyword">ON</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">OPTIMIZE</span> <span class="token keyword">TABLE</span> opening_lines<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> Table <span class="token punctuation">|</span> Op <span class="token punctuation">|</span> Msg_type <span class="token punctuation">|</span> Msg_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>
<span class="token output"><span class="token punctuation">|</span> test.opening_lines <span class="token punctuation">|</span> optimize <span class="token punctuation">|</span> status <span class="token punctuation">|</span> OK <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.01 sec)</span></code></pre>
</div>
<p>
To avoid lengthy rebuild times for full-text indexes on large
tables, you can use the
<a class="link" href="innodb-parameters.html#sysvar_innodb_ft_num_word_optimize">
<code class="literal">
innodb_ft_num_word_optimize
</code>
</a>
option to perform the optimization in stages. The
<code class="literal">
innodb_ft_num_word_optimize
</code>
option defines
the number of words that are optimized each time
<a class="link" href="optimize-table.html" title="15.7.3.4 OPTIMIZE TABLE Statement">
<code class="literal">
OPTIMIZE TABLE
</code>
</a>
is run. The
default setting is 2000, which means that 2000 words are
optimized each time
<a class="link" href="optimize-table.html" title="15.7.3.4 OPTIMIZE TABLE Statement">
<code class="literal">
OPTIMIZE
TABLE
</code>
</a>
is run. Subsequent
<a class="link" href="optimize-table.html" title="15.7.3.4 OPTIMIZE TABLE Statement">
<code class="literal">
OPTIMIZE TABLE
</code>
</a>
operations
continue from where the preceding
<a class="link" href="optimize-table.html" title="15.7.3.4 OPTIMIZE TABLE Statement">
<code class="literal">
OPTIMIZE TABLE
</code>
</a>
operation ended.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="fulltext-rebuild-myisam-indexes">
</a>
Rebuilding MyISAM Full-Text Indexes
</h4>
</div>
</div>
</div>
<p>
If you modify full-text variables that affect indexing
(
<a class="link" href="server-system-variables.html#sysvar_ft_min_word_len">
<code class="literal">
ft_min_word_len
</code>
</a>
,
<a class="link" href="server-system-variables.html#sysvar_ft_max_word_len">
<code class="literal">
ft_max_word_len
</code>
</a>
, or
<a class="link" href="server-system-variables.html#sysvar_ft_stopword_file">
<code class="literal">
ft_stopword_file
</code>
</a>
), or if you
change the stopword file itself, you must rebuild your
<code class="literal">
FULLTEXT
</code>
indexes after making the changes
and restarting the server.
</p>
<p>
To rebuild the
<code class="literal">
FULLTEXT
</code>
indexes for a
<code class="literal">
MyISAM
</code>
table, it is sufficient to do a
<code class="literal">
QUICK
</code>
repair operation:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa45201918"><div class="copy-help left">Press ⌘+C to 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">REPAIR</span> <span class="token keyword">TABLE</span> <em class="replaceable">tbl_name</em> <span class="token keyword">QUICK</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Alternatively, use
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER TABLE
</code>
</a>
as just described. In some cases, this may be faster than a
repair operation.
</p>
<p>
Each table that contains any
<code class="literal">
FULLTEXT
</code>
index
must be repaired as just shown. Otherwise, queries for the
table may yield incorrect results, and modifications to the
table causes the server to see the table as corrupt and in
need of repair.
</p>
<p>
If you 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 perform an
operation that modifies
<code class="literal">
MyISAM
</code>
table
indexes (such as repair or analyze), the
<code class="literal">
FULLTEXT
</code>
indexes are rebuilt using the
<span class="emphasis">
<em>
default
</em>
</span>
full-text parameter values for
minimum word length, maximum word length, and stopword file
unless you specify otherwise. This can result in queries
failing.
</p>
<p>
The problem occurs because these parameters are known only by
the server. They are not stored in
<code class="literal">
MyISAM
</code>
index files. To avoid the problem if you have modified the
minimum or maximum word length or stopword file values used by
the server, specify the same
<a class="link" href="server-system-variables.html#sysvar_ft_min_word_len">
<code class="literal">
ft_min_word_len
</code>
</a>
,
<a class="link" href="server-system-variables.html#sysvar_ft_max_word_len">
<code class="literal">
ft_max_word_len
</code>
</a>
, and
<a class="link" href="server-system-variables.html#sysvar_ft_stopword_file">
<code class="literal">
ft_stopword_file
</code>
</a>
values for
<a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
<span class="command">
<strong>
myisamchk
</strong>
</span>
</a>
that you use for
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
. For example, if you have set the
minimum word length to 3, you can repair a table with
<a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
<span class="command">
<strong>
myisamchk
</strong>
</span>
</a>
like this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa71417168"><div class="copy-help left">Press ⌘+C to 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">myisamchk <span class="token property">--recover</span> <span class="token constant">--ft_min_word_len</span><span class="token attr-value"><span class="token punctuation">=</span>3</span> <em class="replaceable">tbl_name</em><span class="token punctuation">.</span>MYI</code></pre>
</div>
<p>
To ensure that
<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 use
the same values for full-text parameters, place each one in
both the
<code class="literal">
[mysqld]
</code>
and
<code class="literal">
[myisamchk]
</code>
sections of an option file:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-ini"><div class="docs-select-all right" id="sa84431483"><div class="copy-help left">Press ⌘+C to 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">ft_min_word_len</span><span class="token attr-value"><span class="token punctuation">=</span>3</span>
<span class="token selector">[myisamchk]</span>
<span class="token constant">ft_min_word_len</span><span class="token attr-value"><span class="token punctuation">=</span>3</span></code></pre>
</div>
<p>
An alternative to using
<a class="link" href="myisamchk.html" title="6.6.4 myisamchk — MyISAM Table-Maintenance Utility">
<span class="command">
<strong>
myisamchk
</strong>
</span>
</a>
for
<code class="literal">
MyISAM
</code>
table index modification is to use
the
<a class="link" href="repair-table.html" title="15.7.3.5 REPAIR TABLE Statement">
<code class="literal">
REPAIR TABLE
</code>
</a>
,
<a class="link" href="analyze-table.html" title="15.7.3.1 ANALYZE TABLE Statement">
<code class="literal">
ANALYZE TABLE
</code>
</a>
,
<a class="link" href="optimize-table.html" title="15.7.3.4 OPTIMIZE TABLE Statement">
<code class="literal">
OPTIMIZE 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>
statements. These
statements are performed by the server, which knows the proper
full-text parameter values to use.
</p>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/primary-key-optimization.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="primary-key-optimization">
</a>
10.3.2 Primary Key Optimization
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045227511536">
</a>
<p>
The primary key for a table represents the column or set of
columns that you use in your most vital queries. It has an
associated index, for fast query performance. Query performance
benefits from the
<code class="literal">
NOT NULL
</code>
optimization,
because it cannot include any
<code class="literal">
NULL
</code>
values.
With the
<code class="literal">
InnoDB
</code>
storage engine, the table
data is physically organized to do ultra-fast lookups and sorts
based on the primary key column or columns.
</p>
<p>
If your table is big and important, but does not have an obvious
column or set of columns to use as a primary key, you might
create a separate column with auto-increment values to use as
the primary key. These unique IDs can serve as pointers to
corresponding rows in other tables when you join tables using
foreign keys.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/version-tokens-reference.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="version-tokens-reference">
</a>
7.6.6.4 Version Tokens Reference
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045255933904">
</a>
<p>
The following discussion serves as a reference to these Version
Tokens elements:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="xref" href="version-tokens-reference.html#version-tokens-routines" title="Version Tokens Functions">
Version Tokens Functions
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="version-tokens-reference.html#version-tokens-system-variables" title="Version Tokens System Variables">
Version Tokens System Variables
</a>
</p>
</li>
</ul>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="version-tokens-routines">
</a>
Version Tokens Functions
</h5>
</div>
</div>
</div>
<p>
The Version Tokens plugin library includes several functions.
One set of functions permits the server's list of version
tokens to be manipulated and inspected. Another set of
functions permits version tokens to be locked and unlocked.
The
<a class="link" href="privileges-provided.html#priv_version-token-admin">
<code class="literal">
VERSION_TOKEN_ADMIN
</code>
</a>
privilege (or the deprecated
<a class="link" href="privileges-provided.html#priv_super">
<code class="literal">
SUPER
</code>
</a>
privilege) is required to
invoke any Version Tokens function.
</p>
<p>
The following functions permit the server's list of version
tokens to be created, changed, removed, and inspected.
Interpretation of
<em class="replaceable">
<code>
name_list
</code>
</em>
and
<em class="replaceable">
<code>
token_list
</code>
</em>
arguments (including
whitespace handling) occurs as described in
<a class="xref" href="version-tokens-usage.html" title="7.6.6.3 Using Version Tokens">
Section 7.6.6.3, “Using Version Tokens”
</a>
, which provides details
about the syntax for specifying tokens, as well as additional
examples.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a name="function_version-tokens-delete">
</a>
<a class="link" href="version-tokens-reference.html#function_version-tokens-delete">
<code class="literal">
version_tokens_delete(
<em class="replaceable">
<code>
name_list
</code>
</em>
)
</code>
</a>
</p>
<a class="indexterm" name="idm46045255919648">
</a>
<a class="indexterm" name="idm46045255918544">
</a>
<p>
Deletes tokens from the server's list of version tokens
using the
<em class="replaceable">
<code>
name_list
</code>
</em>
argument
and returns a binary string that indicates the outcome of
the operation.
<em class="replaceable">
<code>
name_list
</code>
</em>
is a
semicolon-separated list of version token names to delete.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa76936057"><div class="copy-help left">Press ⌘+C to 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> version_tokens_delete<span class="token punctuation">(</span><span class="token string">'tok1;tok3'</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_tokens_delete('tok1;tok3') <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> 2 version tokens deleted. <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>
<p>
An argument of
<code class="literal">
NULL
</code>
is treated as an
empty string, which has no effect on the token list.
</p>
<p>
<a class="link" href="version-tokens-reference.html#function_version-tokens-delete">
<code class="literal">
version_tokens_delete()
</code>
</a>
deletes the tokens named in its argument, if they exist.
(It is not an error to delete nonexisting tokens.) To
clear the token list entirely without knowing which tokens
are in the list, pass
<code class="literal">
NULL
</code>
or a string
containing no tokens to
<a class="link" href="version-tokens-reference.html#function_version-tokens-set">
<code class="literal">
version_tokens_set()
</code>
</a>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa35319444"><div class="copy-help left">Press ⌘+C to 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> version_tokens_set<span class="token punctuation">(</span><span class="token boolean">NULL</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>
<span class="token output"><span class="token punctuation">|</span> version_tokens_set(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>
<span class="token output"><span class="token punctuation">|</span> Version tokens list cleared. <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 prompt">mysql></span> <span class="token keyword">SELECT</span> version_tokens_set<span class="token punctuation">(</span><span class="token string">''</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>
<span class="token output"><span class="token punctuation">|</span> version_tokens_set('') <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> Version tokens list cleared. <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></code></pre>
</div>
</li>
<li class="listitem">
<p>
<a name="function_version-tokens-edit">
</a>
<a class="link" href="version-tokens-reference.html#function_version-tokens-edit">
<code class="literal">
version_tokens_edit(
<em class="replaceable">
<code>
token_list
</code>
</em>
)
</code>
</a>
</p>
<a class="indexterm" name="idm46045255902768">
</a>
<a class="indexterm" name="idm46045255901664">
</a>
<p>
Modifies the server's list of version tokens using the
<em class="replaceable">
<code>
token_list
</code>
</em>
argument and returns
a binary string that indicates the outcome of the
operation.
<em class="replaceable">
<code>
token_list
</code>
</em>
is a
semicolon-separated list of
<code class="literal">
<em class="replaceable">
<code>
name
</code>
</em>
=
<em class="replaceable">
<code>
value
</code>
</em>
</code>
pairs specifying the name of each token to be defined and
its value. If a token exists, its value is updated with
the given value. If a token does not exist, it is created
with the given value. If the argument is
<code class="literal">
NULL
</code>
or a string containing no tokens,
the token list remains unchanged.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa26303314"><div class="copy-help left">Press ⌘+C to 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> version_tokens_set<span class="token punctuation">(</span><span class="token string">'tok1=value1;tok2=value2'</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>
<span class="token output"><span class="token punctuation">|</span> version_tokens_set('tok1=value1;tok2=value2') <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>
<span class="token output"><span class="token punctuation">|</span> 2 version tokens set. <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>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> version_tokens_edit<span class="token punctuation">(</span><span class="token string">'tok2=new_value2;tok3=new_value3'</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 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_tokens_edit('tok2=new_value2;tok3=new_value3') <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>
<span class="token output"><span class="token punctuation">|</span> 2 version tokens updated. <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></code></pre>
</div>
</li>
<li class="listitem">
<p>
<a name="function_version-tokens-set">
</a>
<a class="link" href="version-tokens-reference.html#function_version-tokens-set">
<code class="literal">
version_tokens_set(
<em class="replaceable">
<code>
token_list
</code>
</em>
)
</code>
</a>
</p>
<a class="indexterm" name="idm46045255890256">
</a>
<a class="indexterm" name="idm46045255889152">
</a>
<p>
Replaces the server's list of version tokens with the
tokens defined in the
<em class="replaceable">
<code>
token_list
</code>
</em>
argument and returns
a binary string that indicates the outcome of the
operation.
<em class="replaceable">
<code>
token_list
</code>
</em>
is a
semicolon-separated list of
<code class="literal">
<em class="replaceable">
<code>
name
</code>
</em>
=
<em class="replaceable">
<code>
value
</code>
</em>
</code>
pairs specifying the name of each token to be defined and
its value. If the argument is
<code class="literal">
NULL
</code>
or a
string containing no tokens, the token list is cleared.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa33771805"><div class="copy-help left">Press ⌘+C to 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> version_tokens_set<span class="token punctuation">(</span><span class="token string">'tok1=value1;tok2=value2'</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>
<span class="token output"><span class="token punctuation">|</span> version_tokens_set('tok1=value1;tok2=value2') <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>
<span class="token output"><span class="token punctuation">|</span> 2 version tokens set. <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></code></pre>
</div>
</li>
<li class="listitem">
<p>
<a name="function_version-tokens-show">
</a>
<a class="link" href="version-tokens-reference.html#function_version-tokens-show">
<code class="literal">
version_tokens_show()
</code>
</a>
</p>
<a class="indexterm" name="idm46045255879552">
</a>
<a class="indexterm" name="idm46045255878448">
</a>
<p>
Returns the server's list of version tokens as a binary
string containing a semicolon-separated list of
<code class="literal">
<em class="replaceable">
<code>
name
</code>
</em>
=
<em class="replaceable">
<code>
value
</code>
</em>
</code>
pairs.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa41893799"><div class="copy-help left">Press ⌘+C to 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> version_tokens_show<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>
<span class="token output"><span class="token punctuation">|</span> version_tokens_show() <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>
<span class="token output"><span class="token punctuation">|</span> tok2=value2;tok1=value1; <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></code></pre>
</div>
</li>
</ul>
</div>
<p>
The following functions permit version tokens to be locked and
unlocked:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a name="function_version-tokens-lock-exclusive">
</a>
<a class="link" href="version-tokens-reference.html#function_version-tokens-lock-exclusive">
<code class="literal">
version_tokens_lock_exclusive(
<em class="replaceable">
<code>
token_name
</code>
</em>
[,
<em class="replaceable">
<code>
token_name
</code>
</em>
] ...,
<em class="replaceable">
<code>
timeout
</code>
</em>
)
</code>
</a>
</p>
<a class="indexterm" name="idm46045255868704">
</a>
<a class="indexterm" name="idm46045255867600">
</a>
<p>
Acquires exclusive locks on one or more version tokens,
specified by name as strings, timing out with an error if
the locks are not acquired within the given timeout value.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa41478138"><div class="copy-help left">Press ⌘+C to 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> version_tokens_lock_exclusive<span class="token punctuation">(</span><span class="token string">'lock1'</span><span class="token punctuation">,</span> <span class="token string">'lock2'</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 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> version_tokens_lock_exclusive('lock1', 'lock2', 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 class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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 class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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>
<a name="function_version-tokens-lock-shared">
</a>
<a class="link" href="version-tokens-reference.html#function_version-tokens-lock-shared">
<code class="literal">
version_tokens_lock_shared(
<em class="replaceable">
<code>
token_name
</code>
</em>
[,
<em class="replaceable">
<code>
token_name
</code>
</em>
] ...,
<em class="replaceable">
<code>
timeout
</code>
</em>
)
</code>
</a>
</p>
<a class="indexterm" name="idm46045255859696">
</a>
<a class="indexterm" name="idm46045255858592">
</a>
<p>
Acquires shared locks on one or more version tokens,
specified by name as strings, timing out with an error if
the locks are not acquired within the given timeout value.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa22731212"><div class="copy-help left">Press ⌘+C to 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> version_tokens_lock_shared<span class="token punctuation">(</span><span class="token string">'lock1'</span><span class="token punctuation">,</span> <span class="token string">'lock2'</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 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> version_tokens_lock_shared('lock1', 'lock2', 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 class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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 class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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>
<a name="function_version-tokens-unlock">
</a>
<a class="link" href="version-tokens-reference.html#function_version-tokens-unlock">
<code class="literal">
version_tokens_unlock()
</code>
</a>
</p>
<a class="indexterm" name="idm46045255851984">
</a>
<a class="indexterm" name="idm46045255850880">
</a>
<p>
Releases all locks that were acquired within the current
session using
<a class="link" href="version-tokens-reference.html#function_version-tokens-lock-exclusive">
<code class="literal">
version_tokens_lock_exclusive()
</code>
</a>
and
<a class="link" href="version-tokens-reference.html#function_version-tokens-lock-shared">
<code class="literal">
version_tokens_lock_shared()
</code>
</a>
.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa47260716"><div class="copy-help left">Press ⌘+C to 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> version_tokens_unlock<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>
<span class="token output"><span class="token punctuation">|</span> version_tokens_unlock() <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> 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>
</li>
</ul>
</div>
<p>
The locking functions share these characteristics:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
The return value is nonzero for success. Otherwise, an
error occurs.
</p>
</li>
<li class="listitem">
<p>
Token names are strings.
</p>
</li>
<li class="listitem">
<p>
In contrast to argument handling for the functions that
manipulate the server token list, whitespace surrounding
token name arguments is not ignored and
<code class="literal">
=
</code>
and
<code class="literal">
;
</code>
characters
are permitted.
</p>
</li>
<li class="listitem">
<p>
It is possible to lock nonexisting token names. This does
not create the tokens.
</p>
</li>
<li class="listitem">
<p>
Timeout values are nonnegative integers representing the
time in seconds to wait to acquire locks before timing out
with an error. If the timeout is 0, there is no waiting
and the function produces an error if locks cannot be
acquired immediately.
</p>
</li>
<li class="listitem">
<p>
Version Tokens locking functions are based on the locking
service described at
<a class="xref" href="locking-service.html" title="7.6.9.1 The Locking Service">
Section 7.6.9.1, “The Locking Service”
</a>
.
</p>
</li>
</ul>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="version-tokens-system-variables">
</a>
Version Tokens System Variables
</h5>
</div>
</div>
</div>
<p>
Version Tokens supports the following system variables. These
variables are unavailable unless the Version Tokens plugin is
installed (see
<a class="xref" href="version-tokens-installation.html" title="7.6.6.2 Installing or Uninstalling Version Tokens">
Section 7.6.6.2, “Installing or Uninstalling Version Tokens”
</a>
).
</p>
<p>
System variables:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a name="sysvar_version_tokens_session">
</a>
<a class="link" href="version-tokens-reference.html#sysvar_version_tokens_session">
<code class="literal">
version_tokens_session
</code>
</a>
</p>
<a class="indexterm" name="idm46045255830208">
</a>
<a class="indexterm" name="idm46045255829168">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for version_tokens_session">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--version-tokens-session=value
</code>
</td>
</tr>
<tr>
<th>
System Variable
</th>
<td>
<code class="literal">
<a class="link" href="version-tokens-reference.html#sysvar_version_tokens_session">
version_tokens_session
</a>
</code>
</td>
</tr>
<tr>
<th>
Scope
</th>
<td>
Global, Session
</td>
</tr>
<tr>
<th>
Dynamic
</th>
<td>
Yes
</td>
</tr>
<tr>
<th>
<a class="link" href="optimizer-hints.html#optimizer-hints-set-var" title="Variable-Setting Hint Syntax">
<code class="literal">
SET_VAR
</code>
</a>
Hint Applies
</th>
<td>
No
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
String
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
NULL
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
The session value of this variable specifies the client
version token list and indicates the tokens that the
client session requires the server version token list to
have.
</p>
<p>
If the
<a class="link" href="version-tokens-reference.html#sysvar_version_tokens_session">
<code class="literal">
version_tokens_session
</code>
</a>
variable is
<code class="literal">
NULL
</code>
(the default) or has
an empty value, any server version token list matches. (In
effect, an empty value disables matching requirements.)
</p>
<p>
If the
<a class="link" href="version-tokens-reference.html#sysvar_version_tokens_session">
<code class="literal">
version_tokens_session
</code>
</a>
variable has a nonempty value, any mismatch between its
value and the server version token list results in an
error for any statement the session sends to the server. A
mismatch occurs under these conditions:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
A token name in the
<a class="link" href="version-tokens-reference.html#sysvar_version_tokens_session">
<code class="literal">
version_tokens_session
</code>
</a>
value is not present in the server token list. In this
case, an
<a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_vtoken_plugin_token_not_found" target="_top">
<code class="literal">
ER_VTOKEN_PLUGIN_TOKEN_NOT_FOUND
</code>
</a>
error occurs.
</p>
</li>
<li class="listitem">
<p>
A token value in the
<a class="link" href="version-tokens-reference.html#sysvar_version_tokens_session">
<code class="literal">
version_tokens_session
</code>
</a>
value differs from the value of the corresponding
token in the server token list. In this case, an
<a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_vtoken_plugin_token_mismatch" target="_top">
<code class="literal">
ER_VTOKEN_PLUGIN_TOKEN_MISMATCH
</code>
</a>
error occurs.
</p>
</li>
</ul>
</div>
<p>
It is not a mismatch for the server version token list to
include a token not named in the
<a class="link" href="version-tokens-reference.html#sysvar_version_tokens_session">
<code class="literal">
version_tokens_session
</code>
</a>
value.
</p>
<p>
Suppose that a management application has set the server
token list as follows:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa61149048"><div class="copy-help left">Press ⌘+C to 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> version_tokens_set<span class="token punctuation">(</span><span class="token string">'tok1=a;tok2=b;tok3=c'</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>
<span class="token output"><span class="token punctuation">|</span> version_tokens_set('tok1=a;tok2=b;tok3=c') <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>
<span class="token output"><span class="token punctuation">|</span> 3 version tokens set. <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></code></pre>
</div>
<p>
A client registers the tokens it requires the server to
match by setting its
<a class="link" href="version-tokens-reference.html#sysvar_version_tokens_session">
<code class="literal">
version_tokens_session
</code>
</a>
value. Then, for each subsequent statement sent by the
client, the server checks its token list against the
client
<a class="link" href="version-tokens-reference.html#sysvar_version_tokens_session">
<code class="literal">
version_tokens_session
</code>
</a>
value and produces an error if there is a mismatch:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa24277161"><div class="copy-help left">Press ⌘+C to 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 variable">@@SESSION.version_tokens_session</span> <span class="token operator">=</span> <span class="token string">'tok1=a;tok2=b'</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</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>
<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>
<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>
<span class="token prompt">mysql></span> <span class="token keyword">SET</span> <span class="token variable">@@SESSION.version_tokens_session</span> <span class="token operator">=</span> <span class="token string">'tok1=b'</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token number">1</span><span class="token punctuation">;</span>
<span class="token output">ERROR 3136 (42000)<span class="token punctuation">:</span> Version token mismatch for tok1. Correct value a</span></code></pre>
</div>
<p>
The first
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
succeeds
because the client tokens
<code class="literal">
tok1
</code>
and
<code class="literal">
tok2
</code>
are present in the server token
list and each token has the same value in the server list.
The second
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
fails
because, although
<code class="literal">
tok1
</code>
is present in
the server token list, it has a different value than
specified by the client.
</p>
<p>
At this point, any statement sent by the client fails,
unless the server token list changes such that it matches
again. Suppose that the management application changes the
server token list as follows:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa11610589"><div class="copy-help left">Press ⌘+C to 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> version_tokens_edit<span class="token punctuation">(</span><span class="token string">'tok1=b'</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> version_tokens_edit('tok1=b') <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> 1 version tokens updated. <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> version_tokens_show<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>
<span class="token output"><span class="token punctuation">|</span> version_tokens_show() <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> tok3=c;tok1=b;tok2=b; <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>
Now the client
<a class="link" href="version-tokens-reference.html#sysvar_version_tokens_session">
<code class="literal">
version_tokens_session
</code>
</a>
value matches the server token list and the client can
once again successfully execute statements:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa3249159"><div class="copy-help left">Press ⌘+C to 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 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>
<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>
<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></code></pre>
</div>
</li>
<li class="listitem">
<p>
<a name="sysvar_version_tokens_session_number">
</a>
<a class="link" href="version-tokens-reference.html#sysvar_version_tokens_session_number">
<code class="literal">
version_tokens_session_number
</code>
</a>
</p>
<a class="indexterm" name="idm46045255768672">
</a>
<a class="indexterm" name="idm46045255767568">
</a>
<div class="informaltable">
<table frame="box" rules="all" summary="Properties for version_tokens_session_number">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<tbody>
<tr>
<th>
Command-Line Format
</th>
<td>
<code class="literal">
--version-tokens-session-number=#
</code>
</td>
</tr>
<tr>
<th>
System Variable
</th>
<td>
<code class="literal">
<a class="link" href="version-tokens-reference.html#sysvar_version_tokens_session_number">
version_tokens_session_number
</a>
</code>
</td>
</tr>
<tr>
<th>
Scope
</th>
<td>
Global, Session
</td>
</tr>
<tr>
<th>
Dynamic
</th>
<td>
No
</td>
</tr>
<tr>
<th>
<a class="link" href="optimizer-hints.html#optimizer-hints-set-var" title="Variable-Setting Hint Syntax">
<code class="literal">
SET_VAR
</code>
</a>
Hint Applies
</th>
<td>
No
</td>
</tr>
<tr>
<th>
Type
</th>
<td>
Integer
</td>
</tr>
<tr>
<th>
Default Value
</th>
<td>
<code class="literal">
0
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
This variable is for internal use.
</p>
</li>
</ul>
</div>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/information-schema-columns-table.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="information-schema-columns-table">
</a>
28.3.8 The INFORMATION_SCHEMA COLUMNS Table
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045080255664">
</a>
<p>
The
<a class="link" href="information-schema-columns-table.html" title="28.3.8 The INFORMATION_SCHEMA COLUMNS Table">
<code class="literal">
COLUMNS
</code>
</a>
table provides
information about columns in tables. The related
<a class="link" href="information-schema-st-geometry-columns-table.html" title="28.3.35 The INFORMATION_SCHEMA ST_GEOMETRY_COLUMNS Table">
<code class="literal">
ST_GEOMETRY_COLUMNS
</code>
</a>
table provides
information about table columns that store spatial data. See
<a class="xref" href="information-schema-st-geometry-columns-table.html" title="28.3.35 The INFORMATION_SCHEMA ST_GEOMETRY_COLUMNS Table">
Section 28.3.35, “The INFORMATION_SCHEMA ST_GEOMETRY_COLUMNS Table”
</a>
.
</p>
<p>
The
<a class="link" href="information-schema-columns-table.html" title="28.3.8 The INFORMATION_SCHEMA COLUMNS Table">
<code class="literal">
COLUMNS
</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">
TABLE_CATALOG
</code>
</p>
<p>
The name of the catalog to which the table containing the
column belongs. This value is always
<code class="literal">
def
</code>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
TABLE_SCHEMA
</code>
</p>
<p>
The name of the schema (database) to which the table
containing the column belongs.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
TABLE_NAME
</code>
</p>
<p>
The name of the table containing the column.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
COLUMN_NAME
</code>
</p>
<p>
The name of the column.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
ORDINAL_POSITION
</code>
</p>
<p>
The position of the column within the table.
<code class="literal">
ORDINAL_POSITION
</code>
is necessary because you
might want to say
<code class="literal">
ORDER BY
ORDINAL_POSITION
</code>
. Unlike
<a class="link" href="show-columns.html" title="15.7.7.6 SHOW COLUMNS Statement">
<code class="literal">
SHOW
COLUMNS
</code>
</a>
,
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
from
the
<a class="link" href="information-schema-columns-table.html" title="28.3.8 The INFORMATION_SCHEMA COLUMNS Table">
<code class="literal">
COLUMNS
</code>
</a>
table does not have
automatic ordering.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
COLUMN_DEFAULT
</code>
</p>
<p>
The default value for the column. This is
<code class="literal">
NULL
</code>
if the column has an explicit default
of
<code class="literal">
NULL
</code>
, or if the column definition
includes no
<code class="literal">
DEFAULT
</code>
clause.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
IS_NULLABLE
</code>
</p>
<p>
The column nullability. The value is
<code class="literal">
YES
</code>
if
<code class="literal">
NULL
</code>
values can be stored in the column,
<code class="literal">
NO
</code>
if not.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
DATA_TYPE
</code>
</p>
<p>
The column data type.
</p>
<p>
The
<code class="literal">
DATA_TYPE
</code>
value is the type name only
with no other information. The
<code class="literal">
COLUMN_TYPE
</code>
value contains the type name and possibly other information
such as the precision or length.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
CHARACTER_MAXIMUM_LENGTH
</code>
</p>
<p>
For string columns, the maximum length in characters.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
CHARACTER_OCTET_LENGTH
</code>
</p>
<p>
For string columns, the maximum length in bytes.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
NUMERIC_PRECISION
</code>
</p>
<p>
For numeric columns, the numeric precision.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
NUMERIC_SCALE
</code>
</p>
<p>
For numeric columns, the numeric scale.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
DATETIME_PRECISION
</code>
</p>
<p>
For temporal columns, the fractional seconds precision.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
CHARACTER_SET_NAME
</code>
</p>
<p>
For character string columns, the character set name.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
COLLATION_NAME
</code>
</p>
<p>
For character string columns, the collation name.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
COLUMN_TYPE
</code>
</p>
<p>
The column data type.
</p>
<p>
The
<code class="literal">
DATA_TYPE
</code>
value is the type name only
with no other information. The
<code class="literal">
COLUMN_TYPE
</code>
value contains the type name and possibly other information
such as the precision or length.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
COLUMN_KEY
</code>
</p>
<p>
Whether the column is indexed:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
If
<code class="literal">
COLUMN_KEY
</code>
is empty, the column
either is not indexed or is indexed only as a secondary
column in a multiple-column, nonunique index.
</p>
</li>
<li class="listitem">
<p>
If
<code class="literal">
COLUMN_KEY
</code>
is
<code class="literal">
PRI
</code>
, the column is a
<code class="literal">
PRIMARY
KEY
</code>
or is one of the columns in a
multiple-column
<code class="literal">
PRIMARY KEY
</code>
.
</p>
</li>
<li class="listitem">
<p>
If
<code class="literal">
COLUMN_KEY
</code>
is
<code class="literal">
UNI
</code>
, the column is the first column of
a
<code class="literal">
UNIQUE
</code>
index. (A
<code class="literal">
UNIQUE
</code>
index permits multiple
<code class="literal">
NULL
</code>
values, but you can tell whether
the column permits
<code class="literal">
NULL
</code>
by checking the
<code class="literal">
Null
</code>
column.)
</p>
</li>
<li class="listitem">
<p>
If
<code class="literal">
COLUMN_KEY
</code>
is
<code class="literal">
MUL
</code>
, the column is the first column of
a nonunique index in which multiple occurrences of a given
value are permitted within the column.
</p>
</li>
</ul>
</div>
<p>
If more than one of the
<code class="literal">
COLUMN_KEY
</code>
values
applies to a given column of a table,
<code class="literal">
COLUMN_KEY
</code>
displays the one with the
highest priority, in the order
<code class="literal">
PRI
</code>
,
<code class="literal">
UNI
</code>
,
<code class="literal">
MUL
</code>
.
</p>
<p>
A
<code class="literal">
UNIQUE
</code>
index may be displayed as
<code class="literal">
PRI
</code>
if it cannot contain
<code class="literal">
NULL
</code>
values and there is no
<code class="literal">
PRIMARY KEY
</code>
in the table. A
<code class="literal">
UNIQUE
</code>
index may display as
<code class="literal">
MUL
</code>
if several columns form a composite
<code class="literal">
UNIQUE
</code>
index; although the combination of
the columns is unique, each column can still hold multiple
occurrences of a given value.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
EXTRA
</code>
</p>
<p>
Any additional information that is available about a given
column. The value is nonempty in these cases:
</p>
<a class="indexterm" name="idm46045080175840">
</a>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<code class="literal">
auto_increment
</code>
for columns that have
the
<code class="literal">
AUTO_INCREMENT
</code>
attribute.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
on update CURRENT_TIMESTAMP
</code>
for
<a class="link" href="datetime.html" title="13.2.2 The DATE, DATETIME, and TIMESTAMP Types">
<code class="literal">
TIMESTAMP
</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>
columns that have
the
<code class="literal">
ON UPDATE CURRENT_TIMESTAMP
</code>
attribute.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
STORED GENERATED
</code>
or
<code class="literal">
VIRTUAL
GENERATED
</code>
for generated columns.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
DEFAULT_GENERATED
</code>
for columns that have
an expression default value.
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
<code class="literal">
PRIVILEGES
</code>
</p>
<p>
The privileges you have for the column.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
COLUMN_COMMENT
</code>
</p>
<p>
Any comment included in the column definition.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
GENERATION_EXPRESSION
</code>
</p>
<a class="indexterm" name="idm46045080157888">
</a>
<p>
For generated columns, displays the expression used to compute
column values. Empty for nongenerated 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>
</li>
<li class="listitem">
<p>
<code class="literal">
SRS_ID
</code>
</p>
<p>
This value applies to spatial columns. It contains the column
<code class="literal">
SRID
</code>
value that indicates the spatial
reference system for values stored in the column. See
<a class="xref" href="spatial-type-overview.html" title="13.4.1 Spatial Data Types">
Section 13.4.1, “Spatial Data Types”
</a>
, and
<a class="xref" href="spatial-reference-systems.html" title="13.4.5 Spatial Reference System Support">
Section 13.4.5, “Spatial Reference System Support”
</a>
. The value is
<code class="literal">
NULL
</code>
for nonspatial columns and spatial
columns with no
<code class="literal">
SRID
</code>
attribute.
</p>
</li>
</ul>
</div>
<h4>
<a name="idm46045080149200">
</a>
Notes
</h4>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
In
<a class="link" href="show-columns.html" title="15.7.7.6 SHOW COLUMNS Statement">
<code class="literal">
SHOW COLUMNS
</code>
</a>
, the
<code class="literal">
Type
</code>
display includes values from several
different
<a class="link" href="information-schema-columns-table.html" title="28.3.8 The INFORMATION_SCHEMA COLUMNS Table">
<code class="literal">
COLUMNS
</code>
</a>
columns.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
CHARACTER_OCTET_LENGTH
</code>
should be the same
as
<code class="literal">
CHARACTER_MAXIMUM_LENGTH
</code>
, except for
multibyte character sets.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
CHARACTER_SET_NAME
</code>
can be derived from
<code class="literal">
COLLATION_NAME
</code>
. For example, if you say
<code class="literal">
SHOW FULL COLUMNS FROM t
</code>
, and you see in
the
<code class="literal">
COLLATION_NAME
</code>
column a value of
<code class="literal">
utf8mb4_swedish_ci
</code>
, the character set is
what appears before the first underscore:
<code class="literal">
utf8mb4
</code>
.
</p>
</li>
</ul>
</div>
<p>
Column information is also available from the
<a class="link" href="show-columns.html" title="15.7.7.6 SHOW COLUMNS Statement">
<code class="literal">
SHOW COLUMNS
</code>
</a>
statement. See
<a class="xref" href="show-columns.html" title="15.7.7.6 SHOW COLUMNS Statement">
Section 15.7.7.6, “SHOW COLUMNS Statement”
</a>
. The following statements are
nearly equivalent:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa16191902"><div class="copy-help left">Press ⌘+C to 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">COLUMN_NAME</span><span class="token punctuation">,</span> DATA_TYPE<span class="token punctuation">,</span> IS_NULLABLE<span class="token punctuation">,</span> COLUMN_DEFAULT
<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">table_name</span> <span class="token operator">=</span> <span class="token string">'<em class="replaceable">tbl_name</em>'</span>
<span class="token punctuation">[</span><span class="token operator">AND</span> table_schema <span class="token operator">=</span> <span class="token string">'<em class="replaceable">db_name</em>'</span><span class="token punctuation">]</span>
<span class="token punctuation">[</span><span class="token operator">AND</span> <span class="token keyword">column_name</span> <span class="token operator">LIKE</span> <span class="token string">'<em class="replaceable">wild</em>'</span><span class="token punctuation">]</span>
<span class="token keyword">SHOW</span> <span class="token keyword">COLUMNS</span>
<span class="token keyword">FROM</span> <em class="replaceable">tbl_name</em>
<span class="token punctuation">[</span><span class="token keyword">FROM</span> <em class="replaceable">db_name</em><span class="token punctuation">]</span>
<span class="token punctuation">[</span><span class="token operator">LIKE</span> <span class="token string">'<em class="replaceable">wild</em>'</span><span class="token punctuation">]</span></code></pre>
</div>
<p>
Information about generated invisible primary key columns is
visible in this table by default. You can cause such information
to be hidden by setting
<a class="link" href="server-system-variables.html#sysvar_show_gipk_in_create_table_and_information_schema">
<code class="literal">
show_gipk_in_create_table_and_information_schema
= OFF
</code>
</a>
. For more information, see
<a class="xref" href="create-table-gipks.html" title="15.1.20.11 Generated Invisible Primary Keys">
Section 15.1.20.11, “Generated Invisible Primary Keys”
</a>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/mysql-indexes.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="mysql-indexes">
</a>
10.3.1 How MySQL Uses Indexes
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045227571840">
</a>
<p>
Indexes are used to find rows with specific column values
quickly. Without an index, MySQL must begin with the first row
and then read through the entire table to find the relevant
rows. The larger the table, the more this costs. If the table
has an index for the columns in question, MySQL can quickly
determine the position to seek to in the middle of the data file
without having to look at all the data. This is much faster than
reading every row sequentially.
</p>
<p>
Most MySQL indexes (
<code class="literal">
PRIMARY KEY
</code>
,
<code class="literal">
UNIQUE
</code>
,
<code class="literal">
INDEX
</code>
, and
<code class="literal">
FULLTEXT
</code>
) are stored in
<a class="link" href="glossary.html#glos_b_tree" title="B-tree">
B-trees
</a>
. Exceptions: Indexes
on spatial data types use R-trees;
<code class="literal">
MEMORY
</code>
tables also support
<a class="link" href="glossary.html#glos_hash_index" title="hash index">
hash
indexes
</a>
;
<code class="literal">
InnoDB
</code>
uses inverted lists
for
<code class="literal">
FULLTEXT
</code>
indexes.
</p>
<p>
In general, indexes are used as described in the following
discussion. Characteristics specific to hash indexes (as used in
<code class="literal">
MEMORY
</code>
tables) are described in
<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>
<p>
MySQL uses indexes for these operations:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
To find the rows matching a
<code class="literal">
WHERE
</code>
clause
quickly.
</p>
</li>
<li class="listitem">
<p>
To eliminate rows from consideration. If there is a choice
between multiple indexes, MySQL normally uses the index that
finds the smallest number of rows (the most
<a class="link" href="glossary.html#glos_selectivity" title="selectivity">
selective
</a>
index).
</p>
</li>
<li class="listitem">
<p>
<a class="indexterm" name="idm46045227555088">
</a>
<a class="indexterm" name="idm46045227553600">
</a>
If the table has a multiple-column index, any leftmost
prefix of the index can be used by the optimizer to look up
rows. For example, if you have a three-column index on
<code class="literal">
(col1, col2, col3)
</code>
, you have indexed
search capabilities on
<code class="literal">
(col1)
</code>
,
<code class="literal">
(col1, col2)
</code>
, and
<code class="literal">
(col1, col2,
col3)
</code>
. For more information, see
<a class="xref" href="multiple-column-indexes.html" title="10.3.6 Multiple-Column Indexes">
Section 10.3.6, “Multiple-Column Indexes”
</a>
.
</p>
</li>
<li class="listitem">
<p>
To retrieve rows from other tables when performing joins.
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. For example,
<code class="literal">
VARCHAR(10)
</code>
and
<code class="literal">
CHAR(10)
</code>
are the same size, but
<code class="literal">
VARCHAR(10)
</code>
and
<code class="literal">
CHAR(15)
</code>
are not.
</p>
<p>
For comparisons between nonbinary string columns, both
columns should use the same character set. For example,
comparing a
<code class="literal">
utf8mb4
</code>
column with a
<code class="literal">
latin1
</code>
column precludes use of an index.
</p>
<p>
Comparison of dissimilar columns (comparing a string column
to a temporal or numeric column, for example) may prevent
use of indexes if values cannot be compared directly without
conversion. For a given value such as
<code class="literal">
1
</code>
in the numeric column, it might compare equal to any number
of values in the string column such as
<code class="literal">
'1'
</code>
,
<code class="literal">
' 1'
</code>
,
<code class="literal">
'00001'
</code>
, or
<code class="literal">
'01.e1'
</code>
.
This rules out use of any indexes for the string column.
</p>
</li>
<li class="listitem">
<p>
To find the
<a class="link" href="aggregate-functions.html#function_min">
<code class="literal">
MIN()
</code>
</a>
or
<a class="link" href="aggregate-functions.html#function_max">
<code class="literal">
MAX()
</code>
</a>
value for a specific
indexed column
<em class="replaceable">
<code>
key_col
</code>
</em>
. This is
optimized by a preprocessor that checks whether you are
using
<code class="literal">
WHERE
<em class="replaceable">
<code>
key_part_N
</code>
</em>
=
<em class="replaceable">
<code>
constant
</code>
</em>
</code>
on all key
parts that occur before
<em class="replaceable">
<code>
key_col
</code>
</em>
in the index. In this case, MySQL does a single key lookup
for each
<a class="link" href="aggregate-functions.html#function_min">
<code class="literal">
MIN()
</code>
</a>
or
<a class="link" href="aggregate-functions.html#function_max">
<code class="literal">
MAX()
</code>
</a>
expression and replaces
it with a constant. If all expressions are replaced with
constants, the query returns at once. For example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa33297845"><div class="copy-help left">Press ⌘+C to 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><em class="replaceable">key_part2</em><span class="token punctuation">)</span><span class="token punctuation">,</span><span class="token function">MAX</span><span class="token punctuation">(</span><em class="replaceable">key_part2</em><span class="token punctuation">)</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 punctuation">;</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
To sort or group a table if the sorting or grouping is done
on a leftmost prefix of a usable index (for example,
<code class="literal">
ORDER BY
<em class="replaceable">
<code>
key_part1
</code>
</em>
,
<em class="replaceable">
<code>
key_part2
</code>
</em>
</code>
). If all key
parts are followed by
<code class="literal">
DESC
</code>
, the key is
read in reverse order. (Or, if the index is a descending
index, the key is read in forward 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>
,
<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>
, and
<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>
In some cases, a query can be optimized to retrieve values
without consulting the data rows. (An index that provides
all the necessary results for a query is called a
<a class="link" href="glossary.html#glos_covering_index" title="covering index">
covering index
</a>
.)
If a query uses from a table only columns that are included
in some index, the selected values can be retrieved from the
index tree for greater speed:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa63379415"><div class="copy-help left">Press ⌘+C to 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> <em class="replaceable">key_part3</em> <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">1</span></code></pre>
</div>
</li>
</ul>
</div>
<p>
Indexes are less important for queries on small tables, or big
tables where report queries process most or all of the rows.
When a query needs to access most of the rows, reading
sequentially is faster than working through an index. Sequential
reads minimize disk seeks, even if not all the rows are needed
for the query. See
<a class="xref" href="table-scan-avoidance.html" title="10.2.1.23 Avoiding Full Table Scans">
Section 10.2.1.23, “Avoiding Full Table Scans”
</a>
for
details.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/innodb-information-schema-files-table.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="innodb-information-schema-files-table">
</a>
17.15.8 Retrieving InnoDB Tablespace Metadata from INFORMATION_SCHEMA.FILES
</h3>
</div>
</div>
</div>
<p>
The Information Schema
<a class="link" href="information-schema-files-table.html" title="28.3.15 The INFORMATION_SCHEMA FILES Table">
<code class="literal">
FILES
</code>
</a>
table
provides metadata about all
<code class="literal">
InnoDB
</code>
tablespace
types including
<a class="link" href="glossary.html#glos_file_per_table" title="file-per-table">
file-per-table
tablespaces
</a>
,
<a class="link" href="glossary.html#glos_general_tablespace" title="general tablespace">
general
tablespaces
</a>
, the
<a class="link" href="glossary.html#glos_system_tablespace" title="system tablespace">
system tablespace
</a>
,
<a class="link" href="glossary.html#glos_temporary_tablespace" title="temporary tablespace">
temporary table
tablespaces
</a>
, and
<a class="link" href="glossary.html#glos_undo_tablespace" title="undo tablespace">
undo
tablespaces
</a>
(if present).
</p>
<p>
This section provides
<code class="literal">
InnoDB
</code>
-specific usage
examples. For more information about data provided by the
Information Schema
<code class="literal">
FILES
</code>
table, see
<a class="xref" href="information-schema-files-table.html" title="28.3.15 The INFORMATION_SCHEMA FILES Table">
Section 28.3.15, “The INFORMATION_SCHEMA FILES Table”
</a>
.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
The
<a class="link" href="information-schema-innodb-tablespaces-table.html" title="28.4.24 The INFORMATION_SCHEMA INNODB_TABLESPACES Table">
<code class="literal">
INNODB_TABLESPACES
</code>
</a>
and
<a class="link" href="information-schema-innodb-datafiles-table.html" title="28.4.10 The INFORMATION_SCHEMA INNODB_DATAFILES Table">
<code class="literal">
INNODB_DATAFILES
</code>
</a>
tables also
provide metadata about
<code class="literal">
InnoDB
</code>
tablespaces,
but data is limited to file-per-table, general, and undo
tablespaces.
</p>
</div>
<p>
This query retrieves metadata about the
<code class="literal">
InnoDB
</code>
system tablespace from fields of the Information Schema
<a class="link" href="information-schema-files-table.html" title="28.3.15 The INFORMATION_SCHEMA FILES Table">
<code class="literal">
FILES
</code>
</a>
table that are pertinent to
<code class="literal">
InnoDB
</code>
tablespaces.
<a class="link" href="information-schema-files-table.html" title="28.3.15 The INFORMATION_SCHEMA FILES Table">
<code class="literal">
FILES
</code>
</a>
columns that are not relevant
to
<code class="literal">
InnoDB
</code>
always return
<code class="literal">
NULL
</code>
, and are excluded from the query.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa83907557"><div class="copy-help left">Press ⌘+C to 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> FILE_ID<span class="token punctuation">,</span> FILE_NAME<span class="token punctuation">,</span> FILE_TYPE<span class="token punctuation">,</span> TABLESPACE_NAME<span class="token punctuation">,</span> FREE_EXTENTS<span class="token punctuation">,</span>
<span class="token prompt"> -></span> TOTAL_EXTENTS<span class="token punctuation">,</span> <span class="token keyword">EXTENT_SIZE</span><span class="token punctuation">,</span> <span class="token keyword">INITIAL_SIZE</span><span class="token punctuation">,</span> MAXIMUM_SIZE<span class="token punctuation">,</span> <span class="token keyword">AUTOEXTEND_SIZE</span><span class="token punctuation">,</span> DATA_FREE<span class="token punctuation">,</span> <span class="token keyword">STATUS</span> <span class="token keyword">ENGINE</span>
<span class="token prompt"> -></span> <span class="token keyword">FROM</span> INFORMATION_SCHEMA<span class="token punctuation">.</span>FILES <span class="token keyword">WHERE</span> TABLESPACE_NAME <span class="token operator">LIKE</span> <span class="token string">'innodb_system'</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>
FILE_ID<span class="token punctuation">:</span> 0
FILE_NAME<span class="token punctuation">:</span> ./ibdata1
FILE_TYPE<span class="token punctuation">:</span> TABLESPACE
TABLESPACE_NAME<span class="token punctuation">:</span> innodb_system
FREE_EXTENTS<span class="token punctuation">:</span> 0
TOTAL_EXTENTS<span class="token punctuation">:</span> 12
EXTENT_SIZE<span class="token punctuation">:</span> 1048576
INITIAL_SIZE<span class="token punctuation">:</span> 12582912
MAXIMUM_SIZE<span class="token punctuation">:</span> NULL
AUTOEXTEND_SIZE<span class="token punctuation">:</span> 67108864
DATA_FREE<span class="token punctuation">:</span> 4194304
ENGINE<span class="token punctuation">:</span> NORMAL</span></code></pre>
</div>
<p>
This query retrieves the
<code class="literal">
FILE_ID
</code>
(equivalent to
the space ID) and the
<code class="literal">
FILE_NAME
</code>
(which includes
path information) for
<code class="literal">
InnoDB
</code>
file-per-table and
general tablespaces. File-per-table and general tablespaces have a
<code class="filename">
.ibd
</code>
file extension.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa83793155"><div class="copy-help left">Press ⌘+C to 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> FILE_ID<span class="token punctuation">,</span> FILE_NAME <span class="token keyword">FROM</span> INFORMATION_SCHEMA<span class="token punctuation">.</span>FILES
<span class="token prompt"> -></span> <span class="token keyword">WHERE</span> FILE_NAME <span class="token operator">LIKE</span> <span class="token string">'%.ibd%'</span> <span class="token keyword">ORDER</span> <span class="token keyword">BY</span> FILE_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 class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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> FILE_ID <span class="token punctuation">|</span> FILE_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 class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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> 2 <span class="token punctuation">|</span> ./mysql/plugin.ibd <span class="token punctuation">|</span></span>
<span class="token output"> <span class="token punctuation">|</span> 3 <span class="token punctuation">|</span> ./mysql/servers.ibd <span class="token punctuation">|</span></span>
<span class="token output"> <span class="token punctuation">|</span> 4 <span class="token punctuation">|</span> ./mysql/help_topic.ibd <span class="token punctuation">|</span></span>
<span class="token output"> <span class="token punctuation">|</span> 5 <span class="token punctuation">|</span> ./mysql/help_category.ibd <span class="token punctuation">|</span></span>
<span class="token output"> <span class="token punctuation">|</span> 6 <span class="token punctuation">|</span> ./mysql/help_relation.ibd <span class="token punctuation">|</span></span>
<span class="token output"> <span class="token punctuation">|</span> 7 <span class="token punctuation">|</span> ./mysql/help_keyword.ibd <span class="token punctuation">|</span></span>
<span class="token output"> <span class="token punctuation">|</span> 8 <span class="token punctuation">|</span> ./mysql/time_zone_name.ibd <span class="token punctuation">|</span></span>
<span class="token output"> <span class="token punctuation">|</span> 9 <span class="token punctuation">|</span> ./mysql/time_zone.ibd <span class="token punctuation">|</span></span>
<span class="token output"> <span class="token punctuation">|</span> 10 <span class="token punctuation">|</span> ./mysql/time_zone_transition.ibd <span class="token punctuation">|</span></span>
<span class="token output"> <span class="token punctuation">|</span> 11 <span class="token punctuation">|</span> ./mysql/time_zone_transition_type.ibd <span class="token punctuation">|</span></span>
<span class="token output"> <span class="token punctuation">|</span> 12 <span class="token punctuation">|</span> ./mysql/time_zone_leap_second.ibd <span class="token punctuation">|</span></span>
<span class="token output"> <span class="token punctuation">|</span> 13 <span class="token punctuation">|</span> ./mysql/innodb_table_stats.ibd <span class="token punctuation">|</span></span>
<span class="token output"> <span class="token punctuation">|</span> 14 <span class="token punctuation">|</span> ./mysql/innodb_index_stats.ibd <span class="token punctuation">|</span></span>
<span class="token output"> <span class="token punctuation">|</span> 15 <span class="token punctuation">|</span> ./mysql/slave_relay_log_info.ibd <span class="token punctuation">|</span></span>
<span class="token output"> <span class="token punctuation">|</span> 16 <span class="token punctuation">|</span> ./mysql/slave_master_info.ibd <span class="token punctuation">|</span></span>
<span class="token output"> <span class="token punctuation">|</span> 17 <span class="token punctuation">|</span> ./mysql/slave_worker_info.ibd <span class="token punctuation">|</span></span>
<span class="token output"> <span class="token punctuation">|</span> 18 <span class="token punctuation">|</span> ./mysql/gtid_executed.ibd <span class="token punctuation">|</span></span>
<span class="token output"> <span class="token punctuation">|</span> 19 <span class="token punctuation">|</span> ./mysql/server_cost.ibd <span class="token punctuation">|</span></span>
<span class="token output"> <span class="token punctuation">|</span> 20 <span class="token punctuation">|</span> ./mysql/engine_cost.ibd <span class="token punctuation">|</span></span>
<span class="token output"> <span class="token punctuation">|</span> 21 <span class="token punctuation">|</span> ./sys/sys_config.ibd <span class="token punctuation">|</span></span>
<span class="token output"> <span class="token punctuation">|</span> 23 <span class="token punctuation">|</span> ./test/t1.ibd <span class="token punctuation">|</span></span>
<span class="token output"> <span class="token punctuation">|</span> 26 <span class="token punctuation">|</span> /home/user/test/test/t2.ibd <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></code></pre>
</div>
<p>
This query retrieves the
<code class="literal">
FILE_ID
</code>
and
<code class="literal">
FILE_NAME
</code>
for the
<code class="literal">
InnoDB
</code>
global temporary tablespace. Global temporary tablespace file
names are prefixed by
<code class="literal">
ibtmp
</code>
.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa45010763"><div class="copy-help left">Press ⌘+C to 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> FILE_ID<span class="token punctuation">,</span> FILE_NAME <span class="token keyword">FROM</span> INFORMATION_SCHEMA<span class="token punctuation">.</span>FILES
<span class="token keyword">WHERE</span> FILE_NAME <span class="token operator">LIKE</span> <span class="token string">'%ibtmp%'</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>
<span class="token output"><span class="token punctuation">|</span> FILE_ID <span class="token punctuation">|</span> FILE_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>
<span class="token output"><span class="token punctuation">|</span> 22 <span class="token punctuation">|</span> ./ibtmp1 <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></code></pre>
</div>
<p>
Similarly,
<code class="literal">
InnoDB
</code>
undo tablespace file names
are prefixed by
<code class="literal">
undo
</code>
. The following query
returns the
<code class="literal">
FILE_ID
</code>
and
<code class="literal">
FILE_NAME
</code>
for
<code class="literal">
InnoDB
</code>
undo
tablespaces.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa98027651"><div class="copy-help left">Press ⌘+C to 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> FILE_ID<span class="token punctuation">,</span> FILE_NAME <span class="token keyword">FROM</span> INFORMATION_SCHEMA<span class="token punctuation">.</span>FILES
<span class="token keyword">WHERE</span> FILE_NAME <span class="token operator">LIKE</span> <span class="token string">'%undo%'</span><span class="token punctuation">;</span></code></pre>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/working-with-null.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="working-with-null">
</a>
5.3.4.6 Working with NULL Values
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045325110000">
</a>
<a class="indexterm" name="idm46045325108960">
</a>
<p>
The
<code class="literal">
NULL
</code>
value can be surprising until you
get used to it. Conceptually,
<code class="literal">
NULL
</code>
means
<span class="quote">
“
<span class="quote">
a missing unknown value
</span>
”
</span>
and it is treated
somewhat differently from other values.
</p>
<p>
To test for
<code class="literal">
NULL
</code>
, use the
<a class="link" href="comparison-operators.html#operator_is-null">
<code class="literal">
IS NULL
</code>
</a>
and
<a class="link" href="comparison-operators.html#operator_is-not-null">
<code class="literal">
IS
NOT NULL
</code>
</a>
operators, as shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa95153330"><div class="copy-help left">Press ⌘+C to 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">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 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> 1 IS NULL <span class="token punctuation">|</span> 1 IS NOT 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>
<span class="token output"><span class="token punctuation">|</span> 0 <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></code></pre>
</div>
<p>
You cannot use arithmetic comparison operators such as
<a class="link" href="comparison-operators.html#operator_equal">
<code class="literal">
=
</code>
</a>
,
<a class="link" href="comparison-operators.html#operator_less-than">
<code class="literal">
<
</code>
</a>
, or
<a class="link" href="comparison-operators.html#operator_not-equal">
<code class="literal">
<>
</code>
</a>
to
test for
<code class="literal">
NULL
</code>
. To demonstrate this for
yourself, try the following query:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa49655246"><div class="copy-help left">Press ⌘+C to 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 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 number">1</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 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>
<span class="token output"><span class="token punctuation">|</span> 1 = NULL <span class="token punctuation">|</span> 1 <> NULL <span class="token punctuation">|</span> 1 < NULL <span class="token punctuation">|</span> 1 > 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 class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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> NULL <span class="token punctuation">|</span> NULL <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 class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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>
Because the result of any arithmetic comparison with
<code class="literal">
NULL
</code>
is also
<code class="literal">
NULL
</code>
, you
cannot obtain any meaningful results from such comparisons.
</p>
<p>
In MySQL,
<code class="literal">
0
</code>
or
<code class="literal">
NULL
</code>
means false and anything else means true. The default truth
value from a boolean operation is
<code class="literal">
1
</code>
.
</p>
<p>
This special treatment of
<code class="literal">
NULL
</code>
is why, in
the previous section, it was necessary to determine which
animals are no longer alive using
<code class="literal">
death IS NOT
NULL
</code>
instead of
<code class="literal">
death <>
NULL
</code>
.
</p>
<p>
Two
<code class="literal">
NULL
</code>
values are regarded as equal in a
<code class="literal">
GROUP BY
</code>
.
</p>
<p>
When doing an
<code class="literal">
ORDER BY
</code>
,
<code class="literal">
NULL
</code>
values are presented first if you do
<code class="literal">
ORDER BY ... ASC
</code>
and last if you do
<code class="literal">
ORDER BY ... DESC
</code>
.
</p>
<p>
A common error when working with
<code class="literal">
NULL
</code>
is to
assume that it is not possible to insert a zero or an empty
string into a column defined as
<code class="literal">
NOT NULL
</code>
,
but this is not the case. These are in fact values, whereas
<code class="literal">
NULL
</code>
means
<span class="quote">
“
<span class="quote">
not having a
value.
</span>
”
</span>
You can test this easily enough by using
<code class="literal">
IS [NOT] NULL
</code>
as shown:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa6959649"><div class="copy-help left">Press ⌘+C to 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</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 operator">NOT</span> <span class="token boolean">NULL</span><span class="token punctuation">,</span> <span class="token string">''</span> <span class="token operator">IS</span> <span class="token boolean">NULL</span><span class="token punctuation">,</span> <span class="token string">''</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 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> 0 IS NULL <span class="token punctuation">|</span> 0 IS NOT NULL <span class="token punctuation">|</span> '' IS NULL <span class="token punctuation">|</span> '' IS NOT 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 class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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 <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> 0 <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 class="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>
Thus it is entirely possible to insert a zero or empty string
into a
<code class="literal">
NOT NULL
</code>
column, as these are in
fact
<code class="literal">
NOT NULL
</code>
. See
<a class="xref" href="problems-with-null.html" title="B.3.4.3 Problems with NULL Values">
Section B.3.4.3, “Problems with NULL Values”
</a>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/innodb-information-schema-internal-data.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="innodb-information-schema-internal-data">
</a>
17.15.2.3 Persistence and Consistency of InnoDB Transaction and Locking
Information
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045150503296">
</a>
<p>
The data exposed by the transaction and locking tables
(
<code class="literal">
INFORMATION_SCHEMA
</code>
<a class="link" href="information-schema-innodb-trx-table.html" title="28.4.28 The INFORMATION_SCHEMA INNODB_TRX Table">
<code class="literal">
INNODB_TRX
</code>
</a>
table, Performance
Schema
<a class="link" href="performance-schema-data-locks-table.html" title="29.12.13.1 The data_locks Table">
<code class="literal">
data_locks
</code>
</a>
and
<a class="link" href="performance-schema-data-lock-waits-table.html" title="29.12.13.2 The data_lock_waits Table">
<code class="literal">
data_lock_waits
</code>
</a>
tables) represents
a glimpse into fast-changing data. This is not like user tables,
where the data changes only when application-initiated updates
occur. The underlying data is internal system-managed data, and
can change very quickly:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Data might not be consistent between the
<a class="link" href="information-schema-innodb-trx-table.html" title="28.4.28 The INFORMATION_SCHEMA INNODB_TRX Table">
<code class="literal">
INNODB_TRX
</code>
</a>
,
<a class="link" href="performance-schema-data-locks-table.html" title="29.12.13.1 The data_locks Table">
<code class="literal">
data_locks
</code>
</a>
, and
<a class="link" href="performance-schema-data-lock-waits-table.html" title="29.12.13.2 The data_lock_waits Table">
<code class="literal">
data_lock_waits
</code>
</a>
tables.
</p>
<p>
The
<a class="link" href="performance-schema-data-locks-table.html" title="29.12.13.1 The data_locks Table">
<code class="literal">
data_locks
</code>
</a>
and
<a class="link" href="performance-schema-data-lock-waits-table.html" title="29.12.13.2 The data_lock_waits Table">
<code class="literal">
data_lock_waits
</code>
</a>
tables expose
live data from the
<code class="literal">
InnoDB
</code>
storage engine,
to provide lock information about the transactions in the
<a class="link" href="information-schema-innodb-trx-table.html" title="28.4.28 The INFORMATION_SCHEMA INNODB_TRX Table">
<code class="literal">
INNODB_TRX
</code>
</a>
table. Data
retrieved from the lock tables exists when the
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
is executed, but might
be gone or changed by the time the query result is consumed
by the client.
</p>
<p>
Joining
<a class="link" href="performance-schema-data-locks-table.html" title="29.12.13.1 The data_locks Table">
<code class="literal">
data_locks
</code>
</a>
with
<a class="link" href="performance-schema-data-lock-waits-table.html" title="29.12.13.2 The data_lock_waits Table">
<code class="literal">
data_lock_waits
</code>
</a>
can show rows
in
<a class="link" href="performance-schema-data-lock-waits-table.html" title="29.12.13.2 The data_lock_waits Table">
<code class="literal">
data_lock_waits
</code>
</a>
that
identify a parent row in
<a class="link" href="performance-schema-data-locks-table.html" title="29.12.13.1 The data_locks Table">
<code class="literal">
data_locks
</code>
</a>
that no longer
exists or does not exist yet.
</p>
</li>
<li class="listitem">
<p>
Data in the transaction and locking tables might not be
consistent with data in the
<code class="literal">
INFORMATION_SCHEMA
</code>
<a class="link" href="information-schema-processlist-table.html" title="28.3.23 The INFORMATION_SCHEMA PROCESSLIST Table">
<code class="literal">
PROCESSLIST
</code>
</a>
table or
Performance Schema
<a class="link" href="performance-schema-threads-table.html" title="29.12.22.8 The threads Table">
<code class="literal">
threads
</code>
</a>
table.
</p>
<p>
For example, you should be careful when comparing data in
the
<code class="literal">
InnoDB
</code>
transaction and locking tables
with data in the
<a class="link" href="information-schema-processlist-table.html" title="28.3.23 The INFORMATION_SCHEMA PROCESSLIST Table">
<code class="literal">
PROCESSLIST
</code>
</a>
table. Even if you issue a single
<code class="literal">
SELECT
</code>
(joining
<a class="link" href="information-schema-innodb-trx-table.html" title="28.4.28 The INFORMATION_SCHEMA INNODB_TRX Table">
<code class="literal">
INNODB_TRX
</code>
</a>
and
<a class="link" href="information-schema-processlist-table.html" title="28.3.23 The INFORMATION_SCHEMA PROCESSLIST Table">
<code class="literal">
PROCESSLIST
</code>
</a>
, for example), the
content of those tables is generally not consistent. It is
possible for
<a class="link" href="information-schema-innodb-trx-table.html" title="28.4.28 The INFORMATION_SCHEMA INNODB_TRX Table">
<code class="literal">
INNODB_TRX
</code>
</a>
to
reference rows that are not present in
<a class="link" href="information-schema-processlist-table.html" title="28.3.23 The INFORMATION_SCHEMA PROCESSLIST Table">
<code class="literal">
PROCESSLIST
</code>
</a>
or for the
currently executing SQL query of a transaction shown in
<code class="literal">
INNODB_TRX.TRX_QUERY
</code>
to differ from the
one in
<code class="literal">
PROCESSLIST.INFO
</code>
.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/mysql-cluster-ndbinfo-transporters.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="mysql-cluster-ndbinfo-transporters">
</a>
25.6.17.66 The ndbinfo transporters Table
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045087429456">
</a>
<p>
This table contains information about NDB transporters. For
similar information about individual transporters, see the
<a class="link" href="mysql-cluster-ndbinfo-transporter-details.html" title="25.6.17.65 The ndbinfo transporter_details Table">
<code class="literal">
transporter_details
</code>
</a>
table.
</p>
<p>
The
<code class="literal">
transporters
</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">
node_id
</code>
</p>
<p>
This data node's unique node ID in the cluster
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
remote_node_id
</code>
</p>
<p>
The remote data node's node ID
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
status
</code>
</p>
<p>
Status of the connection
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
remote_address
</code>
</p>
<p>
Name or IP address of the remote host
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
bytes_sent
</code>
</p>
<p>
Number of bytes sent using this connection
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
bytes_received
</code>
</p>
<p>
Number of bytes received using this connection
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
connect_count
</code>
</p>
<p>
Number of times connection established on this transporter
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
overloaded
</code>
</p>
<p>
1 if this transporter is currently overloaded, otherwise 0
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
overload_count
</code>
</p>
<p>
Number of times this transporter has entered overload state
since connecting
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
slowdown
</code>
</p>
<p>
1 if this transporter is in slowdown state, otherwise 0
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
slowdown_count
</code>
</p>
<p>
Number of times this transporter has entered slowdown state
since connecting
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
encrypted
</code>
</p>
<p>
If this transporter is connected using TLS, this column is
<code class="literal">
1
</code>
, otherwise it is
<code class="literal">
0
</code>
.
</p>
</li>
</ul>
</div>
<h5>
<a name="idm46045087400032">
</a>
Notes
</h5>
<p>
For each running data node in the cluster, the
<code class="literal">
transporters
</code>
table displays a row showing the
status of each of that node's connections with all nodes in
the cluster,
<span class="emphasis">
<em>
including itself
</em>
</span>
. This
information is shown in the table's
<span class="emphasis">
<em>
status
</em>
</span>
column, which can have any one of
the following values:
<code class="literal">
CONNECTING
</code>
,
<code class="literal">
CONNECTED
</code>
,
<code class="literal">
DISCONNECTING
</code>
,
or
<code class="literal">
DISCONNECTED
</code>
.
</p>
<p>
Connections to API and management nodes which are configured but
not currently connected to the cluster are shown with status
<code class="literal">
DISCONNECTED
</code>
. Rows where the
<code class="literal">
node_id
</code>
is that of a data node which is not
currently connected are not shown in this table. (This is
similar omission of disconnected nodes in the
<a class="link" href="mysql-cluster-ndbinfo-nodes.html" title="25.6.17.48 The ndbinfo nodes Table">
<code class="literal">
ndbinfo.nodes
</code>
</a>
table.
</p>
<p>
The
<code class="literal">
remote_address
</code>
is the host name or
address for the node whose ID is shown in the
<code class="literal">
remote_node_id
</code>
column. The
<code class="literal">
bytes_sent
</code>
from this node and
<code class="literal">
bytes_received
</code>
by this node are the numbers,
respectively, of bytes sent and received by the node using this
connection since it was established. For nodes whose status is
<code class="literal">
CONNECTING
</code>
or
<code class="literal">
DISCONNECTED
</code>
, these columns always display
<code class="literal">
0
</code>
.
</p>
<p>
Assume you have a 5-node cluster consisting of 2 data nodes, 2
SQL nodes, and 1 management node, as shown in the output of the
<a class="link" href="mysql-cluster-mgm-client-commands.html#ndbclient-show">
<code class="literal">
SHOW
</code>
</a>
command in 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:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-ndbmgm"><div class="docs-select-all right" id="sa2575624"><div class="copy-help left">Press ⌘+C to 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>1 @10<span class="token punctuation">.</span>100<span class="token punctuation">.</span>10<span class="token punctuation">.</span>1 <span class="token punctuation">(</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>2 @10<span class="token punctuation">.</span>100<span class="token punctuation">.</span>10<span class="token punctuation">.</span>2 <span class="token punctuation">(</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>10 @10<span class="token punctuation">.</span>100<span class="token punctuation">.</span>10<span class="token punctuation">.</span>10 <span class="token punctuation">(</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> 2 node<span class="token punctuation">(</span>s<span class="token punctuation">)</span>
id<span class="token operator">=</span>20 @10<span class="token punctuation">.</span>100<span class="token punctuation">.</span>10<span class="token punctuation">.</span>20 <span class="token punctuation">(</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>
id<span class="token operator">=</span>21 @10<span class="token punctuation">.</span>100<span class="token punctuation">.</span>10<span class="token punctuation">.</span>21 <span class="token punctuation">(</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>
There are 10 rows in the
<code class="literal">
transporters
</code>
table—5 for the first data node, and 5 for the
second—assuming that all data nodes are running, as shown
here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa90649230"><div class="copy-help left">Press ⌘+C to 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 class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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> node_id <span class="token punctuation">|</span> remote_node_id <span class="token punctuation">|</span> status <span class="token punctuation">|</span> remote_address <span class="token punctuation">|</span> bytes_sent <span class="token punctuation">|</span> bytes_received <span class="token punctuation">|</span> connect_count <span class="token punctuation">|</span> overloaded <span class="token punctuation">|</span> overload_count <span class="token punctuation">|</span> slowdown <span class="token punctuation">|</span> slowdown_count <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 class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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 <span class="token punctuation">|</span> 6 <span class="token punctuation">|</span> CONNECTED <span class="token punctuation">|</span> 127.0.0.1 <span class="token punctuation">|</span> 15509748 <span class="token punctuation">|</span> 15558204 <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 5 <span class="token punctuation">|</span> 50 <span class="token punctuation">|</span> CONNECTED <span class="token punctuation">|</span> 127.0.0.1 <span class="token punctuation">|</span> 1058220 <span class="token punctuation">|</span> 284316 <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 5 <span class="token punctuation">|</span> 100 <span class="token punctuation">|</span> CONNECTED <span class="token punctuation">|</span> 127.0.0.1 <span class="token punctuation">|</span> 574796 <span class="token punctuation">|</span> 402208 <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 5 <span class="token punctuation">|</span> 101 <span class="token punctuation">|</span> CONNECTING <span class="token punctuation">|</span> <span class="token punctuation">-</span> <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 6 <span class="token punctuation">|</span> 5 <span class="token punctuation">|</span> CONNECTED <span class="token punctuation">|</span> 127.0.0.1 <span class="token punctuation">|</span> 15558204 <span class="token punctuation">|</span> 15509748 <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 6 <span class="token punctuation">|</span> 50 <span class="token punctuation">|</span> CONNECTED <span class="token punctuation">|</span> 127.0.0.1 <span class="token punctuation">|</span> 1054548 <span class="token punctuation">|</span> 283812 <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 6 <span class="token punctuation">|</span> 100 <span class="token punctuation">|</span> CONNECTED <span class="token punctuation">|</span> 127.0.0.1 <span class="token punctuation">|</span> 529948 <span class="token punctuation">|</span> 397444 <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 6 <span class="token punctuation">|</span> 101 <span class="token punctuation">|</span> CONNECTING <span class="token punctuation">|</span> <span class="token punctuation">-</span> <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span> 0 <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 class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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 class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa54826205"><div class="copy-help left">Press ⌘+C to 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> node_id<span class="token punctuation">,</span> remote_node_id<span class="token punctuation">,</span> <span class="token keyword">status</span>
<span class="token prompt"> -></span> <span class="token keyword">FROM</span> ndbinfo<span class="token punctuation">.</span>transporters<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>
<span class="token output"><span class="token punctuation">|</span> node_id <span class="token punctuation">|</span> remote_node_id <span class="token punctuation">|</span> status <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>
<span class="token output"><span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> DISCONNECTED <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> 2 <span class="token punctuation">|</span> CONNECTED <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> 10 <span class="token punctuation">|</span> CONNECTED <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> 20 <span class="token punctuation">|</span> CONNECTED <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> 21 <span class="token punctuation">|</span> CONNECTED <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 2 <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> CONNECTED <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 2 <span class="token punctuation">|</span> 2 <span class="token punctuation">|</span> DISCONNECTED <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 2 <span class="token punctuation">|</span> 10 <span class="token punctuation">|</span> CONNECTED <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 2 <span class="token punctuation">|</span> 20 <span class="token punctuation">|</span> CONNECTED <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 2 <span class="token punctuation">|</span> 21 <span class="token punctuation">|</span> CONNECTED <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>
<span class="token output">10 rows in set (0.04 sec)</span></code></pre>
</div>
<p>
If you shut down one of the data nodes in this cluster using the
command
<code class="literal">
2 STOP
</code>
in 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, then repeat the previous
query (again 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), this
table now shows only 5 rows—1 row for each connection from
the remaining management node to another node, including both
itself and the data node that is currently offline—and
displays
<code class="literal">
CONNECTING
</code>
for the status of each
remaining connection to the data node that is currently offline,
as shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa35900537"><div class="copy-help left">Press ⌘+C to 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> node_id<span class="token punctuation">,</span> remote_node_id<span class="token punctuation">,</span> <span class="token keyword">status</span>
<span class="token prompt"> -></span> <span class="token keyword">FROM</span> ndbinfo<span class="token punctuation">.</span>transporters<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>
<span class="token output"><span class="token punctuation">|</span> node_id <span class="token punctuation">|</span> remote_node_id <span class="token punctuation">|</span> status <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>
<span class="token output"><span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> DISCONNECTED <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> 2 <span class="token punctuation">|</span> CONNECTING <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> 10 <span class="token punctuation">|</span> CONNECTED <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> 20 <span class="token punctuation">|</span> CONNECTED <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> 21 <span class="token punctuation">|</span> CONNECTED <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>
<span class="token output">5 rows in set (0.02 sec)</span></code></pre>
</div>
<p>
The
<code class="literal">
connect_count
</code>
,
<code class="literal">
overloaded
</code>
,
<code class="literal">
overload_count
</code>
,
<code class="literal">
slowdown
</code>
,
and
<code class="literal">
slowdown_count
</code>
counters are reset on
connection, and retain their values after the remote node
disconnects. The
<code class="literal">
bytes_sent
</code>
and
<code class="literal">
bytes_received
</code>
counters are also reset on
connection, and so retain their values following disconnection
(until the next connection resets them).
</p>
<p>
The
<span class="emphasis">
<em>
overload
</em>
</span>
state referred to by the
<code class="literal">
overloaded
</code>
and
<code class="literal">
overload_count
</code>
columns occurs when this
transporter's send buffer contains more than
<a class="link" href="mysql-cluster-tcp-definition.html#ndbparam-tcp-overloadlimit">
<code class="literal">
OVerloadLimit
</code>
</a>
bytes
(default is 80% of
<a class="link" href="mysql-cluster-tcp-definition.html#ndbparam-tcp-sendbuffermemory">
<code class="literal">
SendBufferMemory
</code>
</a>
, that
is, 0.8 * 2097152 = 1677721 bytes). When a given transporter is
in a state of overload, any new transaction that tries to use
this transporter fails with Error 1218 (
<span class="errortext">
Send Buffers
overloaded in NDB kernel
</span>
). This affects both scans
and primary key operations.
</p>
<p>
The
<span class="emphasis">
<em>
slowdown
</em>
</span>
state referenced by the
<code class="literal">
slowdown
</code>
and
<code class="literal">
slowdown_count
</code>
columns of this table occurs
when the transporter's send buffer contains more than 60%
of the overload limit (equal to 0.6 * 2097152 = 1258291 bytes by
default). In this state, any new scan using this transporter has
its batch size reduced to minimize the load on the transporter.
</p>
<p>
Common causes of send buffer slowdown or overloading include the
following:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Data size, in particular the quantity of data stored in
<a class="link" href="blob.html" title="13.3.4 The BLOB and TEXT Types">
<code class="literal">
TEXT
</code>
</a>
columns or
<a class="link" href="blob.html" title="13.3.4 The BLOB and TEXT Types">
<code class="literal">
BLOB
</code>
</a>
columns (or both types
of columns)
</p>
</li>
<li class="listitem">
<p>
Having a data node (ndbd or ndbmtd) on the same host as an
SQL node that is engaged in binary logging
</p>
</li>
<li class="listitem">
<p>
Large number of rows per transaction or transaction batch
</p>
</li>
<li class="listitem">
<p>
Configuration issues such as insufficient
<a class="link" href="mysql-cluster-tcp-definition.html#ndbparam-tcp-sendbuffermemory">
<code class="literal">
SendBufferMemory
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
Hardware issues such as insufficient RAM or poor network
connectivity
</p>
</li>
</ul>
</div>
<p>
See also
<a class="xref" href="mysql-cluster-config-send-buffers.html" title="25.4.3.14 Configuring NDB Cluster Send Buffer Parameters">
Section 25.4.3.14, “Configuring NDB Cluster Send Buffer Parameters”
</a>
.
</p>
<p>
If TLS is used for the connection, the
<code class="literal">
encrypted
</code>
column is
<code class="literal">
1
</code>
, as
shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa18121875"><div class="copy-help left">Press ⌘+C to 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> node_id<span class="token punctuation">,</span> remote_node_id<span class="token punctuation">,</span> <span class="token keyword">status</span><span class="token punctuation">,</span> encrypted
<span class="token prompt"> -></span> <span class="token keyword">FROM</span> ndbinfo<span class="token punctuation">.</span>transporters<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> node_id <span class="token punctuation">|</span> remote_node_id <span class="token punctuation">|</span> status <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 class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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 <span class="token punctuation">|</span> 6 <span class="token punctuation">|</span> CONNECTED <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 5 <span class="token punctuation">|</span> 50 <span class="token punctuation">|</span> CONNECTED <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 5 <span class="token punctuation">|</span> 100 <span class="token punctuation">|</span> CONNECTED <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 5 <span class="token punctuation">|</span> 101 <span class="token punctuation">|</span> CONNECTING <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 6 <span class="token punctuation">|</span> 5 <span class="token punctuation">|</span> CONNECTED <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 6 <span class="token punctuation">|</span> 50 <span class="token punctuation">|</span> CONNECTED <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 6 <span class="token punctuation">|</span> 100 <span class="token punctuation">|</span> CONNECTED <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 6 <span class="token punctuation">|</span> 101 <span class="token punctuation">|</span> CONNECTING <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>
<span class="token output">8 rows in set (0.04 sec)</span></code></pre>
</div>
<p>
Otherwise, the value of this column is
<code class="literal">
0
</code>
.
</p>
<p>
The
<a class="link" href="mysql-cluster-ndbinfo-certificates.html" title="25.6.17.6 The ndbinfo certificates Table">
<code class="literal">
certificates
</code>
</a>
table can be
used to obtain certificate information about each node connected
using link encryption.
</p>
<p>
For more information, see
<a class="xref" href="mysql-cluster-tls.html" title="25.6.15 TLS Link Encryption for NDB Cluster">
Section 25.6.15, “TLS Link Encryption for NDB Cluster”
</a>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/online-ddl-memory-management.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="online-ddl-memory-management">
</a>
17.12.4 Online DDL Memory Management
</h3>
</div>
</div>
</div>
<p>
Online DDL operations that create or rebuild secondary indexes
allocate temporary buffers during different phases of index
creation. The
<a class="link" href="innodb-parameters.html#sysvar_innodb_ddl_buffer_size">
<code class="literal">
innodb_ddl_buffer_size
</code>
</a>
variable
defines the maximum buffer size for online DDL operations. The
default setting is 1048576 bytes (1 MB). The setting applies to
buffers created by threads executing online DDL operations.
Defining an appropriate buffer size limit avoids potential out of
memory errors for online DDL operations that create or rebuild
secondary indexes. The maximum buffer size per DDL thread is the
maximum buffer size divided by the number of DDL threads
(
<a class="link" href="innodb-parameters.html#sysvar_innodb_ddl_buffer_size">
<code class="literal">
innodb_ddl_buffer_size
</code>
</a>
/
<a class="link" href="innodb-parameters.html#sysvar_innodb_ddl_threads">
<code class="literal">
innodb_ddl_threads
</code>
</a>
).
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/mysql-shell-tutorial-javascript-collections-add.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="mysql-shell-tutorial-javascript-collections-add">
</a>
22.3.3.2 Working with Collections
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045127913088">
</a>
<p>
To work with the collections in a schema, use the
<code class="literal">
db
</code>
global object to access the current
schema. In this example we are using the
<code class="literal">
world_x
</code>
schema imported previously, and the
<code class="literal">
countryinfo
</code>
collection. Therefore, the format
of the operations you issue is
<code class="literal">
db.
<em class="replaceable">
<code>
collection_name
</code>
</em>
.operation
</code>
,
where
<em class="replaceable">
<code>
collection_name
</code>
</em>
is the name of
the collection which the operation is executed against. In the
following examples, the operations are executed against the
<code class="literal">
countryinfo
</code>
collection.
</p>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="idm46045127906432">
</a>
Add a Document
</h5>
</div>
</div>
</div>
<p>
Use the
<code class="literal">
add()
</code>
method to insert one document
or a list of documents into an existing collection. Insert the
following document into the
<code class="literal">
countryinfo
</code>
collection. As this is multi-line content, press
<span class="keycap">
<strong>
Enter
</strong>
</span>
twice to insert the document.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-mysqlsh"><div class="docs-select-all right" id="sa76666789"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-mysqlsh"><span class="token prompt">mysql-js></span> db<span class="token punctuation">.</span>countryinfo<span class="token punctuation">.</span><span class="token function">add</span><span class="token punctuation">(</span>
<span class="token punctuation">{</span>
GNP<span class="token punctuation">:</span> <span class="token punctuation">.</span><span class="token number">6</span><span class="token punctuation">,</span>
IndepYear<span class="token punctuation">:</span> <span class="token number">1967</span><span class="token punctuation">,</span>
Name<span class="token punctuation">:</span> <span class="token string">"Sealand"</span><span class="token punctuation">,</span>
Code<span class="token punctuation">:</span> <span class="token string">"SEA"</span><span class="token punctuation">,</span>
demographics<span class="token punctuation">:</span> <span class="token punctuation">{</span>
LifeExpectancy<span class="token punctuation">:</span> <span class="token number">79</span><span class="token punctuation">,</span>
Population<span class="token punctuation">:</span> <span class="token number">27</span>
<span class="token punctuation">}</span><span class="token punctuation">,</span>
geography<span class="token punctuation">:</span> <span class="token punctuation">{</span>
Continent<span class="token punctuation">:</span> <span class="token string">"Europe"</span><span class="token punctuation">,</span>
Region<span class="token punctuation">:</span> <span class="token string">"British Islands"</span><span class="token punctuation">,</span>
SurfaceArea<span class="token punctuation">:</span> <span class="token number">193</span>
<span class="token punctuation">}</span><span class="token punctuation">,</span>
government<span class="token punctuation">:</span> <span class="token punctuation">{</span>
GovernmentForm<span class="token punctuation">:</span> <span class="token string">"Monarchy"</span><span class="token punctuation">,</span>
HeadOfState<span class="token punctuation">:</span> <span class="token string">"Michael Bates"</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span>
<span class="token punctuation">)</span></code></pre>
</div>
<p>
The method returns the status of the operation. You can verify
the operation by searching for the document. For example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-mysqlsh"><div class="docs-select-all right" id="sa4229650"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-mysqlsh"><span class="token prompt">mysql-js></span> db<span class="token punctuation">.</span>countryinfo<span class="token punctuation">.</span><span class="token function">find</span><span class="token punctuation">(</span><span class="token string">"Name = 'Sealand'"</span><span class="token punctuation">)</span>
<span class="token inlinejson"><span class="token punctuation">{</span>
<span class="token property">"GNP"</span><span class="token operator">:</span> <span class="token number">0.6</span><span class="token punctuation">,</span>
<span class="token property">"_id"</span><span class="token operator">:</span> <span class="token string">"00005e2ff4af00000000000000f4"</span><span class="token punctuation">,</span>
<span class="token property">"Name"</span><span class="token operator">:</span> <span class="token string">"Sealand"</span><span class="token punctuation">,</span>
<span class="token property">"Code:"</span><span class="token operator">:</span> <span class="token string">"SEA"</span><span class="token punctuation">,</span>
<span class="token property">"IndepYear"</span><span class="token operator">:</span> <span class="token number">1967</span><span class="token punctuation">,</span>
<span class="token property">"geography"</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">"Region"</span><span class="token operator">:</span> <span class="token string">"British Islands"</span><span class="token punctuation">,</span>
<span class="token property">"Continent"</span><span class="token operator">:</span> <span class="token string">"Europe"</span><span class="token punctuation">,</span>
<span class="token property">"SurfaceArea"</span><span class="token operator">:</span> <span class="token number">193</span>
<span class="token punctuation">}</span><span class="token punctuation">,</span>
<span class="token property">"government"</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">"HeadOfState"</span><span class="token operator">:</span> <span class="token string">"Michael Bates"</span><span class="token punctuation">,</span>
<span class="token property">"GovernmentForm"</span><span class="token operator">:</span> <span class="token string">"Monarchy"</span>
<span class="token punctuation">}</span><span class="token punctuation">,</span>
<span class="token property">"demographics"</span><span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token property">"Population"</span><span class="token operator">:</span> <span class="token number">27</span><span class="token punctuation">,</span>
<span class="token property">"LifeExpectancy"</span><span class="token operator">:</span> <span class="token number">79</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span></span></code></pre>
</div>
<p>
Note that in addition to the fields specified when the
document was added, there is one more field, the
<code class="literal">
_id
</code>
. Each document requires an identifier
field called
<code class="literal">
_id
</code>
. The value of the
<code class="literal">
_id
</code>
field must be unique among all
documents in the same collection. Document IDs are generated
by the server, not the client, so MySQL Shell does not
automatically set an
<code class="literal">
_id
</code>
value. MySQL sets
an
<code class="literal">
_id
</code>
value if the document does not
contain the
<code class="literal">
_id
</code>
field. For more
information, see
<a class="ulink" href="/doc/x-devapi-userguide/en/understanding-automatic-document-ids.html" target="_top">
Understanding Document IDs
</a>
.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="idm46045127892352">
</a>
Related Information
</h5>
</div>
</div>
</div>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
See
<a class="ulink" href="/doc/x-devapi-userguide/en/crud-ebnf-collection-crud-functions.html#crud-ebnf-collectionaddfunction" target="_top">
CollectionAddFunction
</a>
for
the full syntax definition.
</p>
</li>
<li class="listitem">
<p>
See
<a class="ulink" href="/doc/x-devapi-userguide/en/understanding-automatic-document-ids.html" target="_top">
Understanding Document IDs
</a>
.
</p>
</li>
</ul>
</div>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/mysql-cluster-params-mgmd.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="mysql-cluster-params-mgmd">
</a>
25.4.2.2 NDB Cluster Management Node Configuration Parameters
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045121507328">
</a>
<a class="indexterm" name="idm46045121505872">
</a>
<a class="indexterm" name="idm46045121504784">
</a>
<p>
The listing in this section provides information about
parameters used in the
<code class="literal">
[ndb_mgmd]
</code>
or
<code class="literal">
[mgm]
</code>
section of a
<code class="filename">
config.ini
</code>
file for configuring NDB Cluster
management nodes. For detailed descriptions and other additional
information about each of these parameters, see
<a class="xref" href="mysql-cluster-mgm-definition.html" title="25.4.3.5 Defining an NDB Cluster Management Server">
Section 25.4.3.5, “Defining an NDB Cluster Management Server”
</a>
.
</p>
<div class="itemizedlist">
<a name="ndbparam-summary-list-mgmd">
</a>
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
<a class="link" href="mysql-cluster-mgm-definition.html#ndbparam-mgmd-arbitrationdelay">
ArbitrationDelay
</a>
</code>
:
When asked to arbitrate, arbitrator waits this long before
voting (milliseconds).
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
<a class="link" href="mysql-cluster-mgm-definition.html#ndbparam-mgmd-arbitrationrank">
ArbitrationRank
</a>
</code>
:
If 0, then management node is not arbitrator. Kernel selects
arbitrators in order 1, 2.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
<a class="link" href="mysql-cluster-mgm-definition.html#ndbparam-mgmd-datadir">
DataDir
</a>
</code>
:
Data directory for this node.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
<a class="link" href="mysql-cluster-mgm-definition.html#ndbparam-mgmd-executeoncomputer">
ExecuteOnComputer
</a>
</code>
:
String referencing earlier defined COMPUTER.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
<a class="link" href="mysql-cluster-mgm-definition.html#ndbparam-mgmd-extrasendbuffermemory">
ExtraSendBufferMemory
</a>
</code>
:
Memory to use for send buffers in addition to any allocated
by TotalSendBufferMemory or SendBufferMemory. Default (0)
allows up to 16MB.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
<a class="link" href="mysql-cluster-mgm-definition.html#ndbparam-mgmd-heartbeatintervalmgmdmgmd">
HeartbeatIntervalMgmdMgmd
</a>
</code>
:
Time between management-node-to-management-node heartbeats;
connection between management nodes is considered lost after
3 missed heartbeats.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
<a class="link" href="mysql-cluster-mgm-definition.html#ndbparam-mgmd-heartbeatthreadpriority">
HeartbeatThreadPriority
</a>
</code>
:
Set heartbeat thread policy and priority for management
nodes; see manual for allowed values.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
<a class="link" href="mysql-cluster-mgm-definition.html#ndbparam-mgmd-hostname">
HostName
</a>
</code>
:
Host name or IP address for this management node.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
<a class="link" href="mysql-cluster-mgm-definition.html#ndbparam-mgmd-id">
Id
</a>
</code>
:
Number identifying management node. Now deprecated; use
NodeId instead.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
<a class="link" href="mysql-cluster-mgm-definition.html#ndbparam-mgmd-locationdomainid">
LocationDomainId
</a>
</code>
:
Assign this management node to specific availability domain
or zone. 0 (default) leaves this unset.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
<a class="link" href="mysql-cluster-mgm-definition.html#ndbparam-mgmd-logdestination">
LogDestination
</a>
</code>
:
Where to send log messages: console, system log, or
specified log file.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
<a class="link" href="mysql-cluster-mgm-definition.html#ndbparam-mgmd-nodeid">
NodeId
</a>
</code>
:
Number uniquely identifying management node among all nodes
in cluster.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
<a class="link" href="mysql-cluster-mgm-definition.html#ndbparam-mgmd-portnumber">
PortNumber
</a>
</code>
:
Port number to send commands to and fetch configuration from
management server.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
<a class="link" href="mysql-cluster-mgm-definition.html#ndbparam-mgmd-portnumberstats">
PortNumberStats
</a>
</code>
:
Port number used to get statistical information from
management server.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
<a class="link" href="mysql-cluster-mgm-definition.html#ndbparam-mgmd-requiretls">
RequireTls
</a>
</code>
:
Client connection must authenticate with TLS before being
used otherwise.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
<a class="link" href="mysql-cluster-mgm-definition.html#ndbparam-mgmd-totalsendbuffermemory">
TotalSendBufferMemory
</a>
</code>
:
Total memory to use for all transporter send buffers.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
<a class="link" href="mysql-cluster-mgm-definition.html#ndbparam-mgmd-wan">
wan
</a>
</code>
:
Use WAN TCP setting as default.
</p>
</li>
</ul>
</div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
After making changes in a management node's
configuration, it is necessary to perform a rolling restart of
the cluster for the new configuration to take effect. See
<a class="xref" href="mysql-cluster-mgm-definition.html" title="25.4.3.5 Defining an NDB Cluster Management Server">
Section 25.4.3.5, “Defining an NDB Cluster Management Server”
</a>
, for more
information.
</p>
<p>
To add new management servers to a running NDB Cluster, it is
also necessary perform a rolling restart of all cluster nodes
after modifying any existing
<code class="filename">
config.ini
</code>
files. For more information about issues arising when using
multiple management nodes, see
<a class="xref" href="mysql-cluster-limitations-multiple-nodes.html" title="25.2.7.10 Limitations Relating to Multiple NDB Cluster Nodes">
Section 25.2.7.10, “Limitations Relating to Multiple NDB Cluster Nodes”
</a>
.
</p>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/mysql-nutshell.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title">
<a name="mysql-nutshell">
</a>
1.4 What Is New in MySQL 8.4 since MySQL 8.0
</h2>
</div>
</div>
</div>
<p>
This section summarizes what has been added to, deprecated in,
changed, and removed from MySQL 8.4 since MySQL 8.0.
A companion section lists MySQL server options and variables that
have been added, deprecated, or removed in MySQL 8.4;
see
<a class="xref" href="added-deprecated-removed.html" title="1.5 Server and Status Variables and Options Added, Deprecated, or Removed in MySQL 8.4 since 8.0">
Section 1.5, “Server and Status Variables and Options Added, Deprecated, or Removed in
MySQL 8.4 since 8.0”
</a>
.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="xref" href="mysql-nutshell.html#mysql-nutshell-additions" title="Features Added or Changed in MySQL 8.4">
Features Added or Changed in MySQL 8.4
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="mysql-nutshell.html#mysql-nutshell-deprecations" title="Features Deprecated in MySQL 8.4">
Features Deprecated in MySQL 8.4
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="mysql-nutshell.html#mysql-nutshell-removals" title="Features Removed in MySQL 8.4">
Features Removed in MySQL 8.4
</a>
</p>
</li>
</ul>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h3 class="title">
<a name="mysql-nutshell-additions">
</a>
Features Added or Changed in MySQL 8.4
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045335007952">
</a>
<a class="indexterm" name="idm46045335006944">
</a>
<p>
The following features have been added to MySQL
8.4:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<b>
MySQL native password authentication changes.
</b>
Beginning with MySQL 8.4.0, the deprecated
<code class="literal">
mysql_native_password
</code>
authentication
plugin is no longer enabled by default. To enable it,
start the server with
<a class="link" href="server-options.html#option_mysqld_mysql-native-password">
<code class="option">
--mysql-native-password=ON
</code>
</a>
(added in MySQL 8.4.0), or by including
<code class="literal">
mysql_native_password=ON
</code>
in the
<code class="literal">
[mysqld]
</code>
section of your MySQL
configuration file (added in MySQL 8.4.0).
</p>
<p>
For more information about enabling, using, and disabling
<code class="literal">
mysql_native_password
</code>
, see
<a class="xref" href="native-pluggable-authentication.html" title="8.4.1.1 Native Pluggable Authentication">
Section 8.4.1.1, “Native Pluggable Authentication”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<b>
InnoDB system variable default value changes.
</b>
The default values for a number of server system variables
relating to the
<a class="link" href="innodb-storage-engine.html" title="Chapter 17 The InnoDB Storage Engine">
<code class="literal">
InnoDB
</code>
</a>
storage engine were changed in MySQL 8.4.0, as shown in
the following table:
</p>
<a class="indexterm" name="idm46045334995968">
</a>
<a class="indexterm" name="idm46045334994576">
</a>
<div class="table">
<a name="mysql-nutshell-additions-innodb-defaults">
</a>
<p class="title">
<b>
Table 1.1 InnoDB system variable default values in MySQL 8.4
differing from MySQL 8.0
</b>
</p>
<div class="table-contents">
<table>
<colgroup>
<col width="10%"/>
<col width="45%"/>
<col width="45%"/>
</colgroup>
<thead>
<tr>
<th scope="col">
InnoDB System Variable Name
</th>
<th scope="col">
New Default Value (MySQL 8.4)
</th>
<th scope="col">
Previous Default Value (MySQL 8.0)
</th>
</tr>
</thead>
<tbody>
<tr>
<td scope="row">
<a class="link" href="innodb-parameters.html#sysvar_innodb_buffer_pool_in_core_file">
<code class="literal">
innodb_buffer_pool_in_core_file
</code>
</a>
</td>
<td>
<code class="literal">
OFF
</code>
if
<code class="literal">
MADV_DONTDUMP
</code>
is supported,
otherwise
<code class="literal">
ON
</code>
</td>
<td>
ON
</td>
</tr>
<tr>
<td scope="row">
<a class="link" href="innodb-parameters.html#sysvar_innodb_buffer_pool_instances">
<code class="literal">
innodb_buffer_pool_instances
</code>
</a>
</td>
<td>
<p>
If
<a class="link" href="innodb-parameters.html#sysvar_innodb_buffer_pool_size">
<code class="literal">
innodb_buffer_pool_size
</code>
</a>
<= 1 GiB, then
<a class="link" href="innodb-parameters.html#sysvar_innodb_buffer_pool_instances">
<code class="literal">
innodb_buffer_pool_instances=1
</code>
</a>
</p>
<p>
If
<a class="link" href="innodb-parameters.html#sysvar_innodb_buffer_pool_size">
<code class="literal">
innodb_buffer_pool_size
</code>
</a>
> 1 GiB, then this is the minimum value from the
following two calculated hints in the range of 1-64:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
Buffer pool hint: Calculated as 1/2 of
(
<a class="link" href="innodb-parameters.html#sysvar_innodb_buffer_pool_size">
<code class="literal">
innodb_buffer_pool_size
</code>
</a>
/
<a class="link" href="innodb-parameters.html#sysvar_innodb_buffer_pool_chunk_size">
<code class="literal">
innodb_buffer_pool_chunk_size
</code>
</a>
)
</p>
</li>
<li class="listitem">
<p>
CPU hint: Calculated as 1/4 of the number of
available logical processors
</p>
</li>
</ul>
</div>
</td>
<td>
8 (or 1 if
<a class="link" href="innodb-parameters.html#sysvar_innodb_buffer_pool_size">
<code class="literal">
innodb_buffer_pool_size
</code>
</a>
<
1 GiB)
</td>
</tr>
<tr>
<td scope="row">
<a class="link" href="innodb-parameters.html#sysvar_innodb_change_buffering">
<code class="literal">
innodb_change_buffering
</code>
</a>
</td>
<td>
<code class="literal">
none
</code>
</td>
<td>
<code class="literal">
all
</code>
</td>
</tr>
<tr>
<td scope="row">
<a class="link" href="innodb-parameters.html#option_mysqld_innodb-dedicated-server">
<code class="option">
--innodb-dedicated-server
</code>
</a>
</td>
<td>
If
<code class="literal">
ON
</code>
<a class="footnote" href="#ftn.idm46045334959312" name="idm46045334959312">
<sup class="footnote">
[a]
</sup>
</a>
, the value of
<a class="link" href="innodb-parameters.html#sysvar_innodb_flush_method">
<code class="literal">
innodb_flush_method
</code>
</a>
is
no longer changed as in MySQL 8.0, but the calculation
of
<a class="link" href="innodb-parameters.html#sysvar_innodb_redo_log_capacity">
<code class="literal">
innodb_redo_log_capacity
</code>
</a>
is changed from memory-based to CPU-based. For more
information, see
<a class="xref" href="innodb-dedicated-server.html" title="17.8.12 Enabling Automatic InnoDB Configuration for a Dedicated MySQL Server">
Section 17.8.12, “Enabling Automatic InnoDB Configuration for a Dedicated MySQL Server”
</a>
.
</td>
<td>
<code class="literal">
OFF
</code>
</td>
</tr>
<tr>
<td scope="row">
<a class="link" href="innodb-parameters.html#sysvar_innodb_adaptive_hash_index">
<code class="literal">
innodb_adaptive_hash_index
</code>
</a>
</td>
<td>
<code class="literal">
OFF
</code>
</td>
<td>
<code class="literal">
ON
</code>
</td>
</tr>
<tr>
<td scope="row">
<a class="link" href="innodb-parameters.html#sysvar_innodb_doublewrite_files">
<code class="literal">
innodb_doublewrite_files
</code>
</a>
</td>
<td>
2
</td>
<td>
<a class="link" href="innodb-parameters.html#sysvar_innodb_buffer_pool_instances">
<code class="literal">
innodb_buffer_pool_instances
</code>
</a>
* 2
</td>
</tr>
<tr>
<td scope="row">
<a class="link" href="innodb-parameters.html#sysvar_innodb_doublewrite_pages">
<code class="literal">
innodb_doublewrite_pages
</code>
</a>
</td>
<td>
128
</td>
<td>
<a class="link" href="innodb-parameters.html#sysvar_innodb_write_io_threads">
<code class="literal">
innodb_write_io_threads
</code>
</a>
, which meant a
default of 4
</td>
</tr>
<tr>
<td scope="row">
<a class="link" href="innodb-parameters.html#sysvar_innodb_flush_method">
<code class="literal">
innodb_flush_method
</code>
</a>
on Linux
</td>
<td>
<code class="literal">
O_DIRECT
</code>
if supported, otherwise
<code class="literal">
fsync
</code>
</td>
<td>
fsync
</td>
</tr>
<tr>
<td scope="row">
<a class="link" href="innodb-parameters.html#sysvar_innodb_io_capacity">
<code class="literal">
innodb_io_capacity
</code>
</a>
</td>
<td>
10000
</td>
<td>
200
</td>
</tr>
<tr>
<td scope="row">
<a class="link" href="innodb-parameters.html#sysvar_innodb_io_capacity_max">
<code class="literal">
innodb_io_capacity_max
</code>
</a>
</td>
<td>
2 *
<a class="link" href="innodb-parameters.html#sysvar_innodb_io_capacity">
<code class="literal">
innodb_io_capacity
</code>
</a>
</td>
<td>
2 *
<a class="link" href="innodb-parameters.html#sysvar_innodb_io_capacity">
<code class="literal">
innodb_io_capacity
</code>
</a>
, with a minimum
default value of 2000
</td>
</tr>
<tr>
<td scope="row">
<a class="link" href="innodb-parameters.html#sysvar_innodb_log_buffer_size">
<code class="literal">
innodb_log_buffer_size
</code>
</a>
</td>
<td>
67108864 (64 MiB)
</td>
<td>
16777216 (16 MiB)
</td>
</tr>
<tr>
<td scope="row">
<a class="link" href="innodb-parameters.html#sysvar_innodb_numa_interleave">
<code class="literal">
innodb_numa_interleave
</code>
</a>
</td>
<td>
<code class="literal">
ON
</code>
</td>
<td>
<code class="literal">
OFF
</code>
</td>
</tr>
<tr>
<td scope="row">
<a class="link" href="innodb-parameters.html#sysvar_innodb_page_cleaners">
<code class="literal">
innodb_page_cleaners
</code>
</a>
</td>
<td>
<a class="link" href="innodb-parameters.html#sysvar_innodb_buffer_pool_instances">
<code class="literal">
innodb_buffer_pool_instances
</code>
</a>
</td>
<td>
4
</td>
</tr>
<tr>
<td scope="row">
<a class="link" href="innodb-parameters.html#sysvar_innodb_parallel_read_threads">
<code class="literal">
innodb_parallel_read_threads
</code>
</a>
</td>
<td>
available logical processors / 8, with a minimum default value of 4
</td>
<td>
4
</td>
</tr>
<tr>
<td scope="row">
<a class="link" href="innodb-parameters.html#sysvar_innodb_purge_threads">
<code class="literal">
innodb_purge_threads
</code>
</a>
</td>
<td>
1 if available logical processors is <= 16, otherwise 4
</td>
<td>
4
</td>
</tr>
<tr>
<td scope="row">
<a class="link" href="innodb-parameters.html#sysvar_innodb_read_io_threads">
<code class="literal">
innodb_read_io_threads
</code>
</a>
</td>
<td>
available logical processors / 2, with a minimum default value of 4
</td>
<td>
4
</td>
</tr>
<tr>
<td scope="row">
<a class="link" href="innodb-parameters.html#sysvar_innodb_use_fdatasync">
<code class="literal">
innodb_use_fdatasync
</code>
</a>
</td>
<td>
<code class="literal">
ON
</code>
</td>
<td>
<code class="literal">
OFF
</code>
</td>
</tr>
<tr>
<td scope="row">
<a class="link" href="server-system-variables.html#sysvar_temptable_max_ram">
<code class="literal">
temptable_max_ram
</code>
</a>
</td>
<td>
3% of total memory, with a default value within a range of 1-4 GiB
</td>
<td>
1073741824 (1 GiB)
</td>
</tr>
<tr>
<td scope="row">
<a class="link" href="server-system-variables.html#sysvar_temptable_max_mmap">
<code class="literal">
temptable_max_mmap
</code>
</a>
</td>
<td>
0, which means
<code class="literal">
OFF
</code>
</td>
<td>
1073741824 (1 GiB)
</td>
</tr>
<tr>
<td scope="row">
<a class="link" href="server-system-variables.html#sysvar_temptable_use_mmap">
<code class="literal">
temptable_use_mmap
</code>
</a>
<a class="footnote" href="#ftn.idm46045334883664" name="idm46045334883664">
<sup class="footnote">
[b]
</sup>
</a>
</td>
<td>
<code class="literal">
OFF
</code>
</td>
<td>
<code class="literal">
ON
</code>
</td>
</tr>
</tbody>
</table>
<div class="footnotes">
<div class="footnote" id="ftn.idm46045334959312">
<p>
<a class="para" href="#idm46045334959312">
<sup class="para">
[a]
</sup>
</a>
The actual default value of this variable is
<code class="literal">
OFF
</code>
; this is unchanged from
MySQL 8.0.
</p>
</div>
<div class="footnote" id="ftn.idm46045334883664">
<p>
<a class="para" href="mysql-nutshell.html#idm46045334883664">
<sup class="para">
[b]
</sup>
</a>
Deprecated in MySQL 8.0.26.
</p>
</div>
</div>
</div>
<div class="table-contents">
<table cellpadding="0" cellspacing="0" style="position: fixed; top: 0px; display: none; left: 431px; width: 771px;">
<thead>
<tr>
<th scope="col" style="width: 258.891px;">
InnoDB System Variable Name
</th>
<th scope="col" style="width: 276.656px;">
New Default Value (MySQL 8.4)
</th>
<th scope="col" style="width: 234.516px;">
Previous Default Value (MySQL 8.0)
</th>
</tr>
</thead>
</table>
</div>
</div>
<br class="table-break"/>
</li>
<li class="listitem">
<p>
<b>
Clone plugin.
</b>
The
<a class="link" href="clone-plugin.html" title="7.6.7 The Clone Plugin">
clone plugin
</a>
versioning requirement was relaxed to allow cloning
between different point releases in the same series. In
other words, only the major and minor version numbers must
match when previously the point release number also had to
match.
</p>
<p>
For example, clone functionality now permits cloning 8.4.0
to 8.4.14 and vice-versa.
</p>
</li>
<li class="listitem">
<p>
<b>
SASL-based LDAP authentication on Windows.
</b>
On Microsoft Windows, the server plugin for SASL-based
LDAP authentication is now supported. This means that
Windows clients can now use GSSAPI/Kerberos for
authenticating with the
<code class="literal">
authentication_ldap_sasl_client
</code>
plugin.
</p>
<p>
For more information, see
<a class="xref" href="ldap-pluggable-authentication.html#ldap-pluggable-authentication-usage-sasl" title="SASL-Based LDAP Authentication (Without Proxying)">
SASL-Based LDAP Authentication (Without Proxying)
</a>
.
</p>
</li>
<li class="listitem">
<p>
<b>
MySQL Replication: SOURCE_RETRY_COUNT change.
</b>
The default value for the
<code class="literal">
SOURCE_RETRY_COUNT
</code>
option of 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 was changed to 10. This means that,
using the default values for this option and for
<code class="literal">
SOURCE_CONNECT_RETRY
</code>
(60), the replica
waits 60 seconds between reconnection attempts, and keeps
attempting to reconnect at this rate for 10 minutes before
timing out and failing over.
</p>
<p>
This change also applies to the default value of the
deprecated
<a class="link" href="replication-options-replica.html#option_mysqld_master-retry-count">
<code class="option">
--master-retry-count
</code>
</a>
server
option. (You should use
<code class="literal">
SOURCE_RETRY_COUNT
</code>
, instead.)
</p>
<p>
For more information, see
<a class="xref" href="replication-asynchronous-connection-failover-source.html" title="19.4.9.1 Asynchronous Connection Failover for Sources">
Section 19.4.9.1, “Asynchronous Connection Failover for Sources”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<b>
MySQL Replication: tagged GTIDs.
</b>
The format of global transaction identifiers (GIDs) used
in MySQL Replication and Group Replication has been
extended to enable identification of groups of
transactions, making it possible to assign a unique name
to the GTIDs which belong to a specific group of
transactions. For example, transactions containing data
operations can easily be distinguished from those arising
from administrative operations simply by comparing their
GTIDs.
</p>
<p>
The new GTID format is
<code class="literal">
UUID:
<em class="replaceable">
<code>
TAG
</code>
</em>
:NUMBER
</code>
,
where
<em class="replaceable">
<code>
TAG
</code>
</em>
is a string of up to 8
characters, which is enabled by setting the value of the
<a class="link" href="replication-options-gtids.html#sysvar_gtid_next">
<code class="literal">
gtid_next
</code>
</a>
system variable
to
<code class="literal">
AUTOMATIC:
<em class="replaceable">
<code>
TAG
</code>
</em>
</code>
,
added in this release (see the description of the variable
for tag format and other information). This tag persists for
all transactions originating in the current session (unless
changed using
<code class="literal">
SET gtid_next
</code>
), and is
applied at commit time for such transactions, or, when using
Group Replication, at certification time. It is also
possible to set
<code class="literal">
gtid_next
</code>
to
<code class="literal">
<em class="replaceable">
<code>
UUID
</code>
</em>
:
<em class="replaceable">
<code>
TAG
</code>
</em>
:
<em class="replaceable">
<code>
NUMBER
</code>
</em>
</code>
to set the UUID of a single transaction to an arbitrary
value, along with assigning it a custom tag. The assignments
of
<code class="literal">
UUID
</code>
and
<code class="literal">
NUMBER
</code>
are
otherwise unchanged from previous MySQL releases. In either
case, the user is responsible for making sure that the tag
is unique to a given replication topology.
</p>
<p>
The original
<code class="literal">
<em class="replaceable">
<code>
UUID
</code>
</em>
:
<em class="replaceable">
<code>
NUMBER
</code>
</em>
</code>
format for GTIDs continues to be supported unchanged, as
implemented in previous versions of MySQL; changes to
existing replication setups using GTIDs are not required.
</p>
<p>
Setting
<code class="literal">
gtid_next
</code>
to
<code class="literal">
AUTOMATIC:
<em class="replaceable">
<code>
TAG
</code>
</em>
</code>
or
<code class="literal">
<em class="replaceable">
<code>
UUID
</code>
</em>
:
<em class="replaceable">
<code>
TAG
</code>
</em>
:
<em class="replaceable">
<code>
NUMBER
</code>
</em>
</code>
requires a new
<a class="link" href="privileges-provided.html#priv_transaction-gtid-tag">
<code class="literal">
TRANSACTION_GTID_TAG
</code>
</a>
privilege which is added in this release; this is true both
on the originating server as well as for the
<code class="literal">
PRIVILEGE_CHECKS_APPLIER
</code>
for the replica
applier thread. This also means that an administrator can
now restrict the use of
<code class="literal">
SET
@gtid_next=AUTOMATIC:
<em class="replaceable">
<code>
TAG
</code>
</em>
</code>
or
<code class="literal">
<em class="replaceable">
<code>
UUID
</code>
</em>
:
<em class="replaceable">
<code>
TAG
</code>
</em>
:
<em class="replaceable">
<code>
NUMBER
</code>
</em>
</code>
to a desired set of MySQL users or roles so that that only
those users related to a given data or operational domain
can commit new transactions with assigned tags.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
When upgrading from a previous version of MySQL to MySQL
8.4, any user accounts or roles which already
have the
<a class="link" href="privileges-provided.html#priv_binlog-admin">
<code class="literal">
BINLOG_ADMIN
</code>
</a>
privilege are automatically granted the
<code class="literal">
TRANSACTION_GTID_TAG
</code>
privilege.
</p>
</div>
<p>
The built-in functions
<a class="link" href="gtid-functions.html#function_gtid-subset">
<code class="literal">
GTID_SUBSET()
</code>
</a>
,
<a class="link" href="gtid-functions.html#function_gtid-subtract">
<code class="literal">
GTID_SUBTRACT()
</code>
</a>
, and
<a class="link" href="gtid-functions.html#function_wait-for-executed-gtid-set">
<code class="literal">
WAIT_FOR_EXECUTED_GTID_SET()
</code>
</a>
are compatible with tagged GTIDs.
</p>
<p>
For more information, see the descriptions of the
<a class="link" href="replication-options-gtids.html#sysvar_gtid_next">
<code class="literal">
gtid_next
</code>
</a>
system variable
and the
<a class="link" href="privileges-provided.html#priv_transaction-gtid-tag">
<code class="literal">
TRANSACTION_GTID_TAG
</code>
</a>
privilege, as well as
<a class="xref" href="replication-mode-change-online.html" title="19.1.4 Changing GTID Mode on Online Servers">
Section 19.1.4, “Changing GTID Mode on Online Servers”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<b>
Replication: SQL_AFTER_GTIDS and MTA.
</b>
The
<a class="link" href="start-replica.html" title="15.4.2.4 START REPLICA Statement">
<code class="literal">
START REPLICA
</code>
</a>
statement
option
<code class="literal">
SQL_AFTER_GTIDS
</code>
is now
compatible with the multi-threaded applier. (Previously,
when MTA was enabled and the user attempted to use this
option, the statement raised the warning
<a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_mta_feature_is_not_supported" target="_top">
<code class="literal">
ER_MTA_FEATURE_IS_NOT_SUPPORTED
</code>
</a>
,
and the replica was switched to single-threaded mode.)
This means that a replica which needs to catch up with
missing transactions can now do so without losing the
performance advantage from multithreading.
</p>
<p>
For more information, see
<a class="xref" href="start-replica.html" title="15.4.2.4 START REPLICA Statement">
Section 15.4.2.4, “START REPLICA Statement”
</a>
,
as well as the documentation for the
<a class="link" href="replication-options-replica.html#sysvar_replica_parallel_workers">
<code class="literal">
replica_parallel_workers
</code>
</a>
system variable. See also
<a class="xref" href="replication-threads-monitor-worker.html" title="19.2.3.2 Monitoring Replication Applier Worker Threads">
Section 19.2.3.2, “Monitoring Replication Applier Worker Threads”
</a>
, and
<a class="xref" href="mysql-cluster-replication-mta.html" title="25.7.11 NDB Cluster Replication Using the Multithreaded Applier">
Section 25.7.11, “NDB Cluster Replication Using the Multithreaded Applier”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<b>
Replication terminology backwards compatibility.
</b>
This release adds the
<a class="link" href="mysqldump.html#option_mysqldump_output-as-version">
<code class="option">
--output-as-version
</code>
</a>
option for
<a class="link" href="mysqldump.html" title="6.5.4 mysqldump — A Database Backup Program">
<span class="command">
<strong>
mysqldump
</strong>
</span>
</a>
. This option
allows you to create a dump from a MySQL 8.2 or newer
server that is compatible with older versions of MySQL;
its value, one of those listed here, determines the
compatibility of replication terminology used in the dump:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<code class="literal">
SERVER
</code>
: Gets the version of the
server and uses the latest versions of replication
statements and variable names compatible with that MySQL
version.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
BEFORE_8_2_0
</code>
: Output is compatible
with MySQL servers running versions 8.0.23 through
8.1.0, inclusive.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
BEFORE_8_0_23
</code>
: Output is compatible
with MySQL servers running versions prior to 8.0.23.
</p>
</li>
</ul>
</div>
<p>
See the description of this option for more information.
</p>
<p>
In addition a new value is added to those already allowed
for the
<a class="link" href="replication-options-replica.html#sysvar_terminology_use_previous">
<code class="literal">
terminology_use_previous
</code>
</a>
system variable.
<code class="literal">
BEFORE_8_2_0
</code>
causes the
server to print
<code class="literal">
DISABLE ON SLAVE
</code>
(now
deprecated) instead of
<code class="literal">
DISABLE ON REPLICA
</code>
in the output of
<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>
. The existing value
<code class="literal">
BEFORE_8_0_26
</code>
now also has this effect in
addition to those it already had previously.
</p>
</li>
<li class="listitem">
<p>
The MySQL version number used in version-specific comments
supports a major version consisting of one or two digits;
this means that the entire version can be either five or six
digits long. For more information about how this change
affects handling of versioned comments in MySQL, see
<a class="xref" href="comments.html" title="11.7 Comments">
Section 11.7, “Comments”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<b>
group_replication_set_as_primary() and DDL statements.
</b>
The
<a class="link" href="group-replication-functions-for-new-primary.html#function_group-replication-set-as-primary">
<code class="literal">
group_replication_set_as_primary()
</code>
</a>
function waits for ongoing DDL statements such as
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER TABLE
</code>
</a>
when waiting
for all transactions to complete, prior to electing a new
primary.
</p>
<p>
For more information, see the description of this function.
</p>
</li>
<li class="listitem">
<p>
<b>
DDL and DCL statement tracking for group_replication_set_as_primary().
</b>
<a class="link" href="group-replication-functions-for-new-primary.html#function_group-replication-set-as-primary">
<code class="literal">
group_replication_set_as_primary()
</code>
</a>
now waits for the following statements to complete before
a new primary is elected:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<a class="link" href="alter-database.html" title="15.1.2 ALTER DATABASE Statement">
<code class="literal">
ALTER DATABASE
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="alter-function.html" title="15.1.4 ALTER FUNCTION Statement">
<code class="literal">
ALTER FUNCTION
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="alter-instance.html" title="15.1.5 ALTER INSTANCE Statement">
<code class="literal">
ALTER INSTANCE
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="alter-procedure.html" title="15.1.7 ALTER PROCEDURE Statement">
<code class="literal">
ALTER PROCEDURE
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="alter-server.html" title="15.1.8 ALTER SERVER Statement">
<code class="literal">
ALTER SERVER
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="alter-tablespace.html" title="15.1.10 ALTER TABLESPACE Statement">
<code class="literal">
ALTER TABLESPACE
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="alter-user.html" title="15.7.1.1 ALTER USER Statement">
<code class="literal">
ALTER USER
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="alter-view.html" title="15.1.11 ALTER VIEW Statement">
<code class="literal">
ALTER VIEW
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="create-database.html" title="15.1.12 CREATE DATABASE Statement">
<code class="literal">
CREATE DATABASE
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="create-function.html" title="15.1.14 CREATE FUNCTION Statement">
<code class="literal">
CREATE FUNCTION
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="create-procedure.html" title="15.1.17 CREATE PROCEDURE and CREATE FUNCTION Statements">
<code class="literal">
CREATE PROCEDURE
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="create-role.html" title="15.7.1.2 CREATE ROLE Statement">
<code class="literal">
CREATE ROLE
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="create-server.html" title="15.1.18 CREATE SERVER Statement">
<code class="literal">
CREATE SERVER
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="create-spatial-reference-system.html" title="15.1.19 CREATE SPATIAL REFERENCE SYSTEM Statement">
<code class="literal">
CREATE SPATIAL REFERENCE
SYSTEM
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="create-tablespace.html" title="15.1.21 CREATE TABLESPACE Statement">
<code class="literal">
CREATE TABLESPACE
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="create-trigger.html" title="15.1.22 CREATE TRIGGER Statement">
<code class="literal">
CREATE TRIGGER
</code>
</a>
</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>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="create-view.html" title="15.1.23 CREATE VIEW Statement">
<code class="literal">
CREATE VIEW
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="drop-database.html" title="15.1.24 DROP DATABASE Statement">
<code class="literal">
DROP DATABASE
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="drop-function.html" title="15.1.26 DROP FUNCTION Statement">
<code class="literal">
DROP FUNCTION
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="drop-procedure.html" title="15.1.29 DROP PROCEDURE and DROP FUNCTION Statements">
<code class="literal">
DROP PROCEDURE
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="drop-role.html" title="15.7.1.4 DROP ROLE Statement">
<code class="literal">
DROP ROLE
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="drop-server.html" title="15.1.30 DROP SERVER Statement">
<code class="literal">
DROP SERVER
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="drop-spatial-reference-system.html" title="15.1.31 DROP SPATIAL REFERENCE SYSTEM Statement">
<code class="literal">
DROP SPATIAL REFERENCE
SYSTEM
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="drop-tablespace.html" title="15.1.33 DROP TABLESPACE Statement">
<code class="literal">
DROP TABLESPACE
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="drop-trigger.html" title="15.1.34 DROP TRIGGER Statement">
<code class="literal">
DROP TRIGGER
</code>
</a>
</p>
</li>
<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>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="drop-view.html" title="15.1.35 DROP VIEW Statement">
<code class="literal">
DROP VIEW
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="grant.html" title="15.7.1.6 GRANT Statement">
<code class="literal">
GRANT
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="rename-table.html" title="15.1.36 RENAME TABLE Statement">
<code class="literal">
RENAME TABLE
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="revoke.html" title="15.7.1.8 REVOKE Statement">
<code class="literal">
REVOKE
</code>
</a>
</p>
</li>
</ul>
</div>
<p>
These are in addition to those statements added in MySQL 8.1
or otherwise already supported in this regard. For more
information, including a listing of all such statements
supported in MySQL 8.3, see the description of the
<a class="link" href="group-replication-functions-for-new-primary.html#function_group-replication-set-as-primary">
<code class="literal">
group_replication_set_as_primary()
</code>
</a>
function.
</p>
</li>
<li class="listitem">
<p>
<b>
Group Replication version compatibility.
</b>
Version compatibility for servers within groups has been
extended as follows:
</p>
<p>
In-place downgrades of servers within groups are supported
within the MySQL 8.4 LTS series. For example, a member of a
group running MySQL 8.4.2 can be downgraded to MySQL 8.4.0.
</p>
<p>
Similarly, cross-version group membership is also supported
within the 8.4 release series. For example, a server running
MySQL 8.4.0 can join a group all of whose members currently
run MySQL 8.4.2, as can a server running MySQL 8.4.3.
</p>
</li>
<li class="listitem">
<p>
<b>
Group Replication variable defaults.
</b>
The default values of two server system variables relating
to Group Replication have been changed in MySQL 8.4:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
The default value of the
<a class="link" href="group-replication-system-variables.html#sysvar_group_replication_consistency">
<code class="literal">
group_replication_consistency
</code>
</a>
system variable was changed to
<code class="literal">
BEFORE_ON_PRIMARY_FAILOVER
</code>
in MySQL
8.4.0. (Previously, it was
<code class="literal">
EVENTUAL
</code>
.)
</p>
</li>
<li class="listitem">
<p>
The default value of the
<a class="link" href="group-replication-system-variables.html#sysvar_group_replication_exit_state_action">
<code class="literal">
group_replication_exit_state_action
</code>
</a>
system variable was changed to
<code class="literal">
OFFLINE_MODE
</code>
in MySQL 8.4.0.
(Previously, it was
<code class="literal">
READ_ONLY
</code>
.)
</p>
</li>
</ul>
</div>
<p>
For more information, see
<a class="xref" href="group-replication-configuring-consistency-guarantees.html" title="20.5.3.2 Configuring Transaction Consistency Guarantees">
Section 20.5.3.2, “Configuring Transaction Consistency Guarantees”
</a>
,
and
<a class="xref" href="group-replication-responses-failure.html" title="20.7.7 Responses to Failure Detection and Network Partitioning">
Section 20.7.7, “Responses to Failure Detection and Network Partitioning”
</a>
,
as well as the descriptions of the variables listed.
</p>
</li>
<li class="listitem">
<p>
Added a number of status variables specific to the Group
Replication plugin that improve diagnosis and
troubleshooting of network instabilities, providing
statistics about network usage, control messages, and data
messages for each group member.
</p>
<p>
See
<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>
,
for more information.
</p>
<p>
As part of this work, a new
<code class="literal">
MEMBER_FAILURE_SUSPICIONS_COUNT
</code>
column
was added to the Performance Schema
<a class="link" href="performance-schema-replication-group-communication-information-table.html" title="29.12.11.10 The replication_group_communication_information Table">
<code class="literal">
replication_group_communication_information
</code>
</a>
table. The contents of this column are formatted as a JSON
array whose keys are group members ID and whose values are
the number of times the group member has been considered
suspect. See the description of this table for more
information.
</p>
</li>
<li class="listitem">
<p>
<b>
FLUSH_PRIVILEGES privilege.
</b>
A new privilege is added in MySQL 8.4.0 specifically to
allow use of
<a class="link" href="flush.html" title="15.7.8.3 FLUSH Statement">
<code class="literal">
FLUSH
PRIVILEGES
</code>
</a>
statements. Unlike the
<a class="link" href="privileges-provided.html#priv_reload">
<code class="literal">
RELOAD
</code>
</a>
privilege, the
<a class="link" href="privileges-provided.html#priv_flush-privileges">
<code class="literal">
FLUSH_PRIVILEGES
</code>
</a>
privilege
applies only to
<code class="literal">
FLUSH PRIVILEGES
</code>
statements.
</p>
<p>
In MySQL 8.4, the
<code class="literal">
RELOAD
</code>
privilege
continues to be supported in this capacity to provide
backwards compatibility.
</p>
<p>
When upgrading, a check is performed to see whether there
are any users having the
<a class="link" href="privileges-provided.html#priv_flush-privileges">
<code class="literal">
FLUSH_PRIVILEGES
</code>
</a>
privilege;
if there are none, any users having the
<a class="link" href="privileges-provided.html#priv_reload">
<code class="literal">
RELOAD
</code>
</a>
privilege are
automatically assigned the new privilege as well.
</p>
<p>
If you downgrade from MySQL 8.4 (or later) to a version of
MySQL which does not support the
<a class="link" href="privileges-provided.html#priv_flush-privileges">
<code class="literal">
FLUSH_PRIVILEGES
</code>
</a>
privilege, a
user previously granted this privilege is unable to execute
<a class="link" href="flush.html" title="15.7.8.3 FLUSH Statement">
<code class="literal">
FLUSH
PRIVILEGES
</code>
</a>
statements unless the user has the
<code class="literal">
RELOAD
</code>
privilege.
</p>
</li>
<li class="listitem">
<p>
<b>
OPTIMIZE_LOCAL_TABLE privilege.
</b>
MySQL 8.4.0 adds a new
<a class="link" href="privileges-provided.html#priv_optimize-local-table">
<code class="literal">
OPTIMIZE_LOCAL_TABLE
</code>
</a>
privilege. Users must have this privilege to execute
<a class="link" href="optimize-table.html" title="15.7.3.4 OPTIMIZE TABLE Statement">
<code class="literal">
OPTIMIZE
LOCAL TABLE
</code>
</a>
and
<a class="link" href="optimize-table.html" title="15.7.3.4 OPTIMIZE TABLE Statement">
<code class="literal">
OPTIMIZE
NO_WRITE_TO_BINLOG TABLE
</code>
</a>
statements.
</p>
<p>
When upgrading from a previous release series, users having
the
<a class="link" href="privileges-provided.html#priv_system-user">
<code class="literal">
SYSTEM_USER
</code>
</a>
privilege are
automatically granted the
<a class="link" href="privileges-provided.html#priv_optimize-local-table">
<code class="literal">
OPTIMIZE_LOCAL_TABLE
</code>
</a>
privilege.
</p>
</li>
<li class="listitem">
<p>
<b>
MySQL Enterprise Data Masking and De-Identification.
</b>
Data-masking components added support for specifying a
dedicated schema to store the related internal table and
masking functions. Previously, the
<code class="literal">
mysql
</code>
system schema provided the only
storage option. The new
<a class="link" href="data-masking-component-variables.html#sysvar_component_masking.masking_database">
<code class="literal">
component_masking.masking_database
</code>
</a>
read-only variable enables setting and persisting an
alternative schema name at server startup.
</p>
</li>
<li class="listitem">
<p>
<b>
Flushing of data masking dictionaries.
</b>
The MySQL Enterprise Data Masking and De-Identification component now includes the ability to flush
the data on the secondary or replica into memory. This can
be done in either of the ways described here:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
A flush can be performed by the user at any time using
the
<a class="link" href="data-masking-component-functions.html#function_masking-dictionaries-flush">
<code class="literal">
masking_dictionaries_flush()
</code>
</a>
function added in this release.
</p>
</li>
<li class="listitem">
<p>
The component can be configured to flush the memory
periodically, leveraging the Scheduler component, by
setting the new
<a class="link" href="data-masking-component-variables.html#sysvar_component_masking.dictionaries_flush_interval_seconds">
<code class="literal">
component_masking.dictionaries_flush_interval_seconds
</code>
</a>
system variable to an appropriate value.
</p>
</li>
</ul>
</div>
<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>
,
and the descriptions of these items.
</p>
</li>
<li class="listitem">
<p>
<b>
Automatic histogram updates.
</b>
MySQL 8.4.0 adds support for automatic updates of
histograms. When this feature is enabled for a given
histogram, it is updated whenever
<a class="link" href="analyze-table.html" title="15.7.3.1 ANALYZE TABLE Statement">
<code class="literal">
ANALYZE TABLE
</code>
</a>
is run on the
table to which it belongs. In addition, automatic
recalculation of persistent statistics by
<a class="link" href="innodb-storage-engine.html" title="Chapter 17 The InnoDB Storage Engine">
<code class="literal">
InnoDB
</code>
</a>
(see
<a class="xref" href="innodb-persistent-stats.html" title="17.8.10.1 Configuring Persistent Optimizer Statistics Parameters">
Section 17.8.10.1, “Configuring Persistent Optimizer Statistics Parameters”
</a>
) also updates
the histogram. Histogram updates continue to use the same
number of buckets as they were originally specified with,
if any.
</p>
<p>
You can enable this feature when specifying the histogram by
including the
<code class="literal">
AUTO UPDATE
</code>
option for the
<a class="link" href="analyze-table.html" title="15.7.3.1 ANALYZE TABLE Statement">
<code class="literal">
ANALYZE TABLE
</code>
</a>
statement. To
disable it, include
<code class="literal">
MANUAL UPDATE
</code>
instead.
<code class="literal">
MANUAL UPDATE
</code>
(no automatic
updates) is the default if neither option is specified.
</p>
<p>
For more information, see
<a class="xref" href="analyze-table.html#analyze-table-histogram-statistics-analysis" title="Histogram Statistics Analysis">
Histogram Statistics Analysis
</a>
.
</p>
</li>
<li class="listitem">
<p>
Added the
<a class="link" href="server-system-variables.html#sysvar_tls_certificates_enforced_validation">
<code class="literal">
tls-certificates-enforced-validation
</code>
</a>
system variable, which permits a DBA to enforce certificate
validation at server startup or when using the
<a class="link" href="alter-instance.html#alter-instance-reload-tls">
<code class="literal">
ALTER INSTANCE RELOAD TLS
</code>
</a>
statement to reload certificates at runtime. With
enforcement enabled, discovering an invalid certificate
halts server invocation at startup, prevents loading invalid
certificates at runtime, and emits warnings. For more
information, see
<a class="xref" href="using-encrypted-connections.html#enforce-certificate-validation" title="Configuring Certificate Validation Enforcement">
Configuring Certificate Validation Enforcement
</a>
.
</p>
</li>
<li class="listitem">
<p>
Added server system variables to control the amount of time
MySQL accounts that connect to a MySQL server using LDAP
pluggable authentication must wait when the LDAP server is
down or unresponsive. The default timeout became 30 seconds
for the following simple and SASL-based LDAP authentication
variables:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<a class="link" href="pluggable-authentication-system-variables.html#sysvar_authentication_ldap_simple_connect_timeout">
<code class="literal">
authentication_ldap_simple_connect_timeout
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="pluggable-authentication-system-variables.html#sysvar_authentication_ldap_simple_response_timeout">
<code class="literal">
authentication_ldap_simple_response_timeout
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="pluggable-authentication-system-variables.html#sysvar_authentication_ldap_sasl_connect_timeout">
<code class="literal">
authentication_ldap_sasl_connect_timeout
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="pluggable-authentication-system-variables.html#sysvar_authentication_ldap_sasl_response_timeout">
<code class="literal">
authentication_ldap_sasl_response_timeout
</code>
</a>
</p>
</li>
</ul>
</div>
<p>
Connection and response timeouts are configurable through
the system variables on Linux platforms only. For more
information, see
<a class="xref" href="ldap-pluggable-authentication.html#ldap-pluggable-authentication-timeouts" title="Setting Timeouts for LDAP Pluggable Authentication">
Setting Timeouts for LDAP Pluggable Authentication
</a>
.
</p>
</li>
<li class="listitem">
<p>
Logging of the shutdown process was enhanced, with the
addition of startup and shutdown messages for the MySQL
server, plugins, and components. Such messages are now also
logged for closing connections. These additions should
facilitate troubleshooting and debugging problems,
particularly in the event that the server takes an
excessively long time to shut down.
</p>
<p>
For more information, see
<a class="xref" href="error-log.html" title="7.4.2 The Error Log">
Section 7.4.2, “The Error Log”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<b>
Additions to server startup and shutdown messages.
</b>
Added the following types of messages to the server
startup and shutdown processes as noted in this list:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
Start and end messages for server initialization when
the server is started with
<a class="link" href="server-options.html#option_mysqld_initialize">
<code class="option">
--initialize
</code>
</a>
or
<a class="link" href="server-options.html#option_mysqld_initialize-insecure">
<code class="option">
--initialize-insecure
</code>
</a>
;
these are in addition to and distinct from those shown
during normal server startup and shutdown.
</p>
</li>
<li class="listitem">
<p>
Start and end messages for
<code class="literal">
InnoDB
</code>
initialization.
</p>
</li>
<li class="listitem">
<p>
Start and end messages for init file execution during
server initialization.
</p>
</li>
<li class="listitem">
<p>
Start and end messages for for execution of compiled-in
statements during server initialization.
</p>
</li>
<li class="listitem">
<p>
Start and end mesages for crash recovery during server
startup (if crash recovery occurs).
</p>
</li>
<li class="listitem">
<p>
Start and end messages for initialization of dynamic
plugins during server startup.
</p>
</li>
<li class="listitem">
<p>
Start and end messages for compoenents initialization
step (apparent during server startup).
</p>
</li>
<li class="listitem">
<p>
Messages for shutdown of replica threads, as well as
graceful and forceful shutdown of connection threads,
during server shutdown.
</p>
</li>
<li class="listitem">
<p>
Start and end messages for shutdown of plugins and
components during server shutdown.
</p>
</li>
<li class="listitem">
<p>
Exit code (return value) information with shutdown
messages during initialization or server shutdown and
end)
</p>
</li>
</ul>
</div>
<p>
In addition, if the server was built using
<a class="link" href="source-configuration-options.html#option_cmake_with_systemd">
<code class="option">
WITH_SYSTEMD
</code>
</a>
, the server now
includes every
<span class="command">
<strong>
systemd
</strong>
</span>
message in the
error log.
</p>
</li>
<li class="listitem">
<p>
Added the
<a class="link" href="show-parse-tree.html" title="15.7.7.26 SHOW PARSE_TREE Statement">
<code class="literal">
SHOW PARSE_TREE
</code>
</a>
statement, which shows the JSON-formatted parse tree for a
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
statement. This
statement is intended for testing and development use only,
and not in production. It is available only in debug builds,
or if MySQL was built from source using the CMake
<a class="link" href="source-configuration-options.html#option_cmake_with_show_parse_tree">
<code class="option">
-DWITH_SHOW_PARSE_TREE
</code>
</a>
option,
and is not included or supported in release builds.
</p>
</li>
<li class="listitem">
<p>
<b>
Thread pool plugin connection information.
</b>
Added thread pool connection information to the MySQL
Performance Schema, as follows:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
Added a
<a class="link" href="performance-schema-tp-connections-table.html" title="29.12.16.1 The tp_connections Table">
<code class="literal">
tp_connections
</code>
</a>
table, with information about each thread pool
connection.
</p>
</li>
<li class="listitem">
<p>
Added the following columns to the
<a class="link" href="performance-schema-tp-thread-state-table.html" title="29.12.16.4 The tp_thread_state Table">
<code class="literal">
tp_thread_state
</code>
</a>
table:
<code class="literal">
TIME_OF_ATTACH
</code>
,
<code class="literal">
MARKED_STALLED
</code>
,
<code class="literal">
STATE
</code>
,
<code class="literal">
EVENT_COUNT
</code>
,
<code class="literal">
ACCUMULATED_EVENT_TIME
</code>
,
<code class="literal">
EXEC_COUNT
</code>
, and
<code class="literal">
ACCUMULATED_EXEC_TIME
</code>
</p>
</li>
<li class="listitem">
<p>
Added the following columns to the
<a class="link" href="performance-schema-tp-thread-group-state-table.html" title="29.12.16.2 The tp_thread_group_state Table">
<code class="literal">
tp_thread_group_state
</code>
</a>
table:
<code class="literal">
EFFECTIVE_MAX_TRANSACTIONS_LIMIT
</code>
,
<code class="literal">
NUM_QUERY_THREADS
</code>
,
<code class="literal">
TIME_OF_LAST_THREAD_CREATION
</code>
,
<code class="literal">
NUM_CONNECT_HANDLER_THREAD_IN_SLEEP
</code>
,
<code class="literal">
THREADS_BOUND_TO_TRANSACTION
</code>
,
<code class="literal">
QUERY_THREADS_COUNT
</code>
, and
<code class="literal">
TIME_OF_EARLIEST_CON_EXPIRE
</code>
.
</p>
</li>
</ul>
</div>
<p>
For more information, see
<a class="xref" href="thread-pool.html" title="7.6.3 MySQL Enterprise Thread Pool">
Section 7.6.3, “MySQL Enterprise Thread Pool”
</a>
, and
<a class="xref" href="performance-schema-thread-pool-tables.html" title="29.12.16 Performance Schema Thread Pool Tables">
Section 29.12.16, “Performance Schema Thread Pool Tables”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<b>
Information Schema PROCESSLIST table usage.
</b>
Although the
<a class="link" href="information-schema-processlist-table.html" title="28.3.23 The INFORMATION_SCHEMA PROCESSLIST Table">
<code class="literal">
INFORMATION_SCHEMA.PROCESSLIST
</code>
</a>
table was deprecated in MySQL 8.0.35 and 8.2.0, interest
remains in tracking its usage. This release adds two
system status variables providing information about
accesses to the
<code class="literal">
PROCESSLIST
</code>
table,
listed here:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<a class="link" href="server-status-variables.html#statvar_Deprecated_use_i_s_processlist_count">
<code class="literal">
Deprecated_use_i_s_processlist_count
</code>
</a>
provides a count of the number of references to the
<code class="literal">
PROCESSLIST
</code>
table in queries since
the server was last started.
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="server-status-variables.html#statvar_Deprecated_use_i_s_processlist_last_timestamp">
<code class="literal">
Deprecated_use_i_s_processlist_last_timestamp
</code>
</a>
stores the time the
<code class="literal">
PROCESSLIST
</code>
table
was last accessed. This is a timestamp value (number of
microseconds since the Unix Epoch).
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
<b>
Hash table optimization for set operations.
</b>
MySQL 8.2 improves performance of statements using the set
operations
<a class="link" href="except.html" title="15.2.4 EXCEPT Clause">
<code class="literal">
EXCEPT
</code>
</a>
and
<a class="link" href="intersect.html" title="15.2.8 INTERSECT Clause">
<code class="literal">
INTERSECT
</code>
</a>
by means of a new
hash table optimization which is enabled automatically for
such statements, and controlled by setting the
<a class="link" href="switchable-optimizations.html#optflag_hash-set-operations">
<code class="literal">
hash_set_operations
</code>
</a>
optimizer switch; to disable this optimization and cause
the optimizer to used the old temporary table optimization
from previous versions of MySQL, set this flag to
<code class="literal">
off
</code>
.
</p>
<p>
The amount of memory allocated for this optimization can be
controlled by setting the value of the
<a class="link" href="server-system-variables.html#sysvar_set_operations_buffer_size">
<code class="literal">
set_operations_buffer_size
</code>
</a>
server system variable; increasing the buffer size can
further improve execution times of some statements using
these operations.
</p>
<p>
See
<a class="xref" href="switchable-optimizations.html" title="10.9.2 Switchable Optimizations">
Section 10.9.2, “Switchable Optimizations”
</a>
, for more
information.
</p>
</li>
<li class="listitem">
<p>
<b>
WITH_LD CMake option.
</b>
<code class="option">
WITH_LD
</code>
: Define whether to use the llvm
lld or mold linker, otherwise use the standard linker.
<a class="link" href="source-configuration-options.html#option_cmake_with_ld">
<code class="option">
WITH_LD
</code>
</a>
also replaces the
<a class="ulink" href="/doc/refman/8.0/en/source-configuration-options.html#option_cmake_use_ld_lld" target="_top">
<code class="option">
USE_LD_LLD
</code>
</a>
CMake option that
was removed in MySQL 8.3.0.
</p>
</li>
<li class="listitem">
<p>
<b>
MySQL Enterprise Firewall enhancements.
</b>
A number of enhancements were made since MySQL 8.0 to
MySQL Enterprise Firewall. These are listed here:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
Stored procedures provided by MySQL Enterprise Firewall now behave in
transactional fashion. When an error occurs during
execution of a firewall stored procedure, an error is
reported, and all changes made by the stored procedure
up to that point in time are rolled back.
</p>
</li>
<li class="listitem">
<p>
Firewall stored procedures now avoid performing
unnecessary combinations of
<a class="link" href="delete.html" title="15.2.2 DELETE Statement">
<code class="literal">
DELETE
</code>
</a>
plus
<a class="link" href="insert.html" title="15.2.7 INSERT Statement">
<code class="literal">
INSERT
</code>
</a>
statements, as
well as those of
<a class="link" href="insert.html" title="15.2.7 INSERT Statement">
<code class="literal">
INSERT
IGNORE
</code>
</a>
plus
<a class="link" href="update.html" title="15.2.17 UPDATE Statement">
<code class="literal">
UPDATE
</code>
</a>
operations, thus
consuming less time and fewer resources, making them
faster and more efficient.
</p>
</li>
<li class="listitem">
<p>
User-based stored procedures and UDFs, deprecated in
MySQL 8.0.26, now raise a deprecation warning.
Specifically calling either of
<code class="literal">
sp_set_firewall_mode()
</code>
or
<code class="literal">
sp_reload_firewall_rules()
</code>
generates
such a warning. See
<a class="xref" href="firewall-reference.html#firewall-stored-routines-account" title="Firewall Account Profile Stored Procedures">
Firewall Account Profile Stored Procedures
</a>
, as
well as
<a class="xref" href="firewall-usage.html#firewall-account-profile-migration" title="Migrating Account Profiles to Group Profiles">
Migrating Account Profiles to Group Profiles
</a>
,
for more information.
</p>
</li>
<li class="listitem">
<p>
MySQL Enterprise Firewall now permits its memory cache to be reloaded
periodically with data stored in the firewall tables.
The
<a class="link" href="firewall-reference.html#sysvar_mysql_firewall_reload_interval_seconds">
<code class="literal">
mysql_firewall_reload_interval_seconds
</code>
</a>
system variable sets the periodic-reload schedule to use
at runtime or it disables reloads by default. Previous
implementations reloaded the cache only at server
startup or when the server-side plugin was reinstalled.
</p>
</li>
<li class="listitem">
<p>
Added the
<a class="link" href="firewall-reference.html#sysvar_mysql_firewall_database">
<code class="literal">
mysql_firewall_database
</code>
</a>
server system variable to enable storing internal
tables, functions, and stored procedures in a custom
schema.
</p>
</li>
<li class="listitem">
<p>
Added the
<code class="filename">
uninstall_firewall.sql
</code>
script to simplify removing an installed firewall.
</p>
</li>
</ul>
</div>
<p>
For more information about firewall stored procedures, see
<a class="xref" href="firewall-reference.html#firewall-stored-routines" title="MySQL Enterprise Firewall Stored Procedures">
MySQL Enterprise Firewall Stored Procedures
</a>
.
</p>
</li>
<li class="listitem">
<p>
<b>
Pluggable authentication.
</b>
Added support for authentication to MySQL Server using
devices such as smart cards, security keys, and biometric
readers in a WebAuthn context. The new WebAuthn
authentication method is based on the FIDO and FIDO2
standards. It uses a pair of plugins,
<code class="literal">
authentication_webauthn
</code>
on the server
side and
<code class="literal">
authentication_webauthn_client
</code>
on the client side. The server-side WebAuthn
authentication plugin is included only in MySQL Enterprise Edition
distributions.
</p>
</li>
<li class="listitem">
<p>
<b>
Keyring migration.
</b>
Migration from a keyring component to a keyring plugin is
supported. To perform such a migration, use the
<a class="link" href="keyring-options.html#option_mysqld_keyring-migration-from-component">
<code class="option">
--keyring-migration-from-component
</code>
</a>
server option introduced in MySQL 8.4.0, setting
<a class="link" href="keyring-options.html#option_mysqld_keyring-migration-source">
<code class="option">
--keyring-migration-source
</code>
</a>
to the name of the source component, and
<a class="link" href="keyring-options.html#option_mysqld_keyring-migration-destination">
<code class="option">
--keyring-migration-destination
</code>
</a>
the name of the target plugin.
</p>
<p>
See
<a class="xref" href="keyring-key-migration.html#keyring-key-migration-using-migration-server" title="Key Migration Using a Migration Server">
Key Migration Using a Migration Server
</a>
,
for more information.
</p>
</li>
<li class="listitem">
<p>
<b>
MySQL Enterprise Audit.
</b>
Added the
<code class="filename">
audit_log_filter_uninstall.sql
</code>
script
to simplify removing MySQL Enterprise Audit.
</p>
</li>
<li class="listitem">
<p>
<b>
New Keywords.
</b>
Keywords added in MySQL 8.4 since MySQL 8.0. Reserved
keywords are marked with (R).
</p>
<p>
<code class="literal">
AUTO
</code>
,
<code class="literal">
BERNOULLI
</code>
,
<code class="literal">
GTIDS
</code>
,
<code class="literal">
LOG
</code>
,
<code class="literal">
MANUAL
</code>
(R),
<code class="literal">
PARALLEL
</code>
(R),
<code class="literal">
PARSE_TREE
</code>
,
<code class="literal">
QUALIFY
</code>
(R),
<code class="literal">
S3
</code>
, and
<code class="literal">
TABLESAMPLE
</code>
(R).
</p>
</li>
<li class="listitem">
<p>
<b>
Preemptive group replication certification garbage collection.
</b>
A system variable added in MySQL 8.4.0
<a class="link" href="group-replication-system-variables.html#sysvar_group_replication_preemptive_garbage_collection">
<code class="literal">
group_replication_preemptive_garbage_collection
</code>
</a>
enables preemptive garbage collection for group
replication running in single-primary mode, keeping only
the write sets for those transactions that have not yet
been committed. This can save time and memory consumption.
An additional system variable
<a class="link" href="group-replication-system-variables.html#sysvar_group_replication_preemptive_garbage_collection_rows_threshold">
<code class="literal">
group_replication_preemptive_garbage_collection_rows_threshold
</code>
</a>
(also introduced in MySQL 8.4.0) sets a lower limit on the
number of certification rows needed to trigger preemptive
garbage collection if it is enabled; the default is
100000.
</p>
<p>
In multi-primary mode, each write set in the certification
information is required from the moment a transaction is
certified until it is committed on all members, which makes
it necessary to detect conflicts between transactions. In
single-primary mode, where we need be concerned only about
transaction dependencies, this is not an issue; this means
write sets need be kept only until certification is
complete.
</p>
<p>
It is not possible to change the group replication mode
between single-primary and multi-primary when
<code class="literal">
group_replication_preemptive_garbage_collection
</code>
is enabled.
</p>
<p>
See
<a class="xref" href="mysql-gr-memory-monitoring-ps-instruments.html" title="20.7.9 Monitoring Group Replication Memory Usage with Performance Schema Memory Instrumentation">
Section 20.7.9, “Monitoring Group Replication Memory Usage with Performance Schema Memory
Instrumentation”
</a>
,
for help with obtaining information about memory consumed by
this process.
</p>
</li>
<li class="listitem">
<p>
<b>
Sanitized relay log recovery.
</b>
In MySQL 8.4.0 and later, it is possible to recover the
relay log with any incomplete transactions removed. The
relay log is now sanitized when the server is started with
<a class="link" href="replication-options-replica.html#sysvar_relay_log_recovery">
<code class="option">
--relay-log-recovery=OFF
</code>
</a>
(the default), meaning that all of the following items are
removed:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
Transactions which remain uncompleted at the end of the
relay log
</p>
</li>
<li class="listitem">
<p>
Relay log files containing incomplete transactions or
parts thereof only
</p>
</li>
<li class="listitem">
<p>
References in the relay log index file to relay log
files which have thus been removed
</p>
</li>
</ul>
</div>
<p>
For more information, see the description of the
<a class="link" href="replication-options-replica.html#sysvar_relay_log_recovery">
<code class="literal">
relay_log_recovery
</code>
</a>
server
system variable.
</p>
</li>
<li class="listitem">
<p>
<b>
MySQL upgrade history file.
</b>
As part of the installation process in MySQL 8.4.0 and
later, a file in JSON format named
<code class="filename">
mysql_upgrade_history
</code>
is created in
the server's data directory, or updated if it already
exists. This file includes information about the MySQL
server version installed, when it was installed, and
whether the release was part of an LTS series or an
Innovation series.
</p>
<p>
A typical
<code class="filename">
mysql_upgrade_history
</code>
file
might look something like this (formatting adjusted for
readability):
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-json"><div class="docs-select-all right" id="sa42758526"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-json"><span class="token punctuation">{</span>
<span class="token property">"file_format"</span><span class="token operator">:</span><span class="token string">"1"</span><span class="token punctuation">,</span>
<span class="token property">"upgrade_history"</span><span class="token operator">:</span>
<span class="token punctuation">[</span>
<span class="token punctuation">{</span>
<span class="token property">"date"</span><span class="token operator">:</span><span class="token string">"2024-03-15 22:02:35"</span><span class="token punctuation">,</span>
<span class="token property">"version"</span><span class="token operator">:</span><span class="token string">"8.4.0"</span><span class="token punctuation">,</span>
<span class="token property">"maturity"</span><span class="token operator">:</span><span class="token string">"LTS"</span><span class="token punctuation">,</span>
<span class="token property">"initialize"</span><span class="token operator">:</span><span class="token boolean">true</span>
<span class="token punctuation">}</span><span class="token punctuation">,</span>
<span class="token punctuation">{</span>
<span class="token property">"date"</span><span class="token operator">:</span><span class="token string">"2024-05-17 17:46:12"</span><span class="token punctuation">,</span>
<span class="token property">"version"</span><span class="token operator">:</span><span class="token string">"8.4.1"</span><span class="token punctuation">,</span>
<span class="token property">"maturity"</span><span class="token operator">:</span><span class="token string">"LTS"</span><span class="token punctuation">,</span>
<span class="token property">"initialize"</span><span class="token operator">:</span><span class="token boolean">false</span>
<span class="token punctuation">}</span>
<span class="token punctuation">]</span>
<span class="token punctuation">}</span></code></pre>
</div>
<p>
In addition, the installation process now checks for the
presence of a
<code class="filename">
mysql_upgrade_info
</code>
file
(deprecated in MySQL 8.0, and is no longer used). If found,
the file is removed.
</p>
</li>
<li class="listitem">
<p>
<b>
mysql client --system-command option.
</b>
The
<a class="link" href="mysql-command-options.html#option_mysql_system-command">
<code class="option">
--system-command
</code>
</a>
option
for 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, available in
MySQL 8.4.3 and later, enables or disables the
<code class="literal">
system
</code>
command.
</p>
<p>
This option is enabled by default. To disable it, use
<a class="link" href="mysql-command-options.html#option_mysql_system-command">
<code class="option">
--system-command=OFF
</code>
</a>
or
<a class="link" href="mysql-command-options.html#option_mysql_skip-system-command">
<code class="option">
--skip-system-command
</code>
</a>
, which
causes the
<code class="literal">
system
</code>
command to be rejected
with an error.
</p>
</li>
</ul>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h3 class="title">
<a name="mysql-nutshell-deprecations">
</a>
Features Deprecated in MySQL 8.4
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045334554448">
</a>
<a class="indexterm" name="idm46045334553440">
</a>
<p>
The following features are deprecated in MySQL 8.4
and may be removed in a future series. Where alternatives are
shown, applications should be updated to use them.
</p>
<p>
For applications that use features deprecated in MySQL
8.4 that have been removed in a later MySQL
version, statements may fail when replicated from a MySQL
8.4 source to a replica running a later version, or
may have different effects on source and replica. To avoid such
problems, applications that use features deprecated in
8.4 should be revised to avoid them and use
alternatives when possible.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<b>
group_replication_allow_local_lower_version_join system variable.
</b>
The
<a class="link" href="group-replication-system-variables.html#sysvar_group_replication_allow_local_lower_version_join">
<code class="literal">
group_replication_allow_local_lower_version_join
</code>
</a>
system variable is deprecated, and setting it causes a
warning
(
<a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_warn_deprecated_syntax_no_replacement" target="_top">
<code class="literal">
ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT
</code>
</a>
)
to be logged.
</p>
<p>
You should expect this variable to be removed in a future
version of MySQL. Since the functionality enabled by setting
<code class="literal">
group_replication_allow_local_lower_version_join
</code>
is no longer useful, no replacement for it is planned.
</p>
</li>
<li class="listitem">
<p>
<b>
Group Replication recovery metadata.
</b>
Group Replication recovery no longer depends on writing of
view change events to the binary log to mark changes in
group membership; instead, when all members of a group are
MySQL version 8.3.0 or later, members share compressed
recovery metadata, and no such event is logged (or
assigned a GTID) when a new member joins the group.
</p>
<p>
Recovery metadata includes the GCS view ID,
<code class="literal">
GTID_SET
</code>
of certified transactions, and
certification information, as well as a list of online
members.
</p>
<p>
Since
<code class="literal">
View_change_log_event
</code>
no longer
plays a role in recovery, the
<a class="link" href="group-replication-system-variables.html#sysvar_group_replication_view_change_uuid">
<code class="literal">
group_replication_view_change_uuid
</code>
</a>
system variable is no longer needed, and so is now
deprecated; expect its removal in a future MySQL release.
You should be aware that no replacement or alternative for
this variable or its functionality is planned, and develop
your applications accordingly.
</p>
</li>
<li class="listitem">
<p>
<b>
WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS() function.
</b>
The
<code class="literal">
WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS()
</code>
SQL function was deprecated in MySQL 8.0, and is no longer
supported as of MySQL 8.2. Attempting to invoke this
function now causes a syntax error.
</p>
<p>
Instead of
<code class="literal">
WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS()
</code>
, it
is recommended that you use
<a class="link" href="gtid-functions.html#function_wait-for-executed-gtid-set">
<code class="literal">
WAIT_FOR_EXECUTED_GTID_SET()
</code>
</a>
,
which allows you to wait for specific GTIDS. This works
regardless of the replication channel or the user client
through which the specified transactions arrive on the
server.
</p>
</li>
<li class="listitem">
<p>
<b>
GTID-based replication and IGNORE_SERVER_IDS.
</b>
When global transaction identifiers (GTIDs) are used for
replication, transactions that have already been applied
are automatically ignored. This means that
<a class="link" href="change-replication-source-to.html#crs-opt-ignore_server_ids">
<code class="literal">
IGNORE_SERVER_IDS
</code>
</a>
is not
compatible with GTID mode. If
<a class="link" href="replication-options-gtids.html#sysvar_gtid_mode">
<code class="literal">
gtid_mode
</code>
</a>
is
<code class="literal">
ON
</code>
,
<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 a non-empty
<code class="literal">
IGNORE_SERVER_IDS
</code>
list is rejected with
an error. Likewise, if any existing replication channel
was created with a list of server IDs to be ignored,
<code class="literal">
SET gtid_mode=ON
</code>
is also rejected.
Before starting GTID-based replication, check for and
clear any ignored server ID lists on the servers involved;
you can do this by checking the output from
<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>
. In
such cases, you can clear the list by issuing
<code class="literal">
CHANGE REPLICATION SOURCE TO
</code>
with an
empty list of server IDs, as shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa656443"><div class="copy-help left">Press ⌘+C to 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">CHANGE</span> <span class="token keyword">REPLICATION</span> <span class="token keyword">SOURCE</span> <span class="token keyword">TO</span> <span class="token keyword">IGNORE_SERVER_IDS</span> <span class="token operator">=</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="replication-gtids-restrictions.html" title="19.1.3.7 Restrictions on Replication with GTIDs">
Section 19.1.3.7, “Restrictions on Replication with GTIDs”
</a>
, for
more information.
</p>
</li>
<li class="listitem">
<p>
<b>
Binary log transaction dependency tracking and logging format.
</b>
Using writeset information for conflict detection has been
found to cause issues with dependency tracking; for this
reason, we now limit the usage of writesets for conflict
checks to when row-based logging is in effect.
</p>
<p>
This means that, in such cases,
<a class="link" href="replication-options-binary-log.html#sysvar_binlog_format">
<code class="literal">
binlog_format
</code>
</a>
must be
<code class="literal">
ROW
</code>
, and
<code class="literal">
MIXED
</code>
is no
longer supported.
</p>
</li>
<li class="listitem">
<p>
<b>
expire_logs_days system variable.
</b>
The
<code class="literal">
expire_logs_days
</code>
server system
variable, deprecated in MySQL 8.0, has been removed.
Attempting to get or set this variable at runtime, or to
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 equivalent option
(
<code class="option">
--expire-logs-days
</code>
), now results in an
error.
</p>
<p>
In place of
<code class="literal">
expire_logs_days
</code>
, use
<a class="link" href="replication-options-binary-log.html#sysvar_binlog_expire_logs_seconds">
<code class="literal">
binlog_expire_logs_seconds
</code>
</a>
,
which allows you to specify expiration periods other than
(only) in an integral number of days.
</p>
</li>
<li class="listitem">
<p>
<b>
Wildcard characters in database grants.
</b>
The use of the characters
<code class="literal">
%
</code>
and
<code class="literal">
_
</code>
as wildcards in database grants was
deprecated in MySQL 8.2.0. You should expect for the
wildcard functionality to removed in a future MySQL
release and for these characters always to be treated as
literals, as they are already whenever the value of the
<a class="link" href="server-system-variables.html#sysvar_partial_revokes">
<code class="literal">
partial_revokes
</code>
</a>
server
system variable is
<code class="literal">
ON
</code>
.
</p>
<p>
In addition, the treatment of
<code class="literal">
%
</code>
by the
server as a synonym for
<code class="literal">
localhost
</code>
when
checking privileges is now also deprecated as of MySQL 8.2.0
and thus subject to removal in a future version of MySQL.
</p>
</li>
<li class="listitem">
<p>
<b>
--character-set-client-handshake option.
</b>
The
<a class="ulink" href="/doc/refman/8.0/en/server-options.html#option_mysqld_character-set-client-handshake" target="_top">
<code class="option">
--character-set-client-handshake
</code>
</a>
server option, originally intended for use with upgrades
from very old versions of MySQL, is now deprecated and a
warning is issued whenever it is used. You should expect
this option to be removed in a future version of MySQL;
applications depending on this option should begin
migration away from it as soon as possible.
</p>
</li>
<li class="listitem">
<p>
<b>
Nonstandard foreign keys.
</b>
The use of non-unique or partial keys as foreign keys is
nonstandard, and is deprecated in MySQL. Beginning with
MySQL 8.4.0, you must explicitly enable such keys by
setting
<a class="link" href="server-system-variables.html#sysvar_restrict_fk_on_non_standard_key">
<code class="literal">
restrict_fk_on_non_standard_key
</code>
</a>
to
<code class="literal">
OFF
</code>
, or by starting the server with
<code class="option">
--skip-restrict-fk-on-non-standard-key
</code>
.
</p>
<p>
<code class="literal">
restrict_fk_on_non_standard_key
</code>
is
<code class="literal">
ON
</code>
by default, which means that trying to
use a nonstandard key as a foreign key in a
<code class="literal">
CREATE
TABLE
</code>
or other SQL statement is rejected with
<a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_warn_deprecated_non_standard_key" target="_top">
<code class="literal">
ER_WARN_DEPRECATED_NON_STANDARD_KEY
</code>
</a>
.
Setting it to
<code class="literal">
ON
</code>
allows such statements
to run, but they raise the same error as a warning.
</p>
<p>
Upgrades from MySQL 8.0 are supported even if there are
tables containing foreign keys referring to non-unique or
partial keys. In such cases, the server writes a list of
warning messages containing the names of any foreign keys
which refer to nonstandard keys.
</p>
</li>
</ul>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h3 class="title">
<a name="mysql-nutshell-removals">
</a>
Features Removed in MySQL 8.4
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045334494800">
</a>
<a class="indexterm" name="idm46045334493792">
</a>
<p>
The following items are obsolete and have been removed in MySQL
8.4. Where alternatives are shown, applications
should be updated to use them.
</p>
<p>
For MySQL 8.3 applications that use features
removed in MySQL 8.4, statements may fail when
replicated from a MySQL 8.3 source to a MySQL
8.4 replica, or may have different effects on
source and replica. To avoid such problems, applications that
use features removed in MySQL 8.4 should be revised
to avoid them and use alternatives when possible.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<b>
Server options and variables removed.
</b>
A number of server options and variables supported in
previous versions of MySQL have been removed in MySQL 8.4.
Attempting to set any of them in MySQL 8.4 raises an
error. These options and variables are listed here:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<code class="literal">
binlog_transaction_dependency_tracking
</code>
:
Deprecated in MySQL 8.0.35 and MySQL 8.2.0. There are no
plans to replace this variable or its functionality,
which has been made internal to the server. In MySQL 8.4
(and later), when multithreaded replicas are in use, the
source
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
uses always writesets
to generate dependency information for the binary log;
this has the same effect as setting
<code class="literal">
binlog_transaction_dependency_tracking
</code>
to
<code class="literal">
WRITESET
</code>
in previous versions of
MySQL.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
group_replication_recovery_complete_at
</code>
:
Deprecated in MySQL 8.0.34. In MySQL 8.4 and later, the
policy applied during the distributed recovery process
is always to mark a new member online only after it has
received, certified, and applied all transactions that
took place before it joined the group; this is
equivalent to setting
<code class="literal">
group_replication_recovery_complete_at
</code>
to
<code class="literal">
TRANSACTIONS_APPLIED
</code>
in previous
versions of MySQL.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
avoid_temporal_upgrade
</code>
and
<code class="literal">
show_old_temporals
</code>
: Both of these
variables were deprecated in MySQL 5.6; neither of them
had any effect in recent versions of MySQL. Both
variables have been removed; there are no plans to
replace either of them.
</p>
</li>
<li class="listitem">
<p>
<code class="option">
--no-dd-upgrade
</code>
: Deprecated in MySQL
8.0.16, now removed. Use
<a class="link" href="server-options.html#option_mysqld_upgrade">
<code class="option">
--upgrade=NONE
</code>
</a>
instead.
</p>
</li>
<li class="listitem">
<p>
<code class="option">
--old
</code>
and
<code class="option">
--new
</code>
: Both
deprecated in MySQL 8.0.35 and MySQL 8.2.0, and now
removed.
</p>
</li>
<li class="listitem">
<p>
<code class="option">
--language
</code>
: Deprecated in MySQL 5.5,
and now removed.
</p>
</li>
<li class="listitem">
<p>
The
<code class="option">
--ssl
</code>
and
<code class="option">
--admin-ssl
</code>
server options, as well as
the
<code class="literal">
have_ssl
</code>
and
<code class="literal">
have_openssl
</code>
server system variables,
were deprecated in MySQL 8.0.26. They are all removed in
this release. Use
<a class="link" href="server-system-variables.html#sysvar_tls_version">
<code class="option">
--tls-version
</code>
</a>
and
<a class="link" href="server-system-variables.html#sysvar_admin_tls_version">
<code class="option">
--admin-tls-version
</code>
</a>
instead.
</p>
</li>
<li class="listitem">
<p>
The
<code class="literal">
default_authentication_plugin
</code>
system variable, deprecated in MySQL 8.0.27, is removed
as of MySQL 8.4.0. Use
<a class="link" href="server-system-variables.html#sysvar_authentication_policy">
<code class="literal">
authentication_policy
</code>
</a>
instead.
</p>
<p>
As part of the removal of
<code class="literal">
default_authentication_plugin
</code>
, the
syntax for
<code class="literal">
authentication_policy
</code>
has
been changed. See the description of
<a class="link" href="server-system-variables.html#sysvar_authentication_policy">
<code class="literal">
authentication_policy
</code>
</a>
for more information.
</p>
</li>
<li class="listitem">
<p>
<b>
--skip-host-cache server option.
</b>
This option has been removed; start the server with
<a class="link" href="server-system-variables.html#sysvar_host_cache_size">
<code class="option">
--host-cache-size=0
</code>
</a>
instead. See
<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>
.
</p>
</li>
<li class="listitem">
<p>
<b>
--innodb and --skip-innodb server options.
</b>
These options have been removed. The
<a class="link" href="innodb-storage-engine.html" title="Chapter 17 The InnoDB Storage Engine">
<code class="literal">
InnoDB
</code>
</a>
storage engine is
always enabled, and it is not possible to disable it.
</p>
</li>
<li class="listitem">
<p>
<b>
--character-set-client-handshake and --old-style-user-limits server
options.
</b>
These options were formerly used for compatibility
with very old versions of MySQL which are no longer
supported or maintained, and thus no longer serve any
useful purpose.
</p>
</li>
<li class="listitem">
<p>
<b>
FLUSH HOSTS statement.
</b>
The
<code class="literal">
FLUSH HOSTS
</code>
statement,
deprecated in MySQL 8.0.23, has been removed. To clear
the host cache, issue
<a class="link" href="truncate-table.html" title="15.1.37 TRUNCATE TABLE Statement">
<code class="literal">
TRUNCATE
TABLE
</code>
</a>
<a class="link" href="performance-schema-host-cache-table.html" title="29.12.22.3 The host_cache Table">
<code class="literal">
performance_schema.host_cache
</code>
</a>
or
<a class="link" href="mysqladmin.html" title="6.5.2 mysqladmin — A MySQL Server Administration Program">
<span class="command">
<strong>
mysqladmin flush-hosts
</strong>
</span>
</a>
.
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
<b>
Obsolete replication options and variables.
</b>
A number of options and variables relating to MySQL
Replication were deprecated in previous versions of MySQL,
and have been removed from MySQL 8.4.
Attempting to use any of these now causes the server to
raise a syntax error. These options and variables are
listed here:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<code class="option">
--slave-rows-search-algorithms
</code>
: The
algorithm used by the replication applier to look up
table rows when applying updates or deletes is now
always
<code class="literal">
HASH_SCAN,INDEX_SCAN
</code>
, and is
no longer configurable by the user.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
log_bin_use_v1_events
</code>
: This allowed
source servers running MySQL 5.7 and newer to replicate
to earlier versions of MySQL which are no longer
supported or maintained.
</p>
</li>
<li class="listitem">
<p>
<code class="option">
--relay-log-info-file
</code>
,
<code class="option">
--relay-log-info-repository
</code>
,
<code class="option">
--master-info-file
</code>
,
<code class="option">
--master-info-repository
</code>
: The use of
files for the applier metadata repository and the
connection metadata repository has been superseded by
crash-safe tables, and is no longer supported. See
<a class="xref" href="replica-logs-status.html" title="19.2.4.2 Replication Metadata Repositories">
Section 19.2.4.2, “Replication Metadata Repositories”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
transaction_write_set_extraction
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
group_replication_ip_whitelist
</code>
: Use
<a class="link" href="group-replication-system-variables.html#sysvar_group_replication_ip_allowlist">
<code class="literal">
group_replication_ip_allowlist
</code>
</a>
instead.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
group_replication_primary_member
</code>
: No
longer needed; check the
<code class="literal">
MEMBER_ROLE
</code>
column of the Performance Schema
<a class="link" href="performance-schema-replication-group-members-table.html" title="29.12.11.16 The replication_group_members Table">
<code class="literal">
replication_group_members
</code>
</a>
table instead.
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
<b>
Replication SQL syntax.
</b>
A number of SQL statements used in MySQL Replication which
were deprecated in earlier versions of MySQL are no longer
supported in MySQL 8.4. Attempting to use any of these
statements now produces a syntax error. These statements
can be divided into two groups those relating to source
servers, and those referring to replicas, as shown here:
</p>
<p>
As part of this work, the
<code class="literal">
DISABLE ON
SLAVE
</code>
option for
<a class="link" href="create-event.html" title="15.1.13 CREATE EVENT Statement">
<code class="literal">
CREATE
EVENT
</code>
</a>
and
<a class="link" href="alter-event.html" title="15.1.3 ALTER EVENT Statement">
<code class="literal">
ALTER
EVENT
</code>
</a>
is now deprecated, and is superseded by
<code class="literal">
DISABLE ON REPLICA
</code>
. The corresponding
term
<code class="literal">
SLAVESIDE_DISABLED
</code>
is also now
deprecated,and no longer used in event descriptions such as
in 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;
<code class="literal">
REPLICA_SIDE_DISABLED
</code>
is now shown
instead.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
Statements which have been removed, which relate to
replication source servers, are listed here:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: square; ">
<li class="listitem">
<p>
<code class="literal">
CHANGE MASTER TO
</code>
: Use
<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>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
RESET MASTER
</code>
: Use
<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>
</li>
<li class="listitem">
<p>
<code class="literal">
SHOW MASTER STATUS
</code>
: Use
<a class="link" href="show-binary-log-status.html" title="15.7.7.1 SHOW BINARY LOG STATUS Statement">
<code class="literal">
SHOW BINARY LOG
STATUS
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
PURGE MASTER LOGS
</code>
: Use
<a class="link" href="purge-binary-logs.html" title="15.4.1.1 PURGE BINARY LOGS Statement">
<code class="literal">
PURGE BINARY LOGS
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
SHOW MASTER LOGS
</code>
: Use
<a class="link" href="show-binary-logs.html" title="15.7.7.2 SHOW BINARY LOGS Statement">
<code class="literal">
SHOW BINARY LOGS
</code>
</a>
.
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
Removed SQL statements relating to replicas are listed
here:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: square; ">
<li class="listitem">
<p>
<code class="literal">
START SLAVE
</code>
: Use
<a class="link" href="start-replica.html" title="15.4.2.4 START REPLICA Statement">
<code class="literal">
START REPLICA
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
STOP SLAVE
</code>
: Use
<a class="link" href="stop-replica.html" title="15.4.2.5 STOP REPLICA Statement">
<code class="literal">
STOP REPLICA
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
SHOW SLAVE STATUS
</code>
: Use
<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>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
SHOW SLAVE HOSTS
</code>
: Use
<a class="link" href="show-replicas.html" title="15.7.7.36 SHOW REPLICAS Statement">
<code class="literal">
SHOW REPLICAS
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
RESET SLAVE
</code>
: Use
<a class="link" href="reset-replica.html" title="15.4.2.3 RESET REPLICA Statement">
<code class="literal">
RESET REPLICA
</code>
</a>
.
</p>
</li>
</ul>
</div>
</li>
</ul>
</div>
<p>
All of the statements listed previously were removed from
MySQL test programs and files, as well as from any other
internal use.
</p>
<p>
In addition, a number of deprecated options formerly
supported by
<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>
and
<a class="link" href="start-replica.html" title="15.4.2.4 START REPLICA Statement">
<code class="literal">
START
REPLICA
</code>
</a>
have been removed and are no longer
accepted by the server. The removed options for each of
these SQL statements are listed next.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
Options removed from
<code class="literal">
CHANGE REPLICATION SOURCE
TO
</code>
are listed here:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: square; ">
<li class="listitem">
<p>
<code class="literal">
MASTER_AUTO_POSITION
</code>
: Use
<a class="link" href="change-replication-source-to.html#crs-opt-source_auto_position">
<code class="literal">
SOURCE_AUTO_POSITION
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
MASTER_HOST
</code>
: Use
<a class="link" href="change-replication-source-to.html#crs-opt-source_host">
<code class="literal">
SOURCE_HOST
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
MASTER_BIND
</code>
: Use
<a class="link" href="change-replication-source-to.html#crs-opt-source_bind">
<code class="literal">
SOURCE_BIND
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
MASTER_UseR
</code>
: Use
<a class="link" href="change-replication-source-to.html#crs-opt-source_user">
<code class="literal">
SOURCE_UseR
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
MASTER_PASSWORD
</code>
: Use
<a class="link" href="change-replication-source-to.html#crs-opt-source_password">
<code class="literal">
SOURCE_PASSWORD
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
MASTER_PORT
</code>
: Use
<a class="link" href="change-replication-source-to.html#crs-opt-source_port">
<code class="literal">
SOURCE_PORT
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
MASTER_CONNECT_RETRY
</code>
: Use
<a class="link" href="change-replication-source-to.html#crs-opt-source_connect_retry">
<code class="literal">
SOURCE_CONNECT_RETRY
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
MASTER_RETRY_COUNT
</code>
: Use
<a class="link" href="change-replication-source-to.html#crs-opt-source_retry_count">
<code class="literal">
SOURCE_RETRY_COUNT
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
MASTER_DELAY
</code>
: Use
<a class="link" href="change-replication-source-to.html#crs-opt-source_delay">
<code class="literal">
SOURCE_DELAY
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
MASTER_SSL
</code>
: Use
<a class="link" href="change-replication-source-to.html#crs-opt-source_ssl">
<code class="literal">
SOURCE_SSL
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
MASTER_SSL_CA
</code>
: Use
<a class="link" href="change-replication-source-to.html#crs-opt-source_ssl_xxx">
<code class="literal">
SOURCE_SSL_CA
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
MASTER_SSL_CAPATH
</code>
: Use
<a class="link" href="change-replication-source-to.html#crs-opt-source_ssl_xxx">
<code class="literal">
SOURCE_SSL_CAPATH
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
MASTER_SSL_CIPHER
</code>
: Use
<a class="link" href="change-replication-source-to.html#crs-opt-source_ssl_xxx">
<code class="literal">
SOURCE_SSL_CIPHER
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
MASTER_SSL_CRL
</code>
: Use
<a class="link" href="change-replication-source-to.html#crs-opt-source_ssl_xxx">
<code class="literal">
SOURCE_SSL_CRL
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
MASTER_SSL_CRLPATH
</code>
: Use
<a class="link" href="change-replication-source-to.html#crs-opt-source_ssl_xxx">
<code class="literal">
SOURCE_SSL_CRLPATH
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
MASTER_SSL_KEY
</code>
: Use
<a class="link" href="change-replication-source-to.html#crs-opt-source_ssl_xxx">
<code class="literal">
SOURCE_SSL_KEY
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
MASTER_SSL_VERIFY_SERVER_CERT
</code>
:
Use
<a class="link" href="change-replication-source-to.html#crs-opt-source_ssl_xxx">
<code class="literal">
SOURCE_SSL_VERIFY_SERVER_CERT
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
MASTER_TLS_VERSION
</code>
: Use
<a class="link" href="change-replication-source-to.html#crs-opt-source_ssl_xxx">
<code class="literal">
SOURCE_TLS_VERSION
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
MASTER_TLS_CIPHERSUITES
</code>
: Use
<a class="link" href="change-replication-source-to.html#crs-opt-source_ssl_xxx">
<code class="literal">
SOURCE_TLS_CIPHERSUITES
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
MASTER_SSL_CERT
</code>
: Use
<a class="link" href="change-replication-source-to.html#crs-opt-source_ssl_xxx">
<code class="literal">
SOURCE_SSL_CERT
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
MASTER_PUBLIC_KEY_PATH
</code>
: Use
<a class="link" href="change-replication-source-to.html#crs-opt-source_public_key_path">
<code class="literal">
SOURCE_PUBLIC_KEY_PATH
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
GET_MASTER_PUBLIC_KEY
</code>
: Use
<a class="link" href="change-replication-source-to.html#crs-opt-get_source_public_key">
<code class="literal">
GET_SOURCE_PUBLIC_KEY
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
MASTER_HEARTBEAT_PERIOD
</code>
: Use
<a class="link" href="change-replication-source-to.html#crs-opt-source_heartbeat_period">
<code class="literal">
SOURCE_HEARTBEAT_PERIOD
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
MASTER_COMPRESSION_ALGORITHMS
</code>
:
Use
<a class="link" href="change-replication-source-to.html#crs-opt-source_compression_algorithms">
<code class="literal">
SOURCE_COMPRESSION_ALGORITHMS
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
MASTER_ZSTD_COMPRESSION_LEVEL
</code>
:
Use
<a class="link" href="change-replication-source-to.html#crs-opt-source_zstd_compression_level">
<code class="literal">
SOURCE_ZSTD_COMPRESSION_LEVEL
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
MASTER_LOG_FILE
</code>
: Use
<a class="link" href="change-replication-source-to.html#crs-opt-source_log_file">
<code class="literal">
SOURCE_LOG_FILE
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
MASTER_LOG_POS
</code>
: Use
<a class="link" href="change-replication-source-to.html#crs-opt-source_log_file">
<code class="literal">
SOURCE_LOG_POS
</code>
</a>
.
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
Options removed from the
<code class="literal">
START
REPLICA
</code>
statement are listed here:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: square; ">
<li class="listitem">
<p>
<code class="literal">
MASTER_LOG_FILE
</code>
: Use
<code class="literal">
SOURCE_LOG_FILE
</code>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
MASTER_LOG_POS
</code>
: Use
<code class="literal">
SOURCE_LOG_POS
</code>
.
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
<b>
System variables and NULL.
</b>
It is not intended or supported for a MySQL server
startup option to be set to NULL
(
<code class="option">
--my-option=NULL
</code>
) and have it
interpreted by the server as SQL
<code class="literal">
NULL
</code>
, and should not be possible.
MySQL 8.1 (and later) specifically disallows setting
startup options to
<code class="literal">
NULL
</code>
in this
fashion, and rejects an attempt to do with an error.
Attempts to set the corresponding server system
variables to
<code class="literal">
NULL
</code>
using
<a class="link" href="set-variable.html" title="15.7.6.1 SET Syntax for Variable Assignment">
<code class="literal">
SET
</code>
</a>
or similar 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 are
also rejected.
</p>
<p>
The server system variables in the following list are
excepted from the restriction just described:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: square; ">
<li class="listitem">
<p>
<a class="link" href="server-system-variables.html#sysvar_admin_ssl_ca">
<code class="literal">
admin_ssl_ca
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="server-system-variables.html#sysvar_admin_ssl_capath">
<code class="literal">
admin_ssl_capath
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="server-system-variables.html#sysvar_admin_ssl_cert">
<code class="literal">
admin_ssl_cert
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="server-system-variables.html#sysvar_admin_ssl_cipher">
<code class="literal">
admin_ssl_cipher
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="server-system-variables.html#sysvar_admin_tls_ciphersuites">
<code class="literal">
admin_tls_ciphersuites
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="server-system-variables.html#sysvar_admin_ssl_key">
<code class="literal">
admin_ssl_key
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="server-system-variables.html#sysvar_admin_ssl_crl">
<code class="literal">
admin_ssl_crl
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="server-system-variables.html#sysvar_admin_ssl_crlpath">
<code class="literal">
admin_ssl_crlpath
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="server-system-variables.html#sysvar_basedir">
<code class="literal">
basedir
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="server-system-variables.html#sysvar_character_sets_dir">
<code class="literal">
character_sets_dir
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="server-system-variables.html#sysvar_ft_stopword_file">
<code class="literal">
ft_stopword_file
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="group-replication-system-variables.html#sysvar_group_replication_recovery_tls_ciphersuites">
<code class="literal">
group_replication_recovery_tls_ciphersuites
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="server-system-variables.html#sysvar_init_file">
<code class="literal">
init_file
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="server-system-variables.html#sysvar_lc_messages_dir">
<code class="literal">
lc_messages_dir
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="server-system-variables.html#sysvar_plugin_dir">
<code class="literal">
plugin_dir
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="replication-options-replica.html#sysvar_relay_log">
<code class="literal">
relay_log
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="ulink" href="/doc/refman/8.0/en/replication-options-replica.html#sysvar_relay_log_info_file" target="_top">
<code class="literal">
relay_log_info_file
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="replication-options-replica.html#sysvar_replica_load_tmpdir">
<code class="literal">
replica_load_tmpdir
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="server-system-variables.html#sysvar_ssl_ca">
<code class="literal">
ssl_ca
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="server-system-variables.html#sysvar_ssl_capath">
<code class="literal">
ssl_capath
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="server-system-variables.html#sysvar_ssl_cert">
<code class="literal">
ssl_cert
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="server-system-variables.html#sysvar_ssl_cipher">
<code class="literal">
ssl_cipher
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="server-system-variables.html#sysvar_ssl_crl">
<code class="literal">
ssl_crl
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="server-system-variables.html#sysvar_ssl_crlpath">
<code class="literal">
ssl_crlpath
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="server-system-variables.html#sysvar_ssl_key">
<code class="literal">
ssl_key
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="server-system-variables.html#sysvar_socket">
<code class="literal">
socket
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="server-system-variables.html#sysvar_tls_ciphersuites">
<code class="literal">
tls_ciphersuites
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="server-system-variables.html#sysvar_tmpdir">
<code class="literal">
tmpdir
</code>
</a>
</p>
</li>
</ul>
</div>
<p>
See also
<a class="xref" href="server-system-variables.html" title="7.1.8 Server System Variables">
Section 7.1.8, “Server System Variables”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<b>
Identifiers with an initial dollar sign.
</b>
The use of the dollar sign (
<code class="literal">
$
</code>
) as
the initial character of an unquoted identifier was
deprecated in MySQL 8.0, and is restricted in MySQL
8.1 and later; using an unquoted identifier beginning
with a dollar sign and containing one or more dollar
signs (in addition to the first one) now generates a
syntax error.
</p>
<p>
Unquoted identifiers starting with
<code class="literal">
$
</code>
are not affected by this restriction if they do not
contain any additional
<code class="literal">
$
</code>
characters.
</p>
<p>
See
<a class="xref" href="identifiers.html" title="11.2 Schema Object Names">
Section 11.2, “Schema Object Names”
</a>
.
</p>
</li>
</ul>
</div>
<p>
Also as part of this work, the following server status
variables, previously deprecated, have been removed. They
are listed here, along with their replacements:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<code class="literal">
Com_slave_start
</code>
: Use
<code class="literal">
Com_replica_start
</code>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
Com_slave_stop
</code>
: Use
<code class="literal">
Com_replica_stop
</code>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
Com_show_slave_status
</code>
: Use
<code class="literal">
Com_show_replica_status
</code>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
Com_show_slave_hosts
</code>
: Use
<code class="literal">
Com_show_replicas
</code>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
Com_show_master_status
</code>
: Use
<code class="literal">
Com_show_binary_log_status
</code>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
Com_change_master
</code>
: Use
<code class="literal">
Com_change_replication_source
</code>
.
</p>
</li>
</ul>
</div>
<p>
The variables just listed as removed no longer appear in the
output of statements such as
<a class="link" href="show-status.html" title="15.7.7.37 SHOW STATUS Statement">
<code class="literal">
SHOW
STATUS
</code>
</a>
. See also
<a class="xref" href="server-status-variables.html#statvar_Com_xxx">
Com_xxx Variables
</a>
.
</p>
</li>
<li class="listitem">
<p>
<b>
Plugins.
</b>
A number of plugins were removed in MySQL 8.4.0, and are
listed here, along with any system variables and other
features associated with them which were also removed or
otherwise affected by the plugin removal:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<code class="literal">
authentication_fido
</code>
and
<code class="literal">
authentication_fido_client
</code>
plugins:
Use the
<code class="literal">
authentication_webauthn
</code>
plugin instead. See
<a class="xref" href="webauthn-pluggable-authentication.html" title="8.4.1.11 WebAuthn Pluggable Authentication">
Section 8.4.1.11, “WebAuthn Pluggable Authentication”
</a>
.
</p>
<p>
The
<code class="literal">
authentication_fido_rp_id
</code>
server
system variable,
<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
<code class="option">
--fido-register-factor
</code>
option, and the
<code class="option">
-DWITH_FIDO
</code>
CMake option were also
removed.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
keyring_file
</code>
plugin: Use the
<code class="literal">
component_keyring_file
</code>
component
instead. See
<a class="xref" href="keyring-file-component.html" title="8.4.4.4 Using the component_keyring_file File-Based Keyring Component">
Section 8.4.4.4, “Using the component_keyring_file File-Based Keyring Component”
</a>
.
</p>
<p>
The
<code class="literal">
keyring_file_data
</code>
system variable
was also removed. In addition, the CMake options
<code class="option">
-DINSTALL_MYSQLKEYRINGDIR
</code>
and
<code class="option">
-DWITH_KEYRING_TEST
</code>
were removed.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
keyring_encrypted_file
</code>
plugin: Use
the
<code class="literal">
component_keyring_encrypted_file
</code>
component instead. See
<a class="xref" href="keyring-encrypted-file-component.html" title="8.4.4.5 Using the component_keyring_encrypted_file Encrypted File-Based Keyring Component">
Section 8.4.4.5, “Using the component_keyring_encrypted_file Encrypted File-Based Keyring
Component”
</a>
.
</p>
<p>
The
<code class="literal">
keyring_encrypted_file_data
</code>
and
<code class="literal">
keyring_encrypted_file_password
</code>
system variables were also removed.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
keyring_oci
</code>
plugin: Use the
<code class="literal">
component_keyring_oci
</code>
component
instead. See
<a class="xref" href="keyring-oci-component.html" title="8.4.4.9 Using the Oracle Cloud Infrastructure Vault Keyring Component">
Section 8.4.4.9, “Using the Oracle Cloud Infrastructure Vault Keyring Component”
</a>
.
</p>
<p>
The following server system variables were also removed:
<code class="literal">
keyring_oci_ca_certificate
</code>
,
<code class="literal">
keyring_oci_compartment
</code>
,
<code class="literal">
keyring_oci_encryption_endpoint
</code>
,
<code class="literal">
keyring_oci_key_file
</code>
,
<code class="literal">
keyring_oci_key_fingerprint
</code>
,
<code class="literal">
keyring_oci_management_endpoint
</code>
,
<code class="literal">
keyring_oci_master_key
</code>
,
<code class="literal">
keyring_oci_secrets_endpoint
</code>
,
<code class="literal">
keyring_oci_tenancy
</code>
,
<code class="literal">
keyring_oci_user
</code>
,
<code class="literal">
keyring_oci_vaults_endpoint
</code>
, and
<code class="literal">
keyring_oci_virtual_vault
</code>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
openssl_udf
</code>
plugin: Use the
MySQL Enterprise Encryption
(
<code class="literal">
component_enterprise_encryption
</code>
)
component instead; see
<a class="xref" href="enterprise-encryption.html" title="8.6 MySQL Enterprise Encryption">
Section 8.6, “MySQL Enterprise Encryption”
</a>
.
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
<b>
Support for weak ciphers.
</b>
When configuring encrypted connections, MySQL 8.4.0 and
later no longer allow specifying any cipher that does not
meet the following requirements:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
Conforms to proper TLS version (TLS v1.2 or TLSv1.3, as
appropriate)
</p>
</li>
<li class="listitem">
<p>
Provides perfect forward secrecy
</p>
</li>
<li class="listitem">
<p>
Uses SHA2 in cipher, certificate, or both
</p>
</li>
<li class="listitem">
<p>
Uses AES in GCM or any other AEAD algorithms or modes
</p>
</li>
</ul>
</div>
<p>
This has implications for setting the following system
variables:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<a class="link" href="server-system-variables.html#sysvar_ssl_cipher">
<code class="literal">
ssl_cipher
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="server-system-variables.html#sysvar_admin_ssl_cipher">
<code class="literal">
admin_ssl_cipher
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="server-system-variables.html#sysvar_tls_ciphersuites">
<code class="literal">
tls_ciphersuites
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="server-system-variables.html#sysvar_admin_tls_ciphersuites">
<code class="literal">
admin_tls_ciphersuites
</code>
</a>
</p>
</li>
</ul>
</div>
<p>
See the descriptions of these variables for their permitted
values in MySQL 8.4, and more information.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
<code class="literal">
libmysqlclient
</code>
continues to support
additional ciphers that do not satisfy these conditions in
order to retain the ability to connect to older versions
of MySQL.
</p>
</div>
</li>
<li class="listitem">
<p>
<b>
INFORMATION_SCHEMA.TABLESPACES.
</b>
The
<code class="literal">
INFORMATION_SCHEMA.TABLESPACES
</code>
table, which was not actually used, was deprecated in
MySQL 8.0.22 and has now been removed.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
For
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
tables, the
Information Schema
<a class="link" href="information-schema-files-table.html" title="28.3.15 The INFORMATION_SCHEMA FILES Table">
<code class="literal">
FILES
</code>
</a>
table provides tablespace-related information.
</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, the
Information Schema
<a class="link" href="information-schema-innodb-tablespaces-table.html" title="28.4.24 The INFORMATION_SCHEMA INNODB_TABLESPACES Table">
<code class="literal">
INNODB_TABLESPACES
</code>
</a>
and
<a class="link" href="information-schema-innodb-datafiles-table.html" title="28.4.10 The INFORMATION_SCHEMA INNODB_DATAFILES Table">
<code class="literal">
INNODB_DATAFILES
</code>
</a>
tables
provide tablespace metadata.
</p>
</div>
</li>
<li class="listitem">
<p>
<b>
DROP TABLESPACE and ALTER TABLESPACE: ENGINE clause.
</b>
The
<code class="literal">
ENGINE
</code>
clause for
<a class="link" href="drop-tablespace.html" title="15.1.33 DROP TABLESPACE Statement">
<code class="literal">
DROP TABLESPACE
</code>
</a>
and
<a class="link" href="alter-tablespace.html" title="15.1.10 ALTER TABLESPACE Statement">
<code class="literal">
ALTER TABLESPACE
</code>
</a>
statements
was deprecated in MySQL 8.0. In MySQL 8.4, it is no longer
supported, and causes an error if you attempt to use it
with
<code class="literal">
DROP TABLESPACE
</code>
or
<a class="link" href="alter-tablespace.html" title="15.1.10 ALTER TABLESPACE Statement">
<code class="literal">
ALTER
TABLESPACE ... DROP DATAFILE
</code>
</a>
.
<code class="literal">
ENGINE
</code>
is also no longer supported for
all other variants of
<code class="literal">
ALTER TABLESPACE
</code>
,
with the two exceptions listed here:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<code class="literal">
ALTER TABLESPACE ... ADD DATAFILE
ENGINE={NDB|NDBCLUSTER}
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
ALTER UNDO TABLESPACE ... SET {ACTIVE|INACTIVE}
ENGINE=INNODB
</code>
</p>
</li>
</ul>
</div>
<p>
For more information, see the documentation for these
statements.
</p>
</li>
<li class="listitem">
<p>
<b>
LOW_PRIORITY with LOCK TABLES ... WRITE.
</b>
The
<code class="literal">
LOW_PRIORITY
</code>
clause of the
<a class="link" href="lock-tables.html" title="15.3.6 LOCK TABLES and UNLOCK TABLES Statements">
<code class="literal">
LOCK TABLES
... WRITE
</code>
</a>
statement had had no effect since
MySQL 5.5, and was deprecated in MySQL 5.6. It is no
longer supported in MySQL 8.4; including it in
<code class="literal">
LOCK TABLES
</code>
now causes a syntax error.
</p>
</li>
<li class="listitem">
<p>
<b>
EXPLAIN FORMAT=JSON format versioning.
</b>
It is now possible to choose between 2 versions of the
JSON output format used by
<code class="literal">
EXPLAIN
FORMAT=JSON
</code>
statements using the
<a class="link" href="server-system-variables.html#sysvar_explain_json_format_version">
<code class="literal">
explain_json_format_version
</code>
</a>
server system variable introduced in this release. Setting
this variable to
<code class="literal">
1
</code>
causes the server to
use Version 1, which is the linear format which was always
used for output from such statements in MySQL 8.2 and
earlier. This is the default value and format in MySQL
8.4. Setting
<code class="literal">
explain_json_format_version
</code>
to
<code class="literal">
2
</code>
causes the Version 2 format to be
used; this JSON output format is based on access paths,
and is intended to provide better compatibility with
future versions of the MySQL Optimizer.
</p>
<p>
See
<a class="xref" href="explain.html#explain-execution-plan" title="Obtaining Execution Plan Information">
Obtaining Execution Plan Information
</a>
, for more
information and examples.
</p>
</li>
<li class="listitem">
<p>
<b>
Capturing EXPLAIN FORMAT=JSON output.
</b>
<code class="literal">
EXPLAIN FORMAT=JSON
</code>
was extended with
an
<code class="literal">
INTO
</code>
option, which provides the
ability to store JSON-formatted
<code class="literal">
EXPLAIN
</code>
output in a user variable where it can be worked with
using MySQL JSON functions, like this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa7108671"><div class="copy-help left">Press ⌘+C to 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">FORMAT</span><span class="token operator">=</span><span class="token datatype">JSON</span> <span class="token keyword">INTO</span> <span class="token variable">@myex</span> <span class="token keyword">SELECT</span> <span class="token keyword">name</span> <span class="token keyword">FROM</span> a <span class="token keyword">WHERE</span> id <span class="token operator">=</span> <span class="token number">2</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">JSON_EXTRACT</span><span class="token punctuation">(</span><span class="token variable">@myex</span><span class="token punctuation">,</span> <span class="token string">"$.query_block.table.key"</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> JSON_EXTRACT(@myex, "$.query_block.table.key") <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> "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>
<span class="token output">1 row in set (0.01 sec)</span></code></pre>
</div>
<p>
This option can be used only if the
<code class="literal">
EXPLAIN
</code>
statement also contains
<code class="literal">
FORMAT=JSON
</code>
; otherwise, a syntax error
results. This requirement is not affected by the value of
<a class="link" href="server-system-variables.html#sysvar_explain_format">
<code class="literal">
explain_format
</code>
</a>
.
</p>
<p>
<code class="literal">
INTO
</code>
can be used with any explainable
statement with the exception of
<code class="literal">
EXPLAIN FOR
CONNECTION
</code>
. It cannot be used with
<code class="literal">
EXPLAIN ANALYZE
</code>
.
</p>
<p>
For more information and examples, see
<a class="xref" href="explain.html#explain-execution-plan" title="Obtaining Execution Plan Information">
Obtaining Execution Plan Information
</a>
.
</p>
</li>
<li class="listitem">
<p>
<b>
EXPLAIN FOR SCHEMA.
</b>
Added a
<code class="literal">
FOR SCHEMA
</code>
option to the
<a class="link" href="explain.html" title="15.8.2 EXPLAIN Statement">
<code class="literal">
EXPLAIN
</code>
</a>
statement. The
syntax is as shown here, where
<em class="replaceable">
<code>
stmt
</code>
</em>
is an explainable
statement:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa8512903"><div class="copy-help left">Press ⌘+C to 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 punctuation">[</span><span class="token keyword"><em class="replaceable">options</em></span><span class="token punctuation">]</span> <span class="token keyword">FOR</span> <span class="token keyword">SCHEMA</span> <span class="token keyword"><em class="replaceable">schema_name</em></span> <em class="replaceable">stmt</em></code></pre>
</div>
<p>
This causes
<em class="replaceable">
<code>
stmt
</code>
</em>
to be run as if
in the named schema.
</p>
<p>
<code class="literal">
FOR DATABASE
</code>
is also supported as a
synonym.
</p>
<p>
This option is not compatible with
<code class="literal">
FOR
CONNECTION
</code>
.
</p>
<p>
See
<a class="xref" href="explain.html#explain-execution-plan" title="Obtaining Execution Plan Information">
Obtaining Execution Plan Information
</a>
, for more
information.
</p>
</li>
<li class="listitem">
<p>
<b>
Client comments preserved.
</b>
In MySQL 8.0, the stripping of comments from 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 was the default behavior;
the default was changed to preserve such comments.
</p>
<p>
To enable the stripping of comments as was performed in
MySQL 8.0 and earlier, start 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 with
<a class="link" href="mysql-command-options.html#option_mysql_comments">
<code class="option">
--skip-comments
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
<b>
AUTO_INCREMENT and floating-point columns.
</b>
The use of the
<code class="literal">
AUTO_INCREMENT
</code>
modifier
with
<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>
and
<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>
columns in
<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.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER TABLE
</code>
</a>
statements was
deprecated in MySQL 8.0; support for it is removed
altogether in MySQL 8.4, where it raises
<a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_wrong_field_spec" target="_top">
<code class="literal">
ER_WRONG_FIELD_SPEC
</code>
</a>
(
<span class="errortext">
Incorrect column specifier for
column
</span>
).
</p>
<p>
Before upgrading to MySQL 8.4 from a previous series, you
<span class="emphasis">
<em>
must
</em>
</span>
fix any table that contains a
<code class="literal">
FLOAT
</code>
or
<code class="literal">
DOUBLE
</code>
column
with
<code class="literal">
AUTO_INCREMENT
</code>
so that the table no
longer uses either of these. Otherwise, the upgrade fails
.
</p>
</li>
<li class="listitem">
<p>
<b>
mysql_ssl_rsa_setup utility.
</b>
The
<span class="command">
<strong>
mysql_ssl_rsa_setup
</strong>
</span>
utility, deprecated in MySQL 8.0.34, has been removed. For
MySQL distributions compiled using OpenSSL, the MySQL
server can perform automatic generation of missing SSL and
RSA files at startup. 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>
, for
more information.
</p>
</li>
<li class="listitem">
<p>
<b>
MySQL Privileges.
</b>
Added the
<a class="link" href="privileges-provided.html#priv_set-any-definer">
<code class="literal">
SET_ANY_DEFINER
</code>
</a>
privilege for definer object creation and the
<a class="link" href="privileges-provided.html#priv_allow-nonexistent-definer">
<code class="literal">
ALLOW_NONEXISTENT_DEFINER
</code>
</a>
privilege for orphan object protection. Together these
privileges coexist with the deprecated
<a class="ulink" href="/doc/refman/8.0/en/privileges-provided.html#priv_set-user-id" target="_top">
<code class="literal">
SET_USER_ID
</code>
</a>
privilege.
</p>
</li>
<li class="listitem">
<p>
<b>
SET_USER_ID privilege.
</b>
The
<code class="literal">
SET_USER_ID
</code>
privilege, deprecated
in MySQL 8.2.0, has been removed. use in
<a class="link" href="grant.html" title="15.7.1.6 GRANT Statement">
<code class="literal">
GRANT
</code>
</a>
statements now causes
a syntax error
</p>
<p>
Instead of
<code class="literal">
SET_USER_ID
</code>
, you can use the
<a class="link" href="privileges-provided.html#priv_set-any-definer">
<code class="literal">
SET_ANY_DEFINER
</code>
</a>
privilege for
definer object creation, and the
<a class="link" href="privileges-provided.html#priv_allow-nonexistent-definer">
<code class="literal">
ALLOW_NONEXISTENT_DEFINER
</code>
</a>
privileges for orphan object protection.
</p>
<p>
Both privileges are required to produce orphaned SQL objects
using
<a class="link" href="create-procedure.html" title="15.1.17 CREATE PROCEDURE and CREATE FUNCTION Statements">
<code class="literal">
CREATE PROCEDURE
</code>
</a>
,
<a class="link" href="create-function.html" title="15.1.14 CREATE FUNCTION Statement">
<code class="literal">
CREATE FUNCTION
</code>
</a>
,
<a class="link" href="create-trigger.html" title="15.1.22 CREATE TRIGGER Statement">
<code class="literal">
CREATE TRIGGER
</code>
</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="create-view.html" title="15.1.23 CREATE VIEW Statement">
<code class="literal">
CREATE VIEW
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
<b>
--abort-slave-event-count and --disconnect-slave-event-count server
options.
</b>
The MySQL server startup options
<code class="option">
--abort-slave-event-count
</code>
and
<code class="option">
--disconnect-slave-event-count
</code>
, formerly
used in testing, were deprecated in MySQL 8.0, and have
been removed in this release. Attempting to start
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
with either of these options now
results in an error.
</p>
</li>
<li class="listitem">
<p>
<b>
mysql_upgrade utility.
</b>
The
<span class="command">
<strong>
mysql_upgrade
</strong>
</span>
utility, deprecated in MySQL 8.0.16, has been removed.
</p>
</li>
<li class="listitem">
<p>
<b>
mysqlpump utility.
</b>
The
<span class="command">
<strong>
mysqlpump
</strong>
</span>
utility
along with its helper utilities
<span class="command">
<strong>
lz4_decompress
</strong>
</span>
and
<span class="command">
<strong>
zlib_decompress
</strong>
</span>
,
deprecated in MySQL 8.0.34, were removed. Instead, use
<a class="link" href="mysqldump.html" title="6.5.4 mysqldump — A Database Backup Program">
<span class="command">
<strong>
mysqldump
</strong>
</span>
</a>
or
<a class="ulink" href="/doc/mysql-shell/8.4/en/mysql-shell-utilities-dump-instance-schema.html" target="_top">
MySQL
Shell's dump utilities
</a>
.
</p>
</li>
<li class="listitem">
<p>
<b>
Obsolete CMake options.
</b>
The following options for compiling the server with CMake
were obsolete and have been removed:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<code class="option">
USE_LD_LLD
</code>
: Use
<a class="link" href="source-configuration-options.html#option_cmake_with_ld">
<code class="option">
WITH_LD=lld
</code>
</a>
instead.
</p>
</li>
<li class="listitem">
<p>
<code class="option">
WITH_BOOST
</code>
,
<code class="option">
DOWNLOAD_BOOST
</code>
,
<code class="option">
DOWNLOAD_BOOST_TIMEOUT
</code>
: These options
are no longer necessary; MySQL now includes and uses a
bundled version of Boost when compiling from source.
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
<b>
Removed Keywords.
</b>
Keywords removed in MySQL 8.4 since MySQL 8.0. Reserved
keywords are marked with (R).
</p>
<p>
<code class="literal">
GET_MASTER_PUBLIC_KEY
</code>
,
<code class="literal">
MASTER_AUTO_POSITION
</code>
,
<code class="literal">
MASTER_BIND
</code>
(R),
<code class="literal">
MASTER_COMPRESSION_ALGORITHMS
</code>
,
<code class="literal">
MASTER_CONNECT_RETRY
</code>
,
<code class="literal">
MASTER_DELAY
</code>
,
<code class="literal">
MASTER_HEARTBEAT_PERIOD
</code>
,
<code class="literal">
MASTER_HOST
</code>
,
<code class="literal">
MASTER_LOG_FILE
</code>
,
<code class="literal">
MASTER_LOG_POS
</code>
,
<code class="literal">
MASTER_PASSWORD
</code>
,
<code class="literal">
MASTER_PORT
</code>
,
<code class="literal">
MASTER_PUBLIC_KEY_PATH
</code>
,
<code class="literal">
MASTER_RETRY_COUNT
</code>
,
<code class="literal">
MASTER_SSL
</code>
,
<code class="literal">
MASTER_SSL_CA
</code>
,
<code class="literal">
MASTER_SSL_CAPATH
</code>
,
<code class="literal">
MASTER_SSL_CERT
</code>
,
<code class="literal">
MASTER_SSL_CIPHER
</code>
,
<code class="literal">
MASTER_SSL_CRL
</code>
,
<code class="literal">
MASTER_SSL_CRLPATH
</code>
,
<code class="literal">
MASTER_SSL_KEY
</code>
,
<code class="literal">
MASTER_SSL_VERIFY_SERVER_CERT
</code>
(R),
<code class="literal">
MASTER_TLS_CIPHERSUITES
</code>
,
<code class="literal">
MASTER_TLS_VERSION
</code>
,
<code class="literal">
MASTER_USER
</code>
, and
<code class="literal">
MASTER_ZSTD_COMPRESSION_LEVEL
</code>
.
</p>
</li>
<li class="listitem">
<p>
<b>
Index prefixes in partitioning key.
</b>
Columns with index prefixes were allowed in the
partitioning key for a partitioned table in MySQL 8.0, and
raised a warning with no other effects when creating,
altering, or upgrading a partitioned table. Such columns
are no longer permitted in partitioned tables, and using
any such columns in the partitioning key causes 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="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER TABLE
</code>
</a>
statement in
they occur to be rejected with an error.
</p>
<p>
For more information, see
<a class="xref" href="partitioning-limitations.html#partitioning-limitations-prefixes" title="Column index prefixes not supported for key partitioning">
Column index prefixes not supported for key partitioning
</a>
.
</p>
</li>
</ul>
</div>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/mysql-cluster-configuration-overview.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="mysql-cluster-configuration-overview">
</a>
25.4.2 Overview of NDB Cluster Configuration Parameters, Options, and Variables
</h3>
</div>
</div>
</div>
<div class="toc">
<dl class="toc">
<dt>
<span class="section">
<a href="mysql-cluster-params-ndbd.html">
25.4.2.1 NDB Cluster Data Node Configuration Parameters
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-cluster-params-mgmd.html">
25.4.2.2 NDB Cluster Management Node Configuration Parameters
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-cluster-params-api.html">
25.4.2.3 NDB Cluster SQL Node and API Node Configuration Parameters
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-cluster-params-other.html">
25.4.2.4 Other NDB Cluster Configuration Parameters
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-cluster-option-tables.html">
25.4.2.5 NDB Cluster mysqld Option and Variable Reference
</a>
</span>
</dt>
</dl>
</div>
<a class="indexterm" name="idm46045121945056">
</a>
<a class="indexterm" name="idm46045121943600">
</a>
<p>
The next several sections provide summary tables of NDB Cluster
node configuration parameters used in the
<code class="filename">
config.ini
</code>
file to govern various aspects of
node behavior, as well as of options and variables read by
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
from a
<code class="filename">
my.cnf
</code>
file
or from the command line when run as an NDB Cluster process. Each
of the node parameter tables lists the parameters for a given type
(
<code class="literal">
ndbd
</code>
,
<code class="literal">
ndb_mgmd
</code>
,
<code class="literal">
mysqld
</code>
,
<code class="literal">
computer
</code>
,
<code class="literal">
tcp
</code>
, or
<code class="literal">
shm
</code>
). All tables
include the data type for the parameter, option, or variable, as
well as its default, minimum, and maximum values as applicable.
</p>
<p>
<b>
Considerations when restarting nodes.
</b>
For node parameters, these tables also indicate what type of
restart is required (node restart or system restart)—and
whether the restart must be done with
<code class="option">
--initial
</code>
—to change the value of a given
configuration parameter. When performing a node restart or an
initial node restart, all of the cluster's data nodes must
be restarted in turn (also referred to as a
<span class="firstterm">
rolling restart
</span>
). It is
possible to update cluster configuration parameters marked as
<code class="literal">
node
</code>
online—that is, without shutting
down the cluster—in this fashion. An initial node restart
requires restarting each
<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
</strong>
</span>
</a>
process with
the
<code class="option">
--initial
</code>
option.
</p>
<p>
A system restart requires a complete shutdown and restart of the
entire cluster. An initial system restart requires taking a backup
of the cluster, wiping the cluster file system after shutdown, and
then restoring from the backup following the restart.
</p>
<p>
In any cluster restart, all of the cluster's management servers
must be restarted for them to read the updated configuration
parameter values.
</p>
<div class="important" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Important
</div>
<p>
Values for numeric cluster parameters can generally be increased
without any problems, although it is advisable to do so
progressively, making such adjustments in relatively small
increments. Many of these can be increased online, using a
rolling restart.
</p>
<p>
However, decreasing the values of such parameters—whether
this is done using a node restart, node initial restart, or even
a complete system restart of the cluster—is not to be
undertaken lightly; it is recommended that you do so only after
careful planning and testing. This is especially true with
regard to those parameters that relate to memory usage and disk
space, such as
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxnooftables">
<code class="literal">
MaxNoOfTables
</code>
</a>
,
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxnooforderedindexes">
<code class="literal">
MaxNoOfOrderedIndexes
</code>
</a>
,
and
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxnoofuniquehashindexes">
<code class="literal">
MaxNoOfUniqueHashIndexes
</code>
</a>
.
In addition, it is the generally the case that configuration
parameters relating to memory and disk usage can be raised using
a simple node restart, but they require an initial node restart
to be lowered.
</p>
</div>
<p>
Because some of these parameters can be used for configuring more
than one type of cluster node, they may appear in more than one of
the tables.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
<code class="literal">
4294967039
</code>
often appears as a maximum value
in these tables. This value is defined in the
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDBCLUSTER
</code>
</a>
sources as
<code class="literal">
MAX_INT_RNIL
</code>
and is equal to
<code class="literal">
0xFFFFFEFF
</code>
, or
<code class="literal">
2
<sup>
32
</sup>
−
2
<sup>
8
</sup>
− 1
</code>
.
</p>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/verifying-md5-checksum.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="verifying-md5-checksum">
</a>
2.1.4.1 Verifying the MD5 Checksum
</h4>
</div>
</div>
</div>
<p>
After you have downloaded a MySQL package, you should make sure
that its MD5 checksum matches the one provided on the MySQL
download pages. Each package has an individual checksum that you
can verify against the package that you downloaded. The correct
MD5 checksum is listed on the downloads page for each MySQL
product; you should compare it against the MD5 checksum of the
file (product) that you download.
</p>
<p>
Each operating system and setup offers its own version of tools
for checking the MD5 checksum. Typically the command is named
<span class="command">
<strong>
md5sum
</strong>
</span>
, or it may be named
<span class="command">
<strong>
md5
</strong>
</span>
, and some operating systems do not ship
it at all. On Linux, it is part of the
<span class="bold">
<strong>
GNU
Text Utilities
</strong>
</span>
package, which is available for a wide
range of platforms. You can also download the source code from
<a class="ulink" href="http://www.gnu.org/software/textutils/" target="_blank">
http://www.gnu.org/software/textutils/
</a>
. If you
have OpenSSL installed, you can use the command
<span class="command">
<strong>
openssl
md5
<em class="replaceable">
<code>
package_name
</code>
</em>
</strong>
</span>
instead. A
Windows implementation of the
<span class="command">
<strong>
md5
</strong>
</span>
command
line utility is available from
<a class="ulink" href="http://www.fourmilab.ch/md5/" target="_blank">
http://www.fourmilab.ch/md5/
</a>
.
<span class="command">
<strong>
winMd5Sum
</strong>
</span>
is a graphical MD5 checking tool
that can be obtained from
<a class="ulink" href="http://www.nullriver.com/index/products/winmd5sum" target="_blank">
http://www.nullriver.com/index/products/winmd5sum
</a>
.
Our Microsoft Windows examples assume the name
<span class="command">
<strong>
md5.exe
</strong>
</span>
.
</p>
<p>
Linux and Microsoft Windows examples:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa2907064"><div class="copy-help left">Press ⌘+C to 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">md5sum</span> mysql-standard-8<span class="token punctuation">.</span>4<span class="token punctuation">.</span>3-linux-i686<span class="token punctuation">.</span>tar<span class="token punctuation">.</span>gz
aaab65abbec64d5e907dcd41b8699945 mysql-standard-8<span class="token punctuation">.</span>4<span class="token punctuation">.</span>3-linux-i686<span class="token punctuation">.</span>tar<span class="token punctuation">.</span>gz</code></pre>
</div>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa58695719"><div class="copy-help left">Press ⌘+C to 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">md5.exe</span> mysql-installer-community-8<span class="token punctuation">.</span>4<span class="token punctuation">.</span>3<span class="token punctuation">.</span>msi
aaab65abbec64d5e907dcd41b8699945 mysql-installer-community-8<span class="token punctuation">.</span>4<span class="token punctuation">.</span>3<span class="token punctuation">.</span>msi</code></pre>
</div>
<p>
You should verify that the resulting checksum (the string of
hexadecimal digits) matches the one displayed on the download
page immediately below the respective package.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
Make sure to verify the checksum of the
<span class="emphasis">
<em>
archive
file
</em>
</span>
(for example, the
<code class="filename">
.zip
</code>
,
<code class="filename">
.tar.gz
</code>
, or
<code class="filename">
.msi
</code>
file) and not of the files that are contained inside of the
archive. In other words, verify the file before extracting its
contents.
</p>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/information-schema-innodb-cmp-table.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="information-schema-innodb-cmp-table">
</a>
28.4.6 The INFORMATION_SCHEMA INNODB_CMP and INNODB_CMP_RESET Tables
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045077299632">
</a>
<a class="indexterm" name="idm46045077298176">
</a>
<p>
The
<a class="link" href="information-schema-innodb-cmp-table.html" title="28.4.6 The INFORMATION_SCHEMA INNODB_CMP and INNODB_CMP_RESET Tables">
<code class="literal">
INNODB_CMP
</code>
</a>
and
<a class="link" href="information-schema-innodb-cmp-table.html" title="28.4.6 The INFORMATION_SCHEMA INNODB_CMP and INNODB_CMP_RESET Tables">
<code class="literal">
INNODB_CMP_RESET
</code>
</a>
tables provide
status information on operations related to
<a class="link" href="glossary.html#glos_compression" title="compression">
compressed
</a>
<code class="literal">
InnoDB
</code>
tables.
</p>
<p>
The
<a class="link" href="information-schema-innodb-cmp-table.html" title="28.4.6 The INFORMATION_SCHEMA INNODB_CMP and INNODB_CMP_RESET Tables">
<code class="literal">
INNODB_CMP
</code>
</a>
and
<a class="link" href="information-schema-innodb-cmp-table.html" title="28.4.6 The INFORMATION_SCHEMA INNODB_CMP and INNODB_CMP_RESET Tables">
<code class="literal">
INNODB_CMP_RESET
</code>
</a>
tables have these
columns:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
PAGE_SIZE
</code>
</p>
<p>
The compressed page size in bytes.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
COMPRESS_OPS
</code>
</p>
<p>
The number of times a B-tree page of size
<code class="literal">
PAGE_SIZE
</code>
has been compressed. Pages are
compressed whenever an empty page is created or the space for
the uncompressed modification log runs out.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
COMPRESS_OPS_OK
</code>
</p>
<p>
The number of times a B-tree page of size
<code class="literal">
PAGE_SIZE
</code>
has been successfully compressed.
This count should never exceed
<code class="literal">
COMPRESS_OPS
</code>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
COMPRESS_TIME
</code>
</p>
<p>
The total time in seconds used for attempts to compress B-tree
pages of size
<code class="literal">
PAGE_SIZE
</code>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
UNCOMPRESS_OPS
</code>
</p>
<p>
The number of times a B-tree page of size
<code class="literal">
PAGE_SIZE
</code>
has been uncompressed. B-tree
pages are uncompressed whenever compression fails or at first
access when the uncompressed page does not exist in the buffer
pool.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
UNCOMPRESS_TIME
</code>
</p>
<p>
The total time in seconds used for uncompressing B-tree pages
of the size
<code class="literal">
PAGE_SIZE
</code>
.
</p>
</li>
</ul>
</div>
<h4>
<a name="idm46045077272512">
</a>
Example
</h4>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa50989768"><div class="copy-help left">Press ⌘+C to 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> INFORMATION_SCHEMA<span class="token punctuation">.</span>INNODB_CMP\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>
page_size<span class="token punctuation">:</span> 1024
compress_ops<span class="token punctuation">:</span> 0
compress_ops_ok<span class="token punctuation">:</span> 0
compress_time<span class="token punctuation">:</span> 0
uncompress_ops<span class="token punctuation">:</span> 0
uncompress_time<span class="token punctuation">:</span> 0
<span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span 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>
page_size<span class="token punctuation">:</span> 2048
compress_ops<span class="token punctuation">:</span> 0
compress_ops_ok<span class="token punctuation">:</span> 0
compress_time<span class="token punctuation">:</span> 0
uncompress_ops<span class="token punctuation">:</span> 0
uncompress_time<span class="token punctuation">:</span> 0
<span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span 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>
page_size<span class="token punctuation">:</span> 4096
compress_ops<span class="token punctuation">:</span> 0
compress_ops_ok<span class="token punctuation">:</span> 0
compress_time<span class="token punctuation">:</span> 0
uncompress_ops<span class="token punctuation">:</span> 0
uncompress_time<span class="token punctuation">:</span> 0
<span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span 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>
page_size<span class="token punctuation">:</span> 8192
compress_ops<span class="token punctuation">:</span> 86955
compress_ops_ok<span class="token punctuation">:</span> 81182
compress_time<span class="token punctuation">:</span> 27
uncompress_ops<span class="token punctuation">:</span> 26828
uncompress_time<span class="token punctuation">:</span> 5
<span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span 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>
page_size<span class="token punctuation">:</span> 16384
compress_ops<span class="token punctuation">:</span> 0
compress_ops_ok<span class="token punctuation">:</span> 0
compress_time<span class="token punctuation">:</span> 0
uncompress_ops<span class="token punctuation">:</span> 0
uncompress_time<span class="token punctuation">:</span> 0</span></code></pre>
</div>
<h4>
<a name="idm46045077269248">
</a>
Notes
</h4>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Use these tables to measure the effectiveness of
<code class="literal">
InnoDB
</code>
table
<a class="link" href="glossary.html#glos_compression" title="compression">
compression
</a>
in your
database.
</p>
</li>
<li class="listitem">
<p>
You must have the
<a class="link" href="privileges-provided.html#priv_process">
<code class="literal">
PROCESS
</code>
</a>
privilege to query this table.
</p>
</li>
<li class="listitem">
<p>
Use the
<code class="literal">
INFORMATION_SCHEMA
</code>
<a class="link" href="information-schema-columns-table.html" title="28.3.8 The INFORMATION_SCHEMA COLUMNS Table">
<code class="literal">
COLUMNS
</code>
</a>
table or the
<a class="link" href="show-columns.html" title="15.7.7.6 SHOW COLUMNS Statement">
<code class="literal">
SHOW COLUMNS
</code>
</a>
statement to view
additional information about the columns of this table,
including data types and default values.
</p>
</li>
<li class="listitem">
<p>
For usage information, see
<a class="xref" href="innodb-compression-tuning-monitoring.html" title="17.9.1.4 Monitoring InnoDB Table Compression at Runtime">
Section 17.9.1.4, “Monitoring InnoDB Table Compression at Runtime”
</a>
and
<a class="xref" href="innodb-information-schema-examples-compression-sect.html" title="17.15.1.3 Using the Compression Information Schema Tables">
Section 17.15.1.3, “Using the Compression Information Schema Tables”
</a>
.
For general information about
<code class="literal">
InnoDB
</code>
table
compression, see
<a class="xref" href="innodb-compression.html" title="17.9 InnoDB Table and Page Compression">
Section 17.9, “InnoDB Table and Page Compression”
</a>
.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/xa-states.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="xa-states">
</a>
15.3.8.2 XA Transaction States
</h4>
</div>
</div>
</div>
<p>
An XA transaction progresses through the following states:
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
Use
<a class="link" href="xa-statements.html" title="15.3.8.1 XA Transaction SQL Statements">
<code class="literal">
XA
START
</code>
</a>
to start an XA transaction and put it in the
<code class="literal">
ACTIVE
</code>
state.
</p>
</li>
<li class="listitem">
<p>
For an
<code class="literal">
ACTIVE
</code>
XA transaction, issue the
SQL statements that make up the transaction, and then issue
an
<a class="link" href="xa-statements.html" title="15.3.8.1 XA Transaction SQL Statements">
<code class="literal">
XA
END
</code>
</a>
statement.
<a class="link" href="xa-statements.html" title="15.3.8.1 XA Transaction SQL Statements">
<code class="literal">
XA
END
</code>
</a>
puts the transaction in the
<code class="literal">
IDLE
</code>
state.
</p>
</li>
<li class="listitem">
<p>
For an
<code class="literal">
IDLE
</code>
XA transaction, you can issue
either an
<a class="link" href="xa-statements.html" title="15.3.8.1 XA Transaction SQL Statements">
<code class="literal">
XA
PREPARE
</code>
</a>
statement or an
<code class="literal">
XA COMMIT ... ONE
PHASE
</code>
statement:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="link" href="xa-statements.html" title="15.3.8.1 XA Transaction SQL Statements">
<code class="literal">
XA
PREPARE
</code>
</a>
puts the transaction in the
<code class="literal">
PREPARED
</code>
state. An
<a class="link" href="xa-statements.html" title="15.3.8.1 XA Transaction SQL Statements">
<code class="literal">
XA
RECOVER
</code>
</a>
statement at this point includes the
transaction's
<em class="replaceable">
<code>
xid
</code>
</em>
value
in its output, because
<a class="link" href="xa-statements.html" title="15.3.8.1 XA Transaction SQL Statements">
<code class="literal">
XA
RECOVER
</code>
</a>
lists all XA transactions that are in
the
<code class="literal">
PREPARED
</code>
state.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
XA COMMIT ... ONE PHASE
</code>
prepares and
commits the transaction. The
<em class="replaceable">
<code>
xid
</code>
</em>
value is not listed by
<a class="link" href="xa-statements.html" title="15.3.8.1 XA Transaction SQL Statements">
<code class="literal">
XA
RECOVER
</code>
</a>
because the transaction terminates.
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
For a
<code class="literal">
PREPARED
</code>
XA transaction, you can
issue an
<a class="link" href="xa-statements.html" title="15.3.8.1 XA Transaction SQL Statements">
<code class="literal">
XA
COMMIT
</code>
</a>
statement to commit and terminate the
transaction, or
<a class="link" href="xa-statements.html" title="15.3.8.1 XA Transaction SQL Statements">
<code class="literal">
XA
ROLLBACK
</code>
</a>
to roll back and terminate the
transaction.
</p>
</li>
</ol>
</div>
<p>
Here is a simple XA transaction that inserts a row into a table
as part of a global transaction:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa59346166"><div class="copy-help left">Press ⌘+C to 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">XA</span> <span class="token keyword">START</span> <span class="token string">'xatest'</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> mytable <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">10</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 1 row affected (0.04 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">XA</span> <span class="token keyword">END</span> <span class="token string">'xatest'</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">XA</span> <span class="token keyword">PREPARE</span> <span class="token string">'xatest'</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">XA</span> <span class="token keyword">COMMIT</span> <span class="token string">'xatest'</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 0 rows affected (0.00 sec)</span></code></pre>
</div>
<p>
MySQL 8.4 supports detached XA transactions,
enabled by the
<a class="link" href="server-system-variables.html#sysvar_xa_detach_on_prepare">
<code class="literal">
xa_detach_on_prepare
</code>
</a>
system
variable (
<code class="literal">
ON
</code>
by default). Detached
transactions are disconnected from the current session following
execution of
<a class="link" href="xa-statements.html" title="15.3.8.1 XA Transaction SQL Statements">
<code class="literal">
XA
PREPARE
</code>
</a>
(and can be committed or rolled back by
another connection). This means that the current session is free
to start a new local transaction or XA transaction without
having to wait for the prepared XA transaction to be committed
or rolled back.
</p>
<p>
When XA transactions are detached, a connection has no special
knowledge of any XA transaction that it has prepared. If the
current session tries to commit or roll back a given XA
transaction (even one which it prepared) after another
connection has already done so, the attempt is rejected with an
invalid XID error (
<a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_xaer_nota" target="_top">
<code class="literal">
ER_XAER_NOTA
</code>
</a>
)
since the requested
<em class="replaceable">
<code>
xid
</code>
</em>
no longer
exists.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
Detached XA transactions cannot use temporary tables.
</p>
</div>
<p>
When detached XA transactions are disabled
(
<code class="literal">
xa_detach_on_prepare
</code>
set to
<code class="literal">
OFF
</code>
), an XA transaction remains connected
until it is committed or rolled back by the originating
connection. Disabling detached XA transactions is not
recommended for a MySQL server instance used in group
replication; see
<a class="xref" href="group-replication-requirements.html#group-replication-configuration" title="Server Instance Configuration">
Server Instance Configuration
</a>
, for more
information.
</p>
<p>
If an XA transaction is in the
<code class="literal">
ACTIVE
</code>
state,
you cannot issue any statements that cause an implicit commit.
That would violate the XA contract because you could not roll
back the XA transaction. Trying to execute such a statement
raises the following error:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-none"><div class="docs-select-all right" id="sa761279"><div class="copy-help left">Press ⌘+C to 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">ERROR 1399 (XAE07): XAER_RMFAIL: The command cannot be executed
when global transaction is in the ACTIVE state</code></pre>
</div>
<p>
Statements to which the preceding remark applies are listed at
<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>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/reloading-sql-format-dumps.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="reloading-sql-format-dumps">
</a>
9.4.2 Reloading SQL-Format Backups
</h3>
</div>
</div>
</div>
<p>
To reload a dump file written by
<a class="link" href="mysqldump.html" title="6.5.4 mysqldump — A Database Backup Program">
<span class="command">
<strong>
mysqldump
</strong>
</span>
</a>
that consists of SQL statements, use it as input to 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. If the dump file was created by
<a class="link" href="mysqldump.html" title="6.5.4 mysqldump — A Database Backup Program">
<span class="command">
<strong>
mysqldump
</strong>
</span>
</a>
with the
<a class="link" href="mysqldump.html#option_mysqldump_all-databases">
<code class="option">
--all-databases
</code>
</a>
or
<a class="link" href="mysqldump.html#option_mysqldump_databases">
<code class="option">
--databases
</code>
</a>
option, it
contains
<a class="link" href="create-database.html" title="15.1.12 CREATE DATABASE Statement">
<code class="literal">
CREATE DATABASE
</code>
</a>
and
<a class="link" href="use.html" title="15.8.4 USE Statement">
<code class="literal">
USE
</code>
</a>
statements and it is not
necessary to specify a default database into which to load the
data:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa79967883"><div class="copy-help left">Press ⌘+C to 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> < dump<span class="token punctuation">.</span>sql</code></pre>
</div>
<p>
Alternatively, from within
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
, use a
<code class="literal">
source
</code>
command:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa27478779"><div class="copy-help left">Press ⌘+C to 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">source</span> dump<span class="token punctuation">.</span><span class="token keyword">sql</span></code></pre>
</div>
<p>
If the file is a single-database dump not containing
<a class="link" href="create-database.html" title="15.1.12 CREATE DATABASE Statement">
<code class="literal">
CREATE DATABASE
</code>
</a>
and
<a class="link" href="use.html" title="15.8.4 USE Statement">
<code class="literal">
USE
</code>
</a>
statements, create the
database first (if necessary):
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa56833603"><div class="copy-help left">Press ⌘+C to 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">mysqladmin</span> create db1</code></pre>
</div>
<p>
Then specify the database name when you load the dump file:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa28300508"><div class="copy-help left">Press ⌘+C to 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> db1 < dump<span class="token punctuation">.</span>sql</code></pre>
</div>
<p>
Alternatively, from within
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
, create the
database, select it as the default database, and load the dump
file:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa24095904"><div class="copy-help left">Press ⌘+C to 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">DATABASE</span> <span class="token keyword">IF</span> <span class="token operator">NOT</span> <span class="token keyword">EXISTS</span> db1<span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">USE</span> db1<span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">source</span> dump<span class="token punctuation">.</span><span class="token keyword">sql</span></code></pre>
</div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
For Windows PowerShell users: Because the "<" character is
reserved for future use in PowerShell, an alternative approach
is required, such as using quotes
<code class="literal">
cmd.exe /c "mysql
< dump.sql"
</code>
.
</p>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/myisam-table-problems.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="myisam-table-problems">
</a>
18.2.4 MyISAM Table Problems
</h3>
</div>
</div>
</div>
<div class="toc">
<dl class="toc">
<dt>
<span class="section">
<a href="corrupted-myisam-tables.html">
18.2.4.1 Corrupted MyISAM Tables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="myisam-table-close.html">
18.2.4.2 Problems from Tables Not Being Closed Properly
</a>
</span>
</dt>
</dl>
</div>
<p>
The file format that MySQL uses to store data has been extensively
tested, but there are always circumstances that may cause database
tables to become corrupted. The following discussion describes how
this can happen and how to handle it.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/sys-io-global-by-wait-by-bytes.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="sys-io-global-by-wait-by-bytes">
</a>
30.4.3.13 The io_global_by_wait_by_bytes and x$io_global_by_wait_by_bytes Views
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045062970512">
</a>
<a class="indexterm" name="idm46045062969056">
</a>
<a class="indexterm" name="idm46045062967552">
</a>
<a class="indexterm" name="idm46045062966048">
</a>
<p>
These views summarize global I/O consumers to display amount
of I/O and time waiting for I/O, grouped by event. By default,
rows are sorted by descending total I/O (bytes read and
written).
</p>
<p>
The
<a class="link" href="sys-io-global-by-wait-by-bytes.html" title="30.4.3.13 The io_global_by_wait_by_bytes and x$io_global_by_wait_by_bytes Views">
<code class="literal">
io_global_by_wait_by_bytes
</code>
</a>
and
<a class="link" href="sys-io-global-by-wait-by-bytes.html" title="30.4.3.13 The io_global_by_wait_by_bytes and x$io_global_by_wait_by_bytes Views">
<code class="literal">
x$io_global_by_wait_by_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 I/O event name, with the
<code class="literal">
wait/io/file/
</code>
prefix stripped.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
total
</code>
</p>
<p>
The total number of occurrences of the I/O event.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
total_latency
</code>
</p>
<p>
The total wait time of timed occurrences of the I/O event.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
min_latency
</code>
</p>
<p>
The minimum single wait time of timed occurrences of the
I/O event.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
avg_latency
</code>
</p>
<p>
The average wait time per timed occurrence of the I/O
event.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
max_latency
</code>
</p>
<p>
The maximum single wait time of timed occurrences of the
I/O event.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
count_read
</code>
</p>
<p>
The number of read requests for the I/O event.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
total_read
</code>
</p>
<p>
The number of bytes read for the I/O event.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
avg_read
</code>
</p>
<p>
The average number of bytes per read for the I/O event.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
count_write
</code>
</p>
<p>
The number of write requests for the I/O event.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
total_written
</code>
</p>
<p>
The number of bytes written for the I/O event.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
avg_written
</code>
</p>
<p>
The average number of bytes per write for the I/O event.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
total_requested
</code>
</p>
<p>
The total number of bytes read and written for the I/O
event.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/replication-features-checksum-table.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="replication-features-checksum-table">
</a>
19.5.1.4 Replication and CHECKSUM TABLE
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045135939280">
</a>
<a class="indexterm" name="idm46045135937776">
</a>
<p>
<a class="link" href="checksum-table.html" title="15.7.3.3 CHECKSUM TABLE Statement">
<code class="literal">
CHECKSUM TABLE
</code>
</a>
returns a checksum
that is calculated row by row, using a method that depends on
the table row storage format. The storage format is not
guaranteed to remain the same between MySQL versions, so the
checksum value might change following an upgrade.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/set-default-role.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="set-default-role">
</a>
15.7.1.9 SET DEFAULT ROLE Statement
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045173040928">
</a>
<a class="indexterm" name="idm46045173039872">
</a>
<a class="indexterm" name="idm46045173038384">
</a>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa43289336"><div class="copy-help left">Press ⌘+C to 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">DEFAULT</span> <span class="token keyword">ROLE</span>
{<span class="token keyword">NONE</span> <span class="token operator">|</span> <span class="token keyword">ALL</span> <span class="token operator">|</span> <span class="token keyword"><em class="replaceable">role</em></span> <span class="token punctuation">[</span><span class="token punctuation">,</span> <span class="token keyword"><em class="replaceable">role</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 keyword">TO</span> <span class="token keyword"><em class="replaceable">user</em></span> <span class="token punctuation">[</span><span class="token punctuation">,</span> <span class="token keyword"><em class="replaceable">user</em></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>
For each
<em class="replaceable">
<code>
user
</code>
</em>
named immediately after
the
<code class="literal">
TO
</code>
keyword, this statement defines which
roles become active when the user connects to the server and
authenticates, or when the user executes the
<a class="link" href="set-role.html" title="15.7.1.11 SET ROLE Statement">
<code class="literal">
SET ROLE
DEFAULT
</code>
</a>
statement during a session.
</p>
<p>
<a class="link" href="set-default-role.html" title="15.7.1.9 SET DEFAULT ROLE Statement">
<code class="literal">
SET DEFAULT ROLE
</code>
</a>
is alternative
syntax for
<a class="link" href="alter-user.html" title="15.7.1.1 ALTER USER Statement">
<code class="literal">
ALTER
USER ... DEFAULT ROLE
</code>
</a>
(see
<a class="xref" href="alter-user.html" title="15.7.1.1 ALTER USER Statement">
Section 15.7.1.1, “ALTER USER Statement”
</a>
). However,
<a class="link" href="alter-user.html" title="15.7.1.1 ALTER USER Statement">
<code class="literal">
ALTER USER
</code>
</a>
can set the default
for only a single user, whereas
<a class="link" href="set-default-role.html" title="15.7.1.9 SET DEFAULT ROLE Statement">
<code class="literal">
SET DEFAULT
ROLE
</code>
</a>
can set the default for multiple users. On the
other hand, you can specify
<code class="literal">
CURRENT_USER
</code>
as
the user name for the
<a class="link" href="alter-user.html" title="15.7.1.1 ALTER USER Statement">
<code class="literal">
ALTER USER
</code>
</a>
statement, whereas you cannot for
<a class="link" href="set-default-role.html" title="15.7.1.9 SET DEFAULT ROLE Statement">
<code class="literal">
SET
DEFAULT ROLE
</code>
</a>
.
</p>
<p>
<a class="link" href="set-default-role.html" title="15.7.1.9 SET DEFAULT ROLE Statement">
<code class="literal">
SET DEFAULT ROLE
</code>
</a>
requires these
privileges:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Setting the default roles for another user requires the
global
<a class="link" href="privileges-provided.html#priv_create-user">
<code class="literal">
CREATE USER
</code>
</a>
privilege,
or the
<a class="link" href="privileges-provided.html#priv_update">
<code class="literal">
UPDATE
</code>
</a>
privilege for
the
<code class="literal">
mysql.default_roles
</code>
system table.
</p>
</li>
<li class="listitem">
<p>
Setting the default roles for yourself requires no special
privileges, as long as the roles you want as the default
have been granted to you.
</p>
</li>
</ul>
</div>
<p>
Each role name uses the format described in
<a class="xref" href="role-names.html" title="8.2.5 Specifying Role Names">
Section 8.2.5, “Specifying Role Names”
</a>
. For example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa68039086"><div class="copy-help left">Press ⌘+C to 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">DEFAULT</span> <span class="token keyword">ROLE</span> <span class="token string">'admin'</span><span class="token punctuation">,</span> <span class="token string">'developer'</span> <span class="token keyword">TO</span> <span class="token string">'joe'</span>@<span class="token string">'10.0.0.1'</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
The host name part of the role name, if omitted, defaults to
<code class="literal">
'%'
</code>
.
</p>
<p>
The clause following the
<code class="literal">
DEFAULT ROLE
</code>
keywords permits these values:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
NONE
</code>
: Set the default to
<code class="literal">
NONE
</code>
(no roles).
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
ALL
</code>
: Set the default to all roles granted
to the account.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
<em class="replaceable">
<code>
role
</code>
</em>
[,
<em class="replaceable">
<code>
role
</code>
</em>
] ...
</code>
: Set the
default to the named roles, which must exist and be granted
to the account at the time
<a class="link" href="set-default-role.html" title="15.7.1.9 SET DEFAULT ROLE Statement">
<code class="literal">
SET DEFAULT
ROLE
</code>
</a>
is executed.
</p>
</li>
</ul>
</div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
<a class="link" href="set-default-role.html" title="15.7.1.9 SET DEFAULT ROLE Statement">
<code class="literal">
SET DEFAULT ROLE
</code>
</a>
and
<a class="link" href="set-role.html" title="15.7.1.11 SET ROLE Statement">
<code class="literal">
SET ROLE
DEFAULT
</code>
</a>
are different statements:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="link" href="set-default-role.html" title="15.7.1.9 SET DEFAULT ROLE Statement">
<code class="literal">
SET DEFAULT ROLE
</code>
</a>
defines
which account roles to activate by default within account
sessions.
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="set-role.html" title="15.7.1.11 SET ROLE Statement">
<code class="literal">
SET ROLE
DEFAULT
</code>
</a>
sets the active roles within the current
session to the current account default roles.
</p>
</li>
</ul>
</div>
</div>
<p>
For role usage examples, see
<a class="xref" href="roles.html" title="8.2.10 Using Roles">
Section 8.2.10, “Using Roles”
</a>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/mysqldump-definition-data-dumps.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="mysqldump-definition-data-dumps">
</a>
9.4.5.4 Dumping Table Definitions and Content Separately
</h4>
</div>
</div>
</div>
<p>
The
<a class="link" href="mysqldump.html#option_mysqldump_no-data">
<code class="option">
--no-data
</code>
</a>
option tells
<a class="link" href="mysqldump.html" title="6.5.4 mysqldump — A Database Backup Program">
<span class="command">
<strong>
mysqldump
</strong>
</span>
</a>
not to dump table data, resulting
in the dump file containing only statements to create the
tables. Conversely, the
<a class="link" href="mysqldump.html#option_mysqldump_no-create-info">
<code class="option">
--no-create-info
</code>
</a>
option
tells
<a class="link" href="mysqldump.html" title="6.5.4 mysqldump — A Database Backup Program">
<span class="command">
<strong>
mysqldump
</strong>
</span>
</a>
to suppress
<code class="literal">
CREATE
</code>
statements from the output, so that
the dump file contains only table data.
</p>
<p>
For example, to dump table definitions and data separately for
the
<code class="literal">
test
</code>
database, use these commands:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa53019080"><div class="copy-help left">Press ⌘+C to 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">mysqldump</span> <span class="token property">--no-data</span> test > dump-defs<span class="token punctuation">.</span>sql
<span class="token prompt">$> </span><span class="token command">mysqldump</span> <span class="token property">--no-create-info</span> test > dump-data<span class="token punctuation">.</span>sql</code></pre>
</div>
<p>
For a definition-only dump, add the
<a class="link" href="mysqldump.html#option_mysqldump_routines">
<code class="option">
--routines
</code>
</a>
and
<a class="link" href="mysqldump.html#option_mysqldump_events">
<code class="option">
--events
</code>
</a>
options to also include stored routine and event definitions:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa20987304"><div class="copy-help left">Press ⌘+C to 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">mysqldump</span> <span class="token property">--no-data</span> <span class="token property">--routines</span> <span class="token property">--events</span> test > dump-defs<span class="token punctuation">.</span>sql</code></pre>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/replication-features-user-names.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="replication-features-user-names">
</a>
19.5.1.38 Replication and User Name Length
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045134853104">
</a>
<a class="indexterm" name="idm46045134851648">
</a>
<p>
The maximum length for user names in MySQL 8.4 is
32 characters. Replication of user names longer than 16
characters fails when the replica runs a version of MySQL
previous to 5.7, because those versions support only shorter
user names. This occurs only when replicating from a newer
source to an older replica, which is not a recommended
configuration.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/mysql-cluster-ndb-innodb-workloads.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="mysql-cluster-ndb-innodb-workloads">
</a>
25.2.6.2 NDB and InnoDB Workloads
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045123763744">
</a>
<a class="indexterm" name="idm46045123762240">
</a>
<a class="indexterm" name="idm46045123760752">
</a>
<a class="indexterm" name="idm46045123759264">
</a>
<a class="indexterm" name="idm46045123757776">
</a>
<a class="indexterm" name="idm46045123756288">
</a>
<p>
NDB Cluster has a range of unique attributes that make it ideal
to serve applications requiring high availability, fast
failover, high throughput, and low latency. Due to its
distributed architecture and multi-node implementation, NDB
Cluster also has specific constraints that may keep some
workloads from performing well. A number of major differences in
behavior between the
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
and
<a class="link" href="innodb-storage-engine.html" title="Chapter 17 The InnoDB Storage Engine">
<code class="literal">
InnoDB
</code>
</a>
storage engines with regard
to some common types of database-driven application workloads
are shown in the following table::
</p>
<div class="table">
<a name="idm46045123751408">
</a>
<p class="title">
<b>
Table 25.2 Differences between InnoDB and NDB storage engines, common
types of data-driven application workloads.
</b>
</p>
<div class="table-contents">
<table>
<colgroup>
<col style="width: 33%"/>
<col style="width: 34%"/>
<col style="width: 33%"/>
</colgroup>
<thead>
<tr>
<th scope="col">
Workload
</th>
<th scope="col">
<a class="link" href="innodb-storage-engine.html" title="Chapter 17 The InnoDB Storage Engine">
<code class="literal">
InnoDB
</code>
</a>
</th>
<th scope="col">
NDB Cluster (
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
)
</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">
High-Volume OLTP Applications
</th>
<td>
Yes
</td>
<td>
Yes
</td>
</tr>
<tr>
<th scope="row">
DSS Applications (data marts, analytics)
</th>
<td>
Yes
</td>
<td>
Limited (Join operations across OLTP datasets not exceeding 3TB in size)
</td>
</tr>
<tr>
<th scope="row">
Custom Applications
</th>
<td>
Yes
</td>
<td>
Yes
</td>
</tr>
<tr>
<th scope="row">
Packaged Applications
</th>
<td>
Yes
</td>
<td>
Limited (should be mostly primary key access); NDB Cluster
8.4 supports foreign keys
</td>
</tr>
<tr>
<th scope="row">
In-Network Telecoms Applications (HLR, HSS, SDP)
</th>
<td>
No
</td>
<td>
Yes
</td>
</tr>
<tr>
<th scope="row">
Session Management and Caching
</th>
<td>
Yes
</td>
<td>
Yes
</td>
</tr>
<tr>
<th scope="row">
E-Commerce Applications
</th>
<td>
Yes
</td>
<td>
Yes
</td>
</tr>
<tr>
<th scope="row">
User Profile Management, AAA Protocol
</th>
<td>
Yes
</td>
<td>
Yes
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br class="table-break"/>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/dbug-package.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="dbug-package">
</a>
7.9.4 The DBUG Package
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045253107568">
</a>
<p>
The MySQL server and most MySQL clients are compiled with the
<code class="literal">
DBUG
</code>
package originally created by Fred Fish.
When you have configured MySQL for debugging, this package makes
it possible to get a trace file of what the program is doing. 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>
<p>
This section summarizes the argument values that you can specify
in debug options on the command line for MySQL programs that have
been built with debugging support.
</p>
<p>
The
<code class="literal">
DBUG
</code>
package can be used by invoking a
program with the
<code class="option">
--debug[=
<em class="replaceable">
<code>
debug_options
</code>
</em>
]
</code>
or
<code class="option">
-# [
<em class="replaceable">
<code>
debug_options
</code>
</em>
]
</code>
option. If you specify the
<code class="option">
--debug
</code>
or
<code class="option">
-#
</code>
option without a
<em class="replaceable">
<code>
debug_options
</code>
</em>
value, most MySQL
programs use a default value. The server default is
<code class="literal">
d:t:i:o,/tmp/mysqld.trace
</code>
on Unix and
<code class="literal">
d:t:i:O,\mysqld.trace
</code>
on Windows. The effect of
this default is:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
d
</code>
: Enable output for all debug macros
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
t
</code>
: Trace function calls and exits
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
i
</code>
: Add PID to output lines
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
o,/tmp/mysqld.trace
</code>
,
<code class="literal">
O,\mysqld.trace
</code>
: Set the debug output file.
</p>
</li>
</ul>
</div>
<p>
Most client programs use a default
<em class="replaceable">
<code>
debug_options
</code>
</em>
value of
<code class="literal">
d:t:o,/tmp/
<em class="replaceable">
<code>
program_name
</code>
</em>
.trace
</code>
,
regardless of platform.
</p>
<p>
Here are some example debug control strings as they might be
specified on a shell command line:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-ini"><div class="docs-select-all right" id="sa61763144"><div class="copy-help left">Press ⌘+C to 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">--debug</span><span class="token attr-value"><span class="token punctuation">=</span>d:t</span>
<span class="token constant">--debug</span><span class="token attr-value"><span class="token punctuation">=</span>d:f,main,subr1:F:L:t,20</span>
<span class="token constant">--debug</span><span class="token attr-value"><span class="token punctuation">=</span>d,input,output,files:n</span>
<span class="token constant">--debug</span><span class="token attr-value"><span class="token punctuation">=</span>d:t:i:O,\\mysqld.trace</span></code></pre>
</div>
<p>
For
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
, it is also possible to change DBUG
settings at runtime by setting the
<a class="link" href="server-system-variables.html#sysvar_debug">
<code class="literal">
debug
</code>
</a>
system variable. This
variable has global and session values:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa14045981"><div class="copy-help left">Press ⌘+C to 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">GLOBAL</span> debug <span class="token operator">=</span> <span class="token string">'<em class="replaceable">debug_options</em>'</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">SET</span> <span class="token keyword">SESSION</span> debug <span class="token operator">=</span> <span class="token string">'<em class="replaceable">debug_options</em>'</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Changing the global
<a class="link" href="server-system-variables.html#sysvar_debug">
<code class="literal">
debug
</code>
</a>
value
requires privileges sufficient to set global system variables.
Changing the session
<a class="link" href="server-system-variables.html#sysvar_debug">
<code class="literal">
debug
</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>
<p>
The
<em class="replaceable">
<code>
debug_options
</code>
</em>
value is a sequence
of colon-separated fields:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-simple"><div class="docs-select-all right" id="sa91455488"><div class="copy-help left">Press ⌘+C to 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">field_1<span class="token operator">:</span>field_2<span class="token operator">:</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token operator">:</span>field_<em class="replaceable">N</em></code></pre>
</div>
<p>
Each field within the value consists of a mandatory flag
character, optionally preceded by a
<code class="literal">
+
</code>
or
<code class="literal">
-
</code>
character, and optionally followed by a
comma-separated list of modifiers:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-simple"><div class="docs-select-all right" id="sa29603392"><div class="copy-help left">Press ⌘+C to 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"><span class="token punctuation">[</span><span class="token operator">+</span><span class="token operator">|</span><span class="token operator">-</span><span class="token punctuation">]</span>flag<span class="token punctuation">[</span><span class="token punctuation">,</span>modifier<span class="token punctuation">,</span>modifier<span class="token punctuation">,</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">,</span>modifier<span class="token punctuation">]</span></code></pre>
</div>
<p>
The following table describes the permitted flag characters.
Unrecognized flag characters are silently ignored.
</p>
<div class="informaltable">
<table frame="all" summary="Descriptions of permitted debug_options flag characters.">
<colgroup>
<col style="width: 8%"/>
<col style="width: 92%"/>
</colgroup>
<thead>
<tr>
<th>
<p>
Flag
</p>
</th>
<th>
<p>
Description
</p>
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<p>
<code class="literal">
d
</code>
</p>
</td>
<td>
<p>
Enable output from
<code class="literal">
DBUG_
<em class="replaceable">
<code>
XXX
</code>
</em>
</code>
macros for the current state. May be followed by a list of
keywords, which enables output only for the DBUG macros
with that keyword. An empty list of keywords enables
output for all macros.
</p>
<p>
In MySQL, common debug macro keywords to enable are
<code class="literal">
enter
</code>
,
<code class="literal">
exit
</code>
,
<code class="literal">
error
</code>
,
<code class="literal">
warning
</code>
,
<code class="literal">
info
</code>
, and
<code class="literal">
loop
</code>
.
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="literal">
D
</code>
</p>
</td>
<td>
<p>
Delay after each debugger output line. The argument is the
delay, in tenths of seconds, subject to machine
capabilities. For example,
<code class="literal">
D,20
</code>
specifies a delay of two seconds.
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="literal">
f
</code>
</p>
</td>
<td>
<p>
Limit debugging, tracing, and profiling to the list of
named functions. An empty list enables all functions. The
appropriate
<code class="literal">
d
</code>
or
<code class="literal">
t
</code>
flags must still be given; this flag only limits their
actions if they are enabled.
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="literal">
F
</code>
</p>
</td>
<td>
<p>
Identify the source file name for each line of debug or
trace output.
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="literal">
i
</code>
</p>
</td>
<td>
<p>
Identify the process with the PID or thread ID for each
line of debug or trace output.
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="literal">
L
</code>
</p>
</td>
<td>
<p>
Identify the source file line number for each line of
debug or trace output.
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="literal">
n
</code>
</p>
</td>
<td>
<p>
Print the current function nesting depth for each line of
debug or trace output.
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="literal">
N
</code>
</p>
</td>
<td>
<p>
Number each line of debug output.
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="literal">
o
</code>
</p>
</td>
<td>
<p>
Redirect the debugger output stream to the specified file.
The default output is
<code class="literal">
stderr
</code>
.
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="literal">
O
</code>
</p>
</td>
<td>
<p>
Like
<code class="literal">
o
</code>
, but the file is really flushed
between each write. When needed, the file is closed and
reopened between each write.
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="literal">
a
</code>
</p>
</td>
<td>
<p>
Like
<code class="literal">
o
</code>
, but opens for append.
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="literal">
A
</code>
</p>
</td>
<td>
<p>
Like
<code class="literal">
O
</code>
, but opens for append.
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="literal">
p
</code>
</p>
</td>
<td>
<p>
Limit debugger actions to specified processes. A process
must be identified with the
<code class="literal">
DBUG_PROCESS
</code>
macro and match one in the
list for debugger actions to occur.
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="literal">
P
</code>
</p>
</td>
<td>
<p>
Print the current process name for each line of debug or
trace output.
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="literal">
r
</code>
</p>
</td>
<td>
<p>
When pushing a new state, do not inherit the previous
state's function nesting level. Useful when the output is
to start at the left margin.
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="literal">
t
</code>
</p>
</td>
<td>
<p>
Enable function call/exit trace lines. May be followed by
a list (containing only one modifier) giving a numeric
maximum trace level, beyond which no output occurs for
either debugging or tracing macros. The default is a
compile time option.
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="literal">
T
</code>
</p>
</td>
<td>
<p>
Print the current timestamp for every line of output.
</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="informaltable">
<table cellpadding="0" cellspacing="0" style="position: fixed; top: 0px; display: none; left: 401px; width: 739px;">
<thead>
<tr>
<th style="width: 59.0312px;">
<p>
Flag
</p>
</th>
<th style="width: 678.969px;">
<p>
Description
</p>
</th>
</tr>
</thead>
</table>
</div>
<p>
The leading
<code class="literal">
+
</code>
or
<code class="literal">
-
</code>
character
and trailing list of modifiers are used for flag characters such
as
<code class="literal">
d
</code>
or
<code class="literal">
f
</code>
that can enable a
debug operation for all applicable modifiers or just some of them:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
With no leading
<code class="literal">
+
</code>
or
<code class="literal">
-
</code>
,
the flag value is set to exactly the modifier list as given.
</p>
</li>
<li class="listitem">
<p>
With a leading
<code class="literal">
+
</code>
or
<code class="literal">
-
</code>
,
the modifiers in the list are added to or subtracted from the
current modifier list.
</p>
</li>
</ul>
</div>
<p>
The following examples show how this works for the
<code class="literal">
d
</code>
flag. An empty
<code class="literal">
d
</code>
list
enabled output for all debug macros. A nonempty list enables
output only for the macro keywords in the list.
</p>
<p>
These statements set the
<code class="literal">
d
</code>
value to the
modifier list as given:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa85057396"><div class="copy-help left">Press ⌘+C to 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> debug <span class="token operator">=</span> <span class="token string">'d'</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token variable">@@debug</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>
<span class="token output"><span class="token punctuation">|</span> @@debug <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>
<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 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> debug <span class="token operator">=</span> <span class="token string">'d,error,warning'</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token variable">@@debug</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>
<span class="token output"><span class="token punctuation">|</span> @@debug <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>
<span class="token output"><span class="token punctuation">|</span> d,error,warning <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></code></pre>
</div>
<p>
A leading
<code class="literal">
+
</code>
or
<code class="literal">
-
</code>
adds to or
subtracts from the current
<code class="literal">
d
</code>
value:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa98524719"><div class="copy-help left">Press ⌘+C to 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> debug <span class="token operator">=</span> <span class="token string">'+d,loop'</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token variable">@@debug</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>
<span class="token output"><span class="token punctuation">|</span> @@debug <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>
<span class="token output"><span class="token punctuation">|</span> d,error,warning,loop <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>
<span class="token prompt">mysql></span> <span class="token keyword">SET</span> debug <span class="token operator">=</span> <span class="token string">'-d,error,loop'</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token variable">@@debug</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> @@debug <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> d,warning <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></code></pre>
</div>
<p>
Adding to
<span class="quote">
“
<span class="quote">
all macros enabled
</span>
”
</span>
results in no change:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa4335263"><div class="copy-help left">Press ⌘+C to 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> debug <span class="token operator">=</span> <span class="token string">'d'</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token variable">@@debug</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>
<span class="token output"><span class="token punctuation">|</span> @@debug <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>
<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 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> debug <span class="token operator">=</span> <span class="token string">'+d,loop'</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token variable">@@debug</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>
<span class="token output"><span class="token punctuation">|</span> @@debug <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>
<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 class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
<p>
Disabling all enabled macros disables the
<code class="literal">
d
</code>
flag entirely:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa76595357"><div class="copy-help left">Press ⌘+C to 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> debug <span class="token operator">=</span> <span class="token string">'d,error,loop'</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token variable">@@debug</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>
<span class="token output"><span class="token punctuation">|</span> @@debug <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>
<span class="token output"><span class="token punctuation">|</span> d,error,loop <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>
<span class="token prompt">mysql></span> <span class="token keyword">SET</span> debug <span class="token operator">=</span> <span class="token string">'-d,error,loop'</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token variable">@@debug</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>
<span class="token output"><span class="token punctuation">|</span> @@debug <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>
<span class="token output"><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></code></pre>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/mysql-cluster-ndbinfo-nodes.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="mysql-cluster-ndbinfo-nodes">
</a>
25.6.17.48 The ndbinfo nodes Table
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045088469536">
</a>
<p>
This table contains information on the status of data nodes. For
each data node that is running in the cluster, a corresponding
row in this table provides the node's node ID, status, and
uptime. For nodes that are starting, it also shows the current
start phase.
</p>
<p>
The
<code class="literal">
nodes
</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">
node_id
</code>
</p>
<p>
The data node's unique node ID in the cluster.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
uptime
</code>
</p>
<p>
Time since the node was last started, in seconds.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
status
</code>
</p>
<p>
Current status of the data node; see text for possible
values.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
start_phase
</code>
</p>
<p>
If the data node is starting, the current start phase.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
config_generation
</code>
</p>
<p>
The version of the cluster configuration file in use on this
data node.
</p>
</li>
</ul>
</div>
<h5>
<a name="idm46045088456080">
</a>
Notes
</h5>
<p>
The
<code class="literal">
uptime
</code>
column shows the time in seconds
that this node has been running since it was last started or
restarted. This is a
<a class="link" href="integer-types.html" title="13.1.2 Integer Types (Exact Value) - INTEGER, INT, SMALLINT, TINYINT, MEDIUMINT, BIGINT">
<code class="literal">
BIGINT
</code>
</a>
value. This figure includes the time actually needed to start
the node; in other words, this counter starts running the moment
that
<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
</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
</strong>
</span>
</a>
is
first invoked; thus, even for a node that has not yet finished
starting,
<code class="literal">
uptime
</code>
may show a nonzero value.
</p>
<p>
The
<code class="literal">
status
</code>
column shows the node's
current status. This is one of:
<code class="literal">
NOTHING
</code>
,
<code class="literal">
CMVMI
</code>
,
<code class="literal">
STARTING
</code>
,
<code class="literal">
STARTED
</code>
,
<code class="literal">
SINGLEUSER
</code>
,
<code class="literal">
STOPPING_1
</code>
,
<code class="literal">
STOPPING_2
</code>
,
<code class="literal">
STOPPING_3
</code>
, or
<code class="literal">
STOPPING_4
</code>
.
When the status is
<code class="literal">
STARTING
</code>
, you can see the
current start phase in the
<code class="literal">
start_phase
</code>
column
(see later in this section).
<code class="literal">
SINGLEUSER
</code>
is
displayed in the
<code class="literal">
status
</code>
column for all data
nodes when the cluster is in single user mode (see
<a class="xref" href="mysql-cluster-single-user-mode.html" title="25.6.6 NDB Cluster Single User Mode">
Section 25.6.6, “NDB Cluster Single User Mode”
</a>
). Seeing one of
the
<code class="literal">
STOPPING
</code>
states does not necessarily mean
that the node is shutting down but can mean rather that it is
entering a new state. For example, if you put the cluster in
single user mode, you can sometimes see data nodes report their
state briefly as
<code class="literal">
STOPPING_2
</code>
before the status
changes to
<code class="literal">
SINGLEUSER
</code>
.
</p>
<p>
The
<code class="literal">
start_phase
</code>
column uses the same range of
values as those used in the output of 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
<a class="link" href="mysql-cluster-mgm-client-commands.html#ndbclient-status">
<code class="literal">
<em class="replaceable">
<code>
node_id
</code>
</em>
STATUS
</code>
</a>
command (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>
). If the
node is not currently starting, then this column shows
<code class="literal">
0
</code>
. For a listing of NDB Cluster start phases
with descriptions, see
<a class="xref" href="mysql-cluster-start-phases.html" title="25.6.4 Summary of NDB Cluster Start Phases">
Section 25.6.4, “Summary of NDB Cluster Start Phases”
</a>
.
</p>
<p>
The
<code class="literal">
config_generation
</code>
column shows which
version of the cluster configuration is in effect on each data
node. This can be useful when performing a rolling restart of
the cluster in order to make changes in configuration
parameters. For example, from the output of the following
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
statement, you can see
that node 3 is not yet using the latest version of the cluster
configuration (
<code class="literal">
6
</code>
) although nodes 1, 2, and 4
are doing so:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa38194561"><div class="copy-help left">Press ⌘+C to 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">USE</span> ndbinfo<span class="token punctuation">;</span>
<span class="token keyword">Database</span> <span class="token keyword">changed</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> nodes<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> node_id <span class="token punctuation">|</span> uptime <span class="token punctuation">|</span> status <span class="token punctuation">|</span> start_phase <span class="token punctuation">|</span> config_generation <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> 1 <span class="token punctuation">|</span> 10462 <span class="token punctuation">|</span> STARTED <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span> 6 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 2 <span class="token punctuation">|</span> 10460 <span class="token punctuation">|</span> STARTED <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span> 6 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 3 <span class="token punctuation">|</span> 10457 <span class="token punctuation">|</span> STARTED <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span> 5 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 4 <span class="token punctuation">|</span> 10455 <span class="token punctuation">|</span> STARTED <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span> 6 <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">2 rows in set (0.04 sec)</span></code></pre>
</div>
<p>
Therefore, for the case just shown, you should restart node 3 to
complete the rolling restart of the cluster.
</p>
<p>
Nodes that are stopped are not accounted for in this table.
Suppose that you have an NDB Cluster with 4 data nodes (node IDs
1, 2, 3 and 4), and all nodes are running normally, then this
table contains 4 rows, 1 for each data node:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa99196166"><div class="copy-help left">Press ⌘+C to 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">USE</span> ndbinfo<span class="token punctuation">;</span>
<span class="token keyword">Database</span> <span class="token keyword">changed</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> nodes<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> node_id <span class="token punctuation">|</span> uptime <span class="token punctuation">|</span> status <span class="token punctuation">|</span> start_phase <span class="token punctuation">|</span> config_generation <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> 1 <span class="token punctuation">|</span> 11776 <span class="token punctuation">|</span> STARTED <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span> 6 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 2 <span class="token punctuation">|</span> 11774 <span class="token punctuation">|</span> STARTED <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span> 6 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 3 <span class="token punctuation">|</span> 11771 <span class="token punctuation">|</span> STARTED <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span> 6 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 4 <span class="token punctuation">|</span> 11769 <span class="token punctuation">|</span> STARTED <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span> 6 <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">4 rows in set (0.04 sec)</span></code></pre>
</div>
<p>
If you shut down one of the nodes, only the nodes that are still
running are represented in the output of this
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
statement, as shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-ndbmgm"><div class="docs-select-all right" id="sa26705359"><div class="copy-help left">Press ⌘+C to 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> 2 <span class="token keyword">STOP</span>
<span class="token selector">Node 2:</span> Node shutdown initiated
<span class="token selector">Node 2:</span> Node shutdown completed<span class="token punctuation">.</span>
<span class="token selector">Node 2</span> has shutdown<span class="token punctuation">.</span></code></pre>
</div>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa58971050"><div class="copy-help left">Press ⌘+C to 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> nodes<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> node_id <span class="token punctuation">|</span> uptime <span class="token punctuation">|</span> status <span class="token punctuation">|</span> start_phase <span class="token punctuation">|</span> config_generation <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> 1 <span class="token punctuation">|</span> 11807 <span class="token punctuation">|</span> STARTED <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span> 6 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 3 <span class="token punctuation">|</span> 11802 <span class="token punctuation">|</span> STARTED <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span> 6 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 4 <span class="token punctuation">|</span> 11800 <span class="token punctuation">|</span> STARTED <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span> 6 <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">3 rows in set (0.02 sec)</span></code></pre>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/create-procedure.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="create-procedure">
</a>
15.1.17 CREATE PROCEDURE and CREATE FUNCTION Statements
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045187287248">
</a>
<a class="indexterm" name="idm46045187286208">
</a>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa64014142"><div class="copy-help left">Press ⌘+C to 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">PROCEDURE</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">sp_name</em> <span class="token punctuation">(</span><span class="token punctuation">[</span><em class="replaceable">proc_parameter</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">characteristic</em> <span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">]</span> <em class="replaceable">routine_body</em>
<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">FUNCTION</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">sp_name</em> <span class="token punctuation">(</span><span class="token punctuation">[</span><em class="replaceable">func_parameter</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 keyword">RETURNS</span> <span class="token keyword"><em class="replaceable">type</em></span>
<span class="token punctuation">[</span><em class="replaceable">characteristic</em> <span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">]</span> <em class="replaceable">routine_body</em>
<em class="replaceable">proc_parameter</em>:
<span class="token punctuation">[</span> <span class="token keyword">IN</span> <span class="token operator">|</span> <span class="token keyword">OUT</span> <span class="token operator">|</span> <span class="token keyword">INOUT</span> <span class="token punctuation">]</span> <em class="replaceable">param_name</em> <span class="token keyword"><em class="replaceable">type</em></span>
<em class="replaceable">func_parameter</em>:
<em class="replaceable">param_name</em> <span class="token keyword"><em class="replaceable">type</em></span>
<span class="token keyword"><em class="replaceable">type</em></span>:
<span class="token keyword"></span><em class="replaceable"><span class="token keyword">Any</span> valid MySQL <span class="token keyword">data</span> <span class="token keyword">type</span></em><span class="token keyword"></span>
<em class="replaceable">characteristic</em>: {
<span class="token keyword">COMMENT</span> <span class="token string">'<em class="replaceable">string</em>'</span>
<span class="token operator">|</span> <span class="token keyword">LANGUAGE</span> <span class="token keyword">SQL</span>
<span class="token operator">|</span> <span class="token punctuation">[</span><span class="token operator">NOT</span><span class="token punctuation">]</span> <span class="token keyword">DETERMINISTIC</span>
<span class="token operator">|</span> { <span class="token keyword">CONTAINS</span> <span class="token keyword">SQL</span> <span class="token operator">|</span> <span class="token keyword">NO</span> <span class="token keyword">SQL</span> <span class="token operator">|</span> <span class="token keyword">READS</span> <span class="token keyword">SQL</span> <span class="token keyword">DATA</span> <span class="token operator">|</span> <span class="token keyword">MODIFIES</span> <span class="token keyword">SQL</span> <span class="token keyword">DATA</span> }
<span class="token operator">|</span> <span class="token keyword">SQL</span> <span class="token keyword">SECURITY</span> { <span class="token keyword">DEFINER</span> <span class="token operator">|</span> <span class="token keyword">INVOKER</span> }
}
<em class="replaceable">routine_body</em>:
<span class="token keyword"></span><em class="replaceable"><span class="token keyword">SQL</span> <span class="token keyword">routine</span></em><span class="token keyword"></span></code></pre>
</div>
<p>
These statements are used to create a stored routine (a stored
procedure or function). That is, the specified routine becomes
known to the server. By default, a stored routine is associated
with the default database. To associate the routine explicitly
with a given database, specify the name as
<em class="replaceable">
<code>
db_name.sp_name
</code>
</em>
when you create it.
</p>
<p>
The
<code class="literal">
CREATE FUNCTION
</code>
statement is also used in
MySQL to support loadable functions. See
<a class="xref" href="create-function-loadable.html" title="15.7.4.1 CREATE FUNCTION Statement for Loadable Functions">
Section 15.7.4.1, “CREATE FUNCTION Statement for Loadable Functions”
</a>
. A loadable function
can be regarded as an external stored function. Stored functions
share their namespace with loadable functions. 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>
, for the rules describing
how the server interprets references to different kinds of
functions.
</p>
<p>
To invoke a stored procedure, use the
<a class="link" href="call.html" title="15.2.1 CALL Statement">
<code class="literal">
CALL
</code>
</a>
statement (see
<a class="xref" href="call.html" title="15.2.1 CALL Statement">
Section 15.2.1, “CALL Statement”
</a>
). To invoke a stored function, refer to it
in an expression. The function returns a value during expression
evaluation.
</p>
<p>
<a class="link" href="create-procedure.html" title="15.1.17 CREATE PROCEDURE and CREATE FUNCTION Statements">
<code class="literal">
CREATE PROCEDURE
</code>
</a>
and
<a class="link" href="create-function.html" title="15.1.14 CREATE FUNCTION Statement">
<code class="literal">
CREATE FUNCTION
</code>
</a>
require the
<a class="link" href="privileges-provided.html#priv_create-routine">
<code class="literal">
CREATE ROUTINE
</code>
</a>
privilege. 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-function.html" title="15.1.14 CREATE FUNCTION Statement">
<code class="literal">
CREATE FUNCTION
</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>
By default, MySQL automatically grants the
<a class="link" href="privileges-provided.html#priv_alter-routine">
<code class="literal">
ALTER ROUTINE
</code>
</a>
and
<a class="link" href="privileges-provided.html#priv_execute">
<code class="literal">
EXECUTE
</code>
</a>
privileges to the routine
creator. This behavior can be changed by disabling the
<a class="link" href="server-system-variables.html#sysvar_automatic_sp_privileges">
<code class="literal">
automatic_sp_privileges
</code>
</a>
system
variable. See
<a class="xref" href="stored-routines-privileges.html" title="27.2.2 Stored Routines and MySQL Privileges">
Section 27.2.2, “Stored Routines and MySQL Privileges”
</a>
.
</p>
<p>
The
<code class="literal">
DEFINER
</code>
and
<code class="literal">
SQL SECURITY
</code>
clauses specify the security context to be used when checking
access privileges at routine execution time, as described later in
this section.
</p>
<p>
If the routine name is the same as the name of a built-in SQL
function, a syntax error occurs unless you use a space between the
name and the following parenthesis when defining the routine or
invoking it later. For this reason, avoid using the names of
existing SQL functions for your own stored routines.
</p>
<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 stored routines. It is
always permissible to have spaces after a stored routine 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>
<code class="literal">
IF NOT EXISTS
</code>
prevents an error from occurring
if there already exists a routine with the same name. This option
is supported with both
<code class="literal">
CREATE FUNCTION
</code>
and
<code class="literal">
CREATE PROCEDURE
</code>
.
</p>
<p>
If a built-in function with the same name already exists,
attempting to create a stored function with
<code class="literal">
CREATE
FUNCTION ... IF NOT EXISTS
</code>
succeeds with a warning
indicating that it has the same name as a native function; this is
no different than when performing the same
<code class="literal">
CREATE
FUNCTION
</code>
statement without specifying
<code class="literal">
IF NOT
EXISTS
</code>
.
</p>
<p>
If a loadable function with the same name already exists,
attempting to create a stored function using
<code class="literal">
IF NOT
EXISTS
</code>
succeeds with a warning. This is the same as
without specifying
<code class="literal">
IF NOT EXISTS
</code>
.
</p>
<p>
See
<a class="xref" href="function-resolution.html#function-name-resolution" title="Function Name Resolution">
Function Name Resolution
</a>
, for more
information.
</p>
<p>
The parameter list enclosed within parentheses must always be
present. If there are no parameters, an empty parameter list of
<code class="literal">
()
</code>
should be used. Parameter names are not
case-sensitive.
</p>
<p>
Each parameter is an
<code class="literal">
IN
</code>
parameter by default.
To specify otherwise for a parameter, use the keyword
<code class="literal">
OUT
</code>
or
<code class="literal">
INOUT
</code>
before the
parameter name.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
Specifying a parameter as
<code class="literal">
IN
</code>
,
<code class="literal">
OUT
</code>
, or
<code class="literal">
INOUT
</code>
is valid
only for a
<code class="literal">
PROCEDURE
</code>
. For a
<code class="literal">
FUNCTION
</code>
, parameters are always regarded as
<code class="literal">
IN
</code>
parameters.
</p>
</div>
<p>
An
<code class="literal">
IN
</code>
parameter passes a value into a
procedure. The procedure might modify the value, but the
modification is not visible to the caller when the procedure
returns. An
<code class="literal">
OUT
</code>
parameter passes a value from
the procedure back to the caller. Its initial value is
<code class="literal">
NULL
</code>
within the procedure, and its value is
visible to the caller when the procedure returns. An
<code class="literal">
INOUT
</code>
parameter is initialized by the caller,
can be modified by the procedure, and any change made by the
procedure is visible to the caller when the procedure returns.
</p>
<p>
For each
<code class="literal">
OUT
</code>
or
<code class="literal">
INOUT
</code>
parameter, pass a user-defined variable in the
<a class="link" href="call.html" title="15.2.1 CALL Statement">
<code class="literal">
CALL
</code>
</a>
statement that invokes the
procedure so that you can obtain its value when the procedure
returns. If you are calling the procedure from within another
stored procedure or function, you can also pass a routine
parameter or local routine variable as an
<code class="literal">
OUT
</code>
or
<code class="literal">
INOUT
</code>
parameter. If you are calling the
procedure from within a trigger, you can also pass
<code class="literal">
NEW.
<em class="replaceable">
<code>
col_name
</code>
</em>
</code>
as an
<code class="literal">
OUT
</code>
or
<code class="literal">
INOUT
</code>
parameter.
</p>
<p>
For information about the effect of unhandled conditions on
procedure parameters, see
<a class="xref" href="conditions-and-parameters.html" title="15.6.7.8 Condition Handling and OUT or INOUT Parameters">
Section 15.6.7.8, “Condition Handling and OUT or INOUT Parameters”
</a>
.
</p>
<p>
Routine parameters cannot be referenced in statements prepared
within the routine; 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>
The following example shows a simple stored procedure that, given
a country code, counts the number of cities for that country that
appear in the
<code class="literal">
city
</code>
table of the
<code class="literal">
world
</code>
database. The country code is passed
using an
<code class="literal">
IN
</code>
parameter, and the city count is
returned using an
<code class="literal">
OUT
</code>
parameter:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa72793285"><div class="copy-help left">Press ⌘+C to 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> citycount <span class="token punctuation">(</span><span class="token keyword">IN</span> country <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 keyword">OUT</span> cities <span class="token datatype">INT</span><span class="token punctuation">)</span>
<span class="token keyword">BEGIN</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">INTO</span> cities <span class="token keyword">FROM</span> world<span class="token punctuation">.</span>city
<span class="token keyword">WHERE</span> CountryCode <span class="token operator">=</span> country<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.01 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">delimiter</span> <span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">CALL</span> citycount<span class="token punctuation">(</span><span class="token string">'JPN'</span><span class="token punctuation">,</span> <span class="token variable">@cities</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment" spellcheck="true">-- cities in Japan</span>
<span class="token output">Query OK, 1 row affected (0.00 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token variable">@cities</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>
<span class="token output"><span class="token punctuation">|</span> @cities <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>
<span class="token output"><span class="token punctuation">|</span> 248 <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>
<span class="token output">1 row in set (0.00 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">CALL</span> citycount<span class="token punctuation">(</span><span class="token string">'FRA'</span><span class="token punctuation">,</span> <span class="token variable">@cities</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment" spellcheck="true">-- cities in France</span>
<span class="token output">Query OK, 1 row affected (0.00 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token variable">@cities</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>
<span class="token output"><span class="token punctuation">|</span> @cities <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>
<span class="token output"><span class="token punctuation">|</span> 40 <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>
<span class="token output">1 row in set (0.00 sec)</span></code></pre>
</div>
<p>
The example uses 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
<code class="literal">
delimiter
</code>
command to change the statement
delimiter from
<code class="literal">
;
</code>
to
<code class="literal">
//
</code>
while
the procedure is being defined. This enables the
<code class="literal">
;
</code>
delimiter used in the procedure body to be
passed through to the server rather than being interpreted by
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
itself. See
<a class="xref" href="stored-programs-defining.html" title="27.1 Defining Stored Programs">
Section 27.1, “Defining Stored Programs”
</a>
.
</p>
<p>
The
<code class="literal">
RETURNS
</code>
clause may be specified only for a
<code class="literal">
FUNCTION
</code>
, for which it is mandatory. It
indicates the return type of the function, and the function body
must contain a
<code class="literal">
RETURN
<em class="replaceable">
<code>
value
</code>
</em>
</code>
statement. If the
<a class="link" href="return.html" title="15.6.5.7 RETURN Statement">
<code class="literal">
RETURN
</code>
</a>
statement returns a value of
a different type, the value is coerced to the proper type. For
example, if a function specifies an
<a class="link" href="enum.html" title="13.3.5 The ENUM Type">
<code class="literal">
ENUM
</code>
</a>
or
<a class="link" href="set.html" title="13.3.6 The SET Type">
<code class="literal">
SET
</code>
</a>
value in the
<code class="literal">
RETURNS
</code>
clause, but the
<a class="link" href="return.html" title="15.6.5.7 RETURN Statement">
<code class="literal">
RETURN
</code>
</a>
statement returns an
integer, the value returned from the function is the string for
the corresponding
<a class="link" href="enum.html" title="13.3.5 The ENUM Type">
<code class="literal">
ENUM
</code>
</a>
member of
set of
<a class="link" href="set.html" title="13.3.6 The SET Type">
<code class="literal">
SET
</code>
</a>
members.
</p>
<p>
The following example function takes a parameter, performs an
operation using an SQL function, and returns the result. In this
case, it is unnecessary to use
<code class="literal">
delimiter
</code>
because the function definition contains no internal
<code class="literal">
;
</code>
statement delimiters:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa33199934"><div class="copy-help left">Press ⌘+C to 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">FUNCTION</span> hello <span class="token punctuation">(</span>s <span class="token datatype">CHAR</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 prompt"> -></span> <span class="token keyword">RETURNS</span> <span class="token datatype">CHAR</span><span class="token punctuation">(</span><span class="token number">50</span><span class="token punctuation">)</span> <span class="token keyword">DETERMINISTIC</span>
<span class="token prompt"> -></span> <span class="token keyword">RETURN</span> <span class="token function">CONCAT</span><span class="token punctuation">(</span><span class="token string">'Hello, '</span><span class="token punctuation">,</span>s<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, 0 rows affected (0.00 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> hello<span class="token punctuation">(</span><span class="token string">'world'</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>
<span class="token output"><span class="token punctuation">|</span> hello('world') <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> Hello, world! <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">1 row in set (0.00 sec)</span></code></pre>
</div>
<p>
Parameter types and function return types can be declared to use
any valid data type. The
<code class="literal">
COLLATE
</code>
attribute can
be used if preceded by a
<code class="literal">
CHARACTER SET
</code>
specification.
</p>
<p>
The
<em class="replaceable">
<code>
routine_body
</code>
</em>
consists of a valid
SQL routine statement. This can be a simple statement such as
<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>
, or a compound statement
written using
<code class="literal">
BEGIN
</code>
and
<code class="literal">
END
</code>
.
Compound statements can contain declarations, loops, and other
control structure statements. The syntax for these statements is
described in
<a class="xref" href="sql-compound-statements.html" title="15.6 Compound Statement Syntax">
Section 15.6, “Compound Statement Syntax”
</a>
. In
practice, stored functions tend to use compound statements, unless
the body consists of a single
<a class="link" href="return.html" title="15.6.5.7 RETURN Statement">
<code class="literal">
RETURN
</code>
</a>
statement.
</p>
<p>
MySQL permits routines to contain DDL statements, such as
<code class="literal">
CREATE
</code>
and
<code class="literal">
DROP
</code>
. MySQL also
permits stored procedures (but not stored functions) to contain
SQL transaction statements such as
<a class="link" href="commit.html" title="15.3.1 START TRANSACTION, COMMIT, and ROLLBACK Statements">
<code class="literal">
COMMIT
</code>
</a>
. Stored functions may not
contain statements that perform explicit or implicit commit or
rollback. Support for these statements is not required by the SQL
standard, which states that each DBMS vendor may decide whether to
permit them.
</p>
<p>
Statements that return a result set can be used within a stored
procedure but not within a stored function. This prohibition
includes
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
statements that do
not have an
<code class="literal">
INTO
<em class="replaceable">
<code>
var_list
</code>
</em>
</code>
clause and other
statements such as
<a class="link" href="show.html" title="15.7.7 SHOW Statements">
<code class="literal">
SHOW
</code>
</a>
,
<a class="link" href="explain.html" title="15.8.2 EXPLAIN Statement">
<code class="literal">
EXPLAIN
</code>
</a>
, and
<a class="link" href="check-table.html" title="15.7.3.2 CHECK TABLE Statement">
<code class="literal">
CHECK TABLE
</code>
</a>
. For statements that
can be determined at function definition time to return a result
set, a
<code class="literal">
Not allowed to return a result set from a
function
</code>
error occurs
(
<a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_sp_no_retset" target="_top">
<code class="literal">
ER_SP_NO_RETSET
</code>
</a>
). For statements
that can be determined only at runtime to return a result set, a
<code class="literal">
PROCEDURE %s can't return a result set in the given
context
</code>
error occurs
(
<a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_sp_badselect" target="_top">
<code class="literal">
ER_SP_BADSELECT
</code>
</a>
).
</p>
<p>
<a class="link" href="use.html" title="15.8.4 USE Statement">
<code class="literal">
USE
</code>
</a>
statements within stored
routines are not permitted. When a routine is invoked, an implicit
<code class="literal">
USE
<em class="replaceable">
<code>
db_name
</code>
</em>
</code>
is
performed (and undone when the routine terminates). The causes the
routine to have the given default database while it executes.
References to objects in databases other than the routine default
database should be qualified with the appropriate database name.
</p>
<p>
For additional information about statements that are not permitted
in stored routines, 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>
For information about invoking stored procedures from within
programs written in a language that has a MySQL interface, see
<a class="xref" href="call.html" title="15.2.1 CALL Statement">
Section 15.2.1, “CALL Statement”
</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 routine is created or altered,
and always executes the routine with this setting in force,
<span class="emphasis">
<em>
regardless of the current server SQL mode when the
routine begins executing
</em>
</span>
.
</p>
<p>
The switch from the SQL mode of the invoker to that of the routine
occurs after evaluation of arguments and assignment of the
resulting values to routine parameters. If you define a routine in
strict SQL mode but invoke it in nonstrict mode, assignment of
arguments to routine parameters does not take place in strict
mode. If you require that expressions passed to a routine be
assigned in strict SQL mode, you should invoke the routine with
strict mode in effect.
</p>
<p>
The
<code class="literal">
COMMENT
</code>
characteristic is a MySQL
extension, and may be used to describe the stored routine. This
information is displayed by the
<a class="link" href="show-create-procedure.html" title="15.7.7.10 SHOW CREATE PROCEDURE Statement">
<code class="literal">
SHOW CREATE
PROCEDURE
</code>
</a>
and
<a class="link" href="show-create-function.html" title="15.7.7.9 SHOW CREATE FUNCTION Statement">
<code class="literal">
SHOW CREATE
FUNCTION
</code>
</a>
statements.
</p>
<p>
The
<code class="literal">
LANGUAGE
</code>
characteristic indicates the
language in which the routine is written. The server ignores this
characteristic; only SQL routines are supported.
</p>
<p>
A routine is considered
<span class="quote">
“
<span class="quote">
deterministic
</span>
”
</span>
if it always
produces the same result for the same input parameters, and
<span class="quote">
“
<span class="quote">
not deterministic
</span>
”
</span>
otherwise. If neither
<code class="literal">
DETERMINISTIC
</code>
nor
<code class="literal">
NOT
DETERMINISTIC
</code>
is given in the routine definition, the
default is
<code class="literal">
NOT DETERMINISTIC
</code>
. To declare that a
function is deterministic, you must specify
<code class="literal">
DETERMINISTIC
</code>
explicitly.
</p>
<p>
Assessment of the nature of a routine is based on the
<span class="quote">
“
<span class="quote">
honesty
</span>
”
</span>
of the creator: MySQL does not check that a
routine declared
<code class="literal">
DETERMINISTIC
</code>
is free of
statements that produce nondeterministic results. However,
misdeclaring a routine might affect results or affect performance.
Declaring a nondeterministic routine as
<code class="literal">
DETERMINISTIC
</code>
might lead to unexpected results
by causing the optimizer to make incorrect execution plan choices.
Declaring a deterministic routine as
<code class="literal">
NONDETERMINISTIC
</code>
might diminish performance by
causing available optimizations not to be used.
</p>
<p>
If binary logging is enabled, the
<code class="literal">
DETERMINISTIC
</code>
characteristic affects which routine definitions MySQL accepts.
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>
<p>
A routine that contains the
<a class="link" href="date-and-time-functions.html#function_now">
<code class="literal">
NOW()
</code>
</a>
function (or its synonyms) or
<a class="link" href="mathematical-functions.html#function_rand">
<code class="literal">
RAND()
</code>
</a>
is nondeterministic, but it
might still be replication-safe. For
<a class="link" href="date-and-time-functions.html#function_now">
<code class="literal">
NOW()
</code>
</a>
, the binary log includes the
timestamp and replicates correctly.
<a class="link" href="mathematical-functions.html#function_rand">
<code class="literal">
RAND()
</code>
</a>
also replicates correctly as
long as it is called only a single time during the execution of a
routine. (You can consider the routine execution timestamp and
random number seed as implicit inputs that are identical on the
source and replica.)
</p>
<p>
Several characteristics provide information about the nature of
data use by the routine. In MySQL, these characteristics are
advisory only. The server does not use them to constrain what
kinds of statements a routine is permitted to execute.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
CONTAINS SQL
</code>
indicates that the routine
does not contain statements that read or write data. This is
the default if none of these characteristics is given
explicitly. Examples of such statements are
<code class="literal">
SET @x =
1
</code>
or
<code class="literal">
DO RELEASE_LOCK('abc')
</code>
,
which execute but neither read nor write data.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
NO SQL
</code>
indicates that the routine contains
no SQL statements.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
READS SQL DATA
</code>
indicates that the routine
contains statements that read data (for example,
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
), but not statements
that write data.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
MODIFIES SQL DATA
</code>
indicates that the
routine contains statements that may write data (for example,
<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>
).
</p>
</li>
</ul>
</div>
<p>
The
<code class="literal">
SQL SECURITY
</code>
characteristic can be
<code class="literal">
DEFINER
</code>
or
<code class="literal">
INVOKER
</code>
to
specify the security context; that is, whether the routine
executes using the privileges of the account named in the routine
<code class="literal">
DEFINER
</code>
clause or the user who invokes it. This
account must have permission to access the database with which the
routine is associated. The default value is
<code class="literal">
DEFINER
</code>
. The user who invokes the routine must
have the
<a class="link" href="privileges-provided.html#priv_execute">
<code class="literal">
EXECUTE
</code>
</a>
privilege for it,
as must the
<code class="literal">
DEFINER
</code>
account if the routine
executes in definer security context.
</p>
<p>
The
<code class="literal">
DEFINER
</code>
clause specifies the MySQL account
to be used when checking access privileges at routine execution
time for routines that have the
<code class="literal">
SQL SECURITY
DEFINER
</code>
characteristic.
</p>
<p>
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 stored routine 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-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. This is the same as specifying
<code class="literal">
DEFINER = CURRENT_USER
</code>
explicitly.
</p>
<p>
Within the body of a stored routine that is defined with the
<code class="literal">
SQL SECURITY DEFINER
</code>
characteristic, the
<a class="link" href="information-functions.html#function_current-user">
<code class="literal">
CURRENT_USER
</code>
</a>
function returns the
routine's
<code class="literal">
DEFINER
</code>
value. For information about
user auditing within stored routines, 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>
Consider the following procedure, which displays a count of the
number of MySQL accounts listed in the
<code class="literal">
mysql.user
</code>
system table:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa14287136"><div class="copy-help left">Press ⌘+C to 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> account_count<span class="token punctuation">(</span><span class="token punctuation">)</span>
<span class="token keyword">BEGIN</span>
<span class="token keyword">SELECT</span> <span class="token string">'Number of accounts:'</span><span class="token punctuation">,</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> mysql<span class="token punctuation">.</span><span class="token keyword">user</span><span class="token punctuation">;</span>
<span class="token keyword">END</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
The procedure is assigned a
<code class="literal">
DEFINER
</code>
account of
<code class="literal">
'admin'@'localhost'
</code>
no matter which user
defines it. It executes with the privileges of that account no
matter which user invokes it (because the default security
characteristic is
<code class="literal">
DEFINER
</code>
). The procedure
succeeds or fails depending on whether invoker has the
<a class="link" href="privileges-provided.html#priv_execute">
<code class="literal">
EXECUTE
</code>
</a>
privilege for it and
<code class="literal">
'admin'@'localhost'
</code>
has the
<a class="link" href="privileges-provided.html#priv_select">
<code class="literal">
SELECT
</code>
</a>
privilege for the
<code class="literal">
mysql.user
</code>
table.
</p>
<p>
Now suppose that the procedure is defined with the
<code class="literal">
SQL
SECURITY INVOKER
</code>
characteristic:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa78164002"><div class="copy-help left">Press ⌘+C to 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> account_count<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">SELECT</span> <span class="token string">'Number of accounts:'</span><span class="token punctuation">,</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> mysql<span class="token punctuation">.</span><span class="token keyword">user</span><span class="token punctuation">;</span>
<span class="token keyword">END</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
The procedure still has a
<code class="literal">
DEFINER
</code>
of
<code class="literal">
'admin'@'localhost'
</code>
, but in this case, it
executes with the privileges of the invoking user. Thus, the
procedure succeeds or fails depending on whether the invoker has
the
<a class="link" href="privileges-provided.html#priv_execute">
<code class="literal">
EXECUTE
</code>
</a>
privilege for it and
the
<a class="link" href="privileges-provided.html#priv_select">
<code class="literal">
SELECT
</code>
</a>
privilege for the
<code class="literal">
mysql.user
</code>
table.
</p>
<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>
<p>
The server handles the data type of a routine parameter, local
routine variable created with
<a class="link" href="declare.html" title="15.6.3 DECLARE Statement">
<code class="literal">
DECLARE
</code>
</a>
, or function return value
as follows:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Assignments are checked for data type mismatches and overflow.
Conversion and overflow problems result in warnings, or errors
in strict SQL mode.
</p>
</li>
<li class="listitem">
<p>
Only scalar values can be assigned. For example, a statement
such as
<code class="literal">
SET x = (SELECT 1, 2)
</code>
is invalid.
</p>
</li>
<li class="listitem">
<p>
For character data types, if
<code class="literal">
CHARACTER SET
</code>
is included in the declaration, the specified character set
and its default collation is used. If the
<code class="literal">
COLLATE
</code>
attribute is also present, that
collation is used rather than the default collation.
</p>
<p>
If
<code class="literal">
CHARACTER SET
</code>
and
<code class="literal">
COLLATE
</code>
are not present, the database
character set and collation in effect at routine creation time
are used. To avoid having the server use the database
character set and collation, provide an explicit
<code class="literal">
CHARACTER SET
</code>
and a
<code class="literal">
COLLATE
</code>
attribute for character data
parameters.
</p>
<p>
If you alter the database default character set or collation,
stored routines that are to use the new database defaults must
be dropped and recreated.
</p>
<p>
The database character set and collation are given by the
value of the
<a class="link" href="server-system-variables.html#sysvar_character_set_database">
<code class="literal">
character_set_database
</code>
</a>
and
<a class="link" href="server-system-variables.html#sysvar_collation_database">
<code class="literal">
collation_database
</code>
</a>
system
variables. For more information, see
<a class="xref" href="charset-database.html" title="12.3.3 Database Character Set and Collation">
Section 12.3.3, “Database Character Set and Collation”
</a>
.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/performance-schema-error-log-table.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="performance-schema-error-log-table">
</a>
29.12.22.2 The error_log Table
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045067750272">
</a>
<a class="indexterm" name="idm46045067748784">
</a>
<p>
Of the logs the MySQL server maintains, one is the error log
to which it writes diagnostic messages (see
<a class="xref" href="error-log.html" title="7.4.2 The Error Log">
Section 7.4.2, “The Error Log”
</a>
). Typically, the server writes
diagnostics to a file on the server host or to a system log
service. Depending on error log configuration, the server can
also write the most recent error events to the Performance
Schema
<a class="link" href="performance-schema-error-log-table.html" title="29.12.22.2 The error_log Table">
<code class="literal">
error_log
</code>
</a>
table. Granting
the
<a class="link" href="privileges-provided.html#priv_select">
<code class="literal">
SELECT
</code>
</a>
privilege for the
<a class="link" href="performance-schema-error-log-table.html" title="29.12.22.2 The error_log Table">
<code class="literal">
error_log
</code>
</a>
table thus gives
clients and applications access to error log contents using
SQL queries, enabling DBAs to provide access to the log
without the need to permit direct file system access on the
server host.
</p>
<p>
The
<a class="link" href="performance-schema-error-log-table.html" title="29.12.22.2 The error_log Table">
<code class="literal">
error_log
</code>
</a>
table supports
focused queries based on its more structured columns. It also
includes the full text of error messages to support more
free-form analysis.
</p>
<p>
The table implementation uses a fixed-size, in-memory ring
buffer, with old events automatically discarded as necessary
to make room for new ones.
</p>
<p>
Example
<a class="link" href="performance-schema-error-log-table.html" title="29.12.22.2 The error_log Table">
<code class="literal">
error_log
</code>
</a>
contents:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa86299236"><div class="copy-help left">Press ⌘+C to 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>error_log\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>
LOGGED<span class="token punctuation">:</span> 2020-08-06 09<span class="token punctuation">:</span>25<span class="token punctuation">:</span>00.338624
THREAD_ID<span class="token punctuation">:</span> 0
PRIO<span class="token punctuation">:</span> System
ERROR_CODE<span class="token punctuation">:</span> MY-010116
SUBSYSTEM<span class="token punctuation">:</span> Server
DATA<span class="token punctuation">:</span> mysqld (mysqld 8.4.3) starting as process 96344
<span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span 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>
LOGGED<span class="token punctuation">:</span> 2020-08-06 09<span class="token punctuation">:</span>25<span class="token punctuation">:</span>00.363521
THREAD_ID<span class="token punctuation">:</span> 1
PRIO<span class="token punctuation">:</span> System
ERROR_CODE<span class="token punctuation">:</span> MY-013576
SUBSYSTEM<span class="token punctuation">:</span> InnoDB
DATA<span class="token punctuation">:</span> InnoDB initialization has started.
...
<span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span> 65. 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>
LOGGED<span class="token punctuation">:</span> 2020-08-06 09<span class="token punctuation">:</span>25<span class="token punctuation">:</span>02.936146
THREAD_ID<span class="token punctuation">:</span> 0
PRIO<span class="token punctuation">:</span> Warning
ERROR_CODE<span class="token punctuation">:</span> MY-010068
SUBSYSTEM<span class="token punctuation">:</span> Server
DATA<span class="token punctuation">:</span> CA certificate /var/mysql/sslinfo/cacert.pem is self signed.
...
<span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span> 89. 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>
LOGGED<span class="token punctuation">:</span> 2020-08-06 09<span class="token punctuation">:</span>25<span class="token punctuation">:</span>03.112801
THREAD_ID<span class="token punctuation">:</span> 0
PRIO<span class="token punctuation">:</span> System
ERROR_CODE<span class="token punctuation">:</span> MY-013292
SUBSYSTEM<span class="token punctuation">:</span> Server
DATA<span class="token punctuation">:</span> Admin interface ready for connections, address<span class="token punctuation">:</span> '127.0.0.1' port<span class="token punctuation">:</span> 33062</span></code></pre>
</div>
<p>
The
<a class="link" href="performance-schema-error-log-table.html" title="29.12.22.2 The error_log Table">
<code class="literal">
error_log
</code>
</a>
table has the
following columns. As indicated in the descriptions, all but
the
<code class="literal">
DATA
</code>
column correspond to fields of the
underlying error event structure, which is described in
<a class="xref" href="error-log-event-fields.html" title="7.4.2.3 Error Event Fields">
Section 7.4.2.3, “Error Event Fields”
</a>
.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
LOGGED
</code>
</p>
<p>
The event timestamp, with microsecond precision.
<code class="literal">
LOGGED
</code>
corresponds to the
<code class="literal">
time
</code>
field of error events, although
with certain potential differences:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<code class="literal">
time
</code>
values in the error log are
displayed according to the
<a class="link" href="server-system-variables.html#sysvar_log_timestamps">
<code class="literal">
log_timestamps
</code>
</a>
system
variable setting; see
<a class="xref" href="error-log-format.html#error-log-format-output-format-for-early-logging" title="Early-Startup Logging Output Format">
Early-Startup Logging Output Format
</a>
.
</p>
</li>
<li class="listitem">
<p>
The
<code class="literal">
LOGGED
</code>
column stores values
using the
<a class="link" href="datetime.html" title="13.2.2 The DATE, DATETIME, and TIMESTAMP Types">
<code class="literal">
TIMESTAMP
</code>
</a>
data type, for which values are stored in UTC but
displayed when retrieved in the current session time
zone; see
<a class="xref" href="datetime.html" title="13.2.2 The DATE, DATETIME, and TIMESTAMP Types">
Section 13.2.2, “The DATE, DATETIME, and TIMESTAMP Types”
</a>
.
</p>
</li>
</ul>
</div>
<p>
To display
<code class="literal">
LOGGED
</code>
values in the same
time zone as displayed in the error log file, first set
the session time zone as follows:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa40231358"><div class="copy-help left">Press ⌘+C to 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">@@session.time_zone</span> <span class="token operator">=</span> <span class="token variable">@@global.log_timestamps</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
If the
<a class="link" href="server-system-variables.html#sysvar_log_timestamps">
<code class="literal">
log_timestamps
</code>
</a>
value is
<code class="literal">
UTC
</code>
and your system does not
have named time zone support installed (see
<a class="xref" href="time-zone-support.html" title="7.1.15 MySQL Server Time Zone Support">
Section 7.1.15, “MySQL Server Time Zone Support”
</a>
), set the time zone
like this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa8453771"><div class="copy-help left">Press ⌘+C to 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">@@session.time_zone</span> <span class="token operator">=</span> <span class="token string">'+00:00'</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
<code class="literal">
THREAD_ID
</code>
</p>
<p>
The MySQL thread ID.
<code class="literal">
THREAD_ID
</code>
corresponds to the
<code class="literal">
thread
</code>
field of
error events.
</p>
<p>
Within the Performance Schema, the
<code class="literal">
THREAD_ID
</code>
column in the
<a class="link" href="performance-schema-error-log-table.html" title="29.12.22.2 The error_log Table">
<code class="literal">
error_log
</code>
</a>
table is most
similar to the
<code class="literal">
PROCESSLIST_ID
</code>
column of
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:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
For foreground threads,
<code class="literal">
THREAD_ID
</code>
and
<code class="literal">
PROCESSLIST_ID
</code>
represent a
connection identifier. This is the same value
displayed in the
<code class="literal">
ID
</code>
column of the
<code class="literal">
INFORMATION_SCHEMA
</code>
<a class="link" href="information-schema-processlist-table.html" title="28.3.23 The INFORMATION_SCHEMA PROCESSLIST Table">
<code class="literal">
PROCESSLIST
</code>
</a>
table,
displayed in the
<code class="literal">
Id
</code>
column of
<a class="link" href="show-processlist.html" title="15.7.7.31 SHOW PROCESSLIST Statement">
<code class="literal">
SHOW PROCESSLIST
</code>
</a>
output, and returned by the
<a class="link" href="information-functions.html#function_connection-id">
<code class="literal">
CONNECTION_ID()
</code>
</a>
function within the thread.
</p>
</li>
<li class="listitem">
<p>
For background threads,
<code class="literal">
THREAD_ID
</code>
is 0 and
<code class="literal">
PROCESSLIST_ID
</code>
is
<code class="literal">
NULL
</code>
.
</p>
</li>
</ul>
</div>
<p>
Many Performance Schema tables other than
<a class="link" href="performance-schema-error-log-table.html" title="29.12.22.2 The error_log Table">
<code class="literal">
error_log
</code>
</a>
has a column named
<code class="literal">
THREAD_ID
</code>
, but in those tables, the
<code class="literal">
THREAD_ID
</code>
column is a value assigned
internally by the Performance Schema.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
PRIO
</code>
</p>
<p>
The event priority. Permitted values are
<code class="literal">
System
</code>
,
<code class="literal">
Error
</code>
,
<code class="literal">
Warning
</code>
,
<code class="literal">
Note
</code>
. The
<code class="literal">
PRIO
</code>
column is based on the
<code class="literal">
label
</code>
field of error events, which
itself is based on the underlying numeric
<code class="literal">
prio
</code>
field value.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
ERROR_CODE
</code>
</p>
<p>
The numeric event error code.
<code class="literal">
ERROR_CODE
</code>
corresponds to the
<code class="literal">
error_code
</code>
field of error events.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
SUBSYSTEM
</code>
</p>
<p>
The subsystem in which the event occurred.
<code class="literal">
SUBSYSTEM
</code>
corresponds to the
<code class="literal">
subsystem
</code>
field of error events.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
DATA
</code>
</p>
<p>
The text representation of the error event. The format of
this value depends on the format produced by the log sink
component that generates the
<a class="link" href="performance-schema-error-log-table.html" title="29.12.22.2 The error_log Table">
<code class="literal">
error_log
</code>
</a>
row. For example,
if the log sink is
<code class="literal">
log_sink_internal
</code>
or
<code class="literal">
log_sink_json
</code>
,
<code class="literal">
DATA
</code>
values represent error events in traditional or JSON
format, respectively. (See
<a class="xref" href="error-log-format.html" title="7.4.2.9 Error Log Output Format">
Section 7.4.2.9, “Error Log Output Format”
</a>
.)
</p>
<p>
Because the error log can be reconfigured to change the
log sink component that supplies rows to the
<a class="link" href="performance-schema-error-log-table.html" title="29.12.22.2 The error_log Table">
<code class="literal">
error_log
</code>
</a>
table, and because
different sinks produce different output formats, it is
possible for rows written to the
<a class="link" href="performance-schema-error-log-table.html" title="29.12.22.2 The error_log Table">
<code class="literal">
error_log
</code>
</a>
table at different
times to have different
<code class="literal">
DATA
</code>
formats.
</p>
</li>
</ul>
</div>
<p>
The
<a class="link" href="performance-schema-error-log-table.html" title="29.12.22.2 The error_log Table">
<code class="literal">
error_log
</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">
LOGGED
</code>
)
</p>
</li>
<li class="listitem">
<p>
Index on (
<code class="literal">
THREAD_ID
</code>
)
</p>
</li>
<li class="listitem">
<p>
Index on (
<code class="literal">
PRIO
</code>
)
</p>
</li>
<li class="listitem">
<p>
Index on (
<code class="literal">
ERROR_CODE
</code>
)
</p>
</li>
<li class="listitem">
<p>
Index on (
<code class="literal">
SUBSYSTEM
</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-error-log-table.html" title="29.12.22.2 The error_log Table">
<code class="literal">
error_log
</code>
</a>
table.
</p>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="performance-schema-error-log-table-implementation">
</a>
Implementation and Configuration of the error_log Table
</h5>
</div>
</div>
</div>
<p>
The Performance Schema
<a class="link" href="performance-schema-error-log-table.html" title="29.12.22.2 The error_log Table">
<code class="literal">
error_log
</code>
</a>
table is populated by
error log sink components that write to the table in
addition to writing formatted error events to the error log.
Performance Schema support by log sinks has two parts:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
A log sink can write new error events to the
<a class="link" href="performance-schema-error-log-table.html" title="29.12.22.2 The error_log Table">
<code class="literal">
error_log
</code>
</a>
table as they
occur.
</p>
</li>
<li class="listitem">
<p>
A log sink can provide a parser for extraction of
previously written error messages. This enables a server
instance to read messages written to an error log file
by the previous instance and store them in the
<a class="link" href="performance-schema-error-log-table.html" title="29.12.22.2 The error_log Table">
<code class="literal">
error_log
</code>
</a>
table. Messages
written during shutdown by the previous instance may be
useful for diagnosing why shutdown occurred.
</p>
</li>
</ul>
</div>
<p>
Currently, the traditional-format
<code class="literal">
log_sink_internal
</code>
and JSON-format
<code class="literal">
log_sink_json
</code>
sinks support writing new
events to the
<a class="link" href="performance-schema-error-log-table.html" title="29.12.22.2 The error_log Table">
<code class="literal">
error_log
</code>
</a>
table
and provide a parser for reading previously written error
log files.
</p>
<p>
The
<a class="link" href="server-system-variables.html#sysvar_log_error_services">
<code class="literal">
log_error_services
</code>
</a>
system variable controls which log components to enable for
error logging. Its value is a pipeline of log filter and log
sink components to be executed in left-to-right order when
error events occur. The
<a class="link" href="server-system-variables.html#sysvar_log_error_services">
<code class="literal">
log_error_services
</code>
</a>
value
pertains to populating the
<a class="link" href="performance-schema-error-log-table.html" title="29.12.22.2 The error_log Table">
<code class="literal">
error_log
</code>
</a>
table as follows:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
At startup, the server examines the
<a class="link" href="server-system-variables.html#sysvar_log_error_services">
<code class="literal">
log_error_services
</code>
</a>
value and chooses from it the leftmost log sink that
satisfies these conditions:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
A sink that supports the
<a class="link" href="performance-schema-error-log-table.html" title="29.12.22.2 The error_log Table">
<code class="literal">
error_log
</code>
</a>
table and
provides a parser.
</p>
</li>
<li class="listitem">
<p>
If none, a sink that supports the
<a class="link" href="performance-schema-error-log-table.html" title="29.12.22.2 The error_log Table">
<code class="literal">
error_log
</code>
</a>
table but
provides no parser.
</p>
</li>
</ul>
</div>
<p>
If no log sink satisfies those conditions, the
<a class="link" href="performance-schema-error-log-table.html" title="29.12.22.2 The error_log Table">
<code class="literal">
error_log
</code>
</a>
table remains
empty. Otherwise, if the sink provides a parser and log
configuration enables a previously written error log
file to be found, the server uses the sink parser to
read the last part of the file and writes the old events
it contains to the table. The sink then writes new error
events to the table as they occur.
</p>
</li>
<li class="listitem">
<p>
At runtime, if the value of
<a class="link" href="server-system-variables.html#sysvar_log_error_services">
<code class="literal">
log_error_services
</code>
</a>
changes, the server again examines it, this time looking
for the leftmost enabled log sink that supports the
<a class="link" href="performance-schema-error-log-table.html" title="29.12.22.2 The error_log Table">
<code class="literal">
error_log
</code>
</a>
table, regardless
of whether it provides a parser.
</p>
<p>
If no such log sink exists, no additional error events
are written to the
<a class="link" href="performance-schema-error-log-table.html" title="29.12.22.2 The error_log Table">
<code class="literal">
error_log
</code>
</a>
table. Otherwise,
the newly configured sink writes new error events to the
table as they occur.
</p>
</li>
</ul>
</div>
<p>
Any configuration that affects output written to the error
log affects
<a class="link" href="performance-schema-error-log-table.html" title="29.12.22.2 The error_log Table">
<code class="literal">
error_log
</code>
</a>
table
contents. This includes settings such as those for
verbosity, message suppression, and message filtering. It
also applies to information read at startup from a previous
log file. For example, messages not written during a
previous server instance configured with low verbosity do
not become available if the file is read by a current
instance configured with higher verbosity.
</p>
<p>
The
<a class="link" href="performance-schema-error-log-table.html" title="29.12.22.2 The error_log Table">
<code class="literal">
error_log
</code>
</a>
table is a view
on a fixed-size, in-memory ring buffer, with old events
automatically discarded as necessary to make room for new
ones. As shown in the following table, several status
variables provide information about ongoing
<a class="link" href="performance-schema-error-log-table.html" title="29.12.22.2 The error_log Table">
<code class="literal">
error_log
</code>
</a>
operation.
</p>
<div class="informaltable">
<table summary="error_log table status variables.">
<colgroup>
<col style="width: 35%"/>
<col style="width: 35%"/>
</colgroup>
<thead>
<tr>
<th>
Status Variable
</th>
<th>
Meaning
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a class="link" href="server-status-variables.html#statvar_Error_log_buffered_bytes">
<code class="literal">
Error_log_buffered_bytes
</code>
</a>
</td>
<td>
Bytes used in table
</td>
</tr>
<tr>
<td>
<a class="link" href="server-status-variables.html#statvar_Error_log_buffered_events">
<code class="literal">
Error_log_buffered_events
</code>
</a>
</td>
<td>
Events present in table
</td>
</tr>
<tr>
<td>
<a class="link" href="server-status-variables.html#statvar_Error_log_expired_events">
<code class="literal">
Error_log_expired_events
</code>
</a>
</td>
<td>
Events discarded from table
</td>
</tr>
<tr>
<td>
<a class="link" href="server-status-variables.html#statvar_Error_log_latest_write">
<code class="literal">
Error_log_latest_write
</code>
</a>
</td>
<td>
Time of last write to table
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/mysql-cluster-ndbd-definition.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="mysql-cluster-ndbd-definition">
</a>
25.4.3.6 Defining NDB Cluster Data Nodes
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045119994640">
</a>
<a class="indexterm" name="idm46045119993152">
</a>
<p>
The
<code class="literal">
[ndbd]
</code>
and
<code class="literal">
[ndbd
default]
</code>
sections are used to configure the behavior
of the cluster's data nodes.
</p>
<p>
<code class="literal">
[ndbd]
</code>
and
<code class="literal">
[ndbd default]
</code>
are always used as the section names whether you are using
<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
</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
</strong>
</span>
</a>
binaries
for the data node processes.
</p>
<p>
There are many parameters which control buffer sizes, pool
sizes, timeouts, and so forth. The only mandatory parameter is
<code class="literal">
ExecuteOnComputer
</code>
; this must be defined in
the local
<code class="literal">
[ndbd]
</code>
section.
</p>
<p>
The parameter
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-noofreplicas">
<code class="literal">
NoOfReplicas
</code>
</a>
should be
defined in the
<code class="literal">
[ndbd default]
</code>
section, as it
is common to all Cluster data nodes. It is not strictly
necessary to set
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-noofreplicas">
<code class="literal">
NoOfReplicas
</code>
</a>
, but it is
good practice to set it explicitly.
</p>
<p>
Most data node parameters are set in the
<code class="literal">
[ndbd
default]
</code>
section. Only those parameters explicitly
stated as being able to set local values are permitted to be
changed in the
<code class="literal">
[ndbd]
</code>
section. Where present,
<code class="literal">
HostName
</code>
and
<code class="literal">
NodeId
</code>
<span class="emphasis">
<em>
must
</em>
</span>
be defined in the local
<code class="literal">
[ndbd]
</code>
section, and not in any other section
of
<code class="filename">
config.ini
</code>
. In other words, settings for
these parameters are specific to one data node.
</p>
<p>
For those parameters affecting memory usage or buffer sizes, it
is possible to use
<code class="literal">
K
</code>
,
<code class="literal">
M
</code>
,
or
<code class="literal">
G
</code>
as a suffix to indicate units of 1024,
1024×1024, or 1024×1024×1024. (For example,
<code class="literal">
100K
</code>
means 100 × 1024 = 102400.)
</p>
<p>
Parameter names and values are case-insensitive, unless used in
a MySQL Server
<code class="filename">
my.cnf
</code>
or
<code class="filename">
my.ini
</code>
file, in which case they are
case-sensitive.
</p>
<p>
Information about configuration parameters specific to NDB
Cluster Disk Data tables can be found later in this section (see
<a class="xref" href="mysql-cluster-ndbd-definition.html#mysql-cluster-ndbd-definition-disk-data-parameters" title="Disk Data Configuration Parameters">
Disk Data Configuration Parameters
</a>
).
</p>
<p>
All of these parameters also apply to
<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
</strong>
</span>
</a>
(the multithreaded version of
<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
</strong>
</span>
</a>
). Three
additional data node configuration
parameters—
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbmtd-maxnoofexecutionthreads">
<code class="literal">
MaxNoOfExecutionThreads
</code>
</a>
,
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbmtd-threadconfig">
<code class="literal">
ThreadConfig
</code>
</a>
, and
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbmtd-nooffragmentlogparts">
<code class="literal">
NoOfFragmentLogParts
</code>
</a>
—apply
to
<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
</strong>
</span>
</a>
only; these have no effect when
used with
<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
</strong>
</span>
</a>
. For more information, see
<a class="xref" href="mysql-cluster-ndbd-definition.html#mysql-cluster-ndbd-definition-ndbmtd-parameters" title="Multi-Threading Configuration Parameters (ndbmtd)">
Multi-Threading Configuration Parameters (ndbmtd)
</a>
.
See also
<a class="xref" href="mysql-cluster-programs-ndbmtd.html" title="25.5.3 ndbmtd — The NDB Cluster Data Node Daemon (Multi-Threaded)">
Section 25.5.3, “ndbmtd — The NDB Cluster Data Node Daemon (Multi-Threaded)”
</a>
.
</p>
<p>
<a name="mysql-cluster-identifying-data-nodes">
</a>
<b>
Identifying data nodes.
</b>
The
<code class="literal">
NodeId
</code>
or
<code class="literal">
Id
</code>
value
(that is, the data node identifier) can be allocated on the
command line when the node is started or in the configuration
file.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a name="ndbparam-ndbd-nodeid">
</a>
<code class="literal">
NodeId
</code>
</p>
<a class="indexterm" name="idm46045119950768">
</a>
<div class="informaltable">
<a name="nodeid-ndbd-table">
</a>
<table frame="box" rules="all" summary="NodeId data node 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>
unsigned
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
[...]
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
1 - 144
</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>
A unique node ID is used as the node's address for all
cluster internal messages. For data nodes, this is an
integer in the range 1 to 144 inclusive. Each node in the
cluster must have a unique identifier.
</p>
<p>
<code class="literal">
NodeId
</code>
is the only supported parameter
name to use when identifying data nodes.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-executeoncomputer">
</a>
<code class="literal">
ExecuteOnComputer
</code>
</p>
<a class="indexterm" name="idm46045119929440">
</a>
<div class="informaltable">
<a name="executeoncomputer-ndbd-table">
</a>
<table frame="box" rules="all" summary="ExecuteOnComputer data node 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
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
[...]
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
...
</td>
</tr>
<tr>
<th>
Deprecated
</th>
<td>
Yes (in NDB 7.5)
</td>
</tr>
<tr>
<th>
Restart Type
</th>
<td>
<p>
<span class="bold">
<strong>
System Restart:
</strong>
</span>
Requires a complete shutdown and restart
of the cluster. (NDB 8.4.0)
</p>
</td>
</tr>
</tbody>
</table>
</div>
<p>
This refers to the
<code class="literal">
Id
</code>
set for one of the
computers defined in a
<code class="literal">
[computer]
</code>
section.
</p>
<div class="important" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Important
</div>
<p>
This parameter is deprecated, and is subject to removal in
a future release. Use the
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-hostname">
<code class="literal">
HostName
</code>
</a>
parameter
instead.
</p>
</div>
</li>
<li class="listitem">
<a name="ndbparam-ndbd-dedicated">
</a>
<a class="indexterm" name="idm46045119905760">
</a>
<p>
</p>
<p>
The node ID for this node can be given out only to
connections that explicitly request it. A management server
that requests
<span class="quote">
“
<span class="quote">
any
</span>
”
</span>
node ID cannot use this
one. This parameter can be used when running multiple
management servers on the same host, and
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-hostname">
<code class="literal">
HostName
</code>
</a>
is not
sufficient for distinguishing among processes.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-hostname">
</a>
<code class="literal">
HostName
</code>
</p>
<a class="indexterm" name="idm46045119899472">
</a>
<div class="informaltable">
<a name="hostname-ndbd-table">
</a>
<table frame="box" rules="all" summary="HostName data node 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>
localhost
</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>
Specifying this parameter defines the hostname of the
computer on which the data node is to reside. Use
<code class="literal">
HostName
</code>
to specify a host name other
than
<code class="literal">
localhost
</code>
.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-serverport">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-serverport">
<code class="literal">
ServerPort
</code>
</a>
</p>
<a class="indexterm" name="idm46045119877504">
</a>
<div class="informaltable">
<a name="serverport-ndbd-table">
</a>
<table frame="box" rules="all" summary="ServerPort data node 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>
unsigned
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
[...]
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
1 - 64K
</td>
</tr>
<tr>
<th>
Restart Type
</th>
<td>
<p>
<span class="bold">
<strong>
System Restart:
</strong>
</span>
Requires a complete shutdown and restart
of the cluster. (NDB 8.4.0)
</p>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Each node in the cluster uses a port to connect to other
nodes. By default, this port is allocated dynamically in
such a way as to ensure that no two nodes on the same host
computer receive the same port number, so it should normally
not be necessary to specify a value for this parameter.
</p>
<p>
However, if you need to be able to open specific ports in a
firewall to permit communication between data nodes and API
nodes (including SQL nodes), you can set this parameter to
the number of the desired port in an
<code class="literal">
[ndbd]
</code>
section or (if you need to do this
for multiple data nodes) the
<code class="literal">
[ndbd
default]
</code>
section of the
<code class="filename">
config.ini
</code>
file, and then open the port
having that number for incoming connections from SQL nodes,
API nodes, or both.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
Connections from data nodes to management nodes is done
using 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
</strong>
</span>
</a>
management port (the
management server's
<a class="link" href="mysql-cluster-mgm-definition.html#ndbparam-mgmd-portnumber">
<code class="literal">
PortNumber
</code>
</a>
) so
outgoing connections to that port from any data nodes
should always be permitted.
</p>
</div>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-tcpbind_inaddr_any">
</a>
<code class="literal">
TcpBind_INADDR_ANY
</code>
</p>
<p>
Setting this parameter to
<code class="literal">
TRUE
</code>
or
<code class="literal">
1
</code>
binds
<code class="literal">
IP_ADDR_ANY
</code>
so
that connections can be made from anywhere (for
autogenerated connections). The default is
<code class="literal">
FALSE
</code>
(
<code class="literal">
0
</code>
).
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-nodegroup">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-nodegroup">
<code class="literal">
NodeGroup
</code>
</a>
</p>
<a class="indexterm" name="idm46045119845216">
</a>
<div class="informaltable">
<a name="nodegroup-ndbd-table">
</a>
<table frame="box" rules="all" summary="NodeGroup data node 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>
unsigned
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
[...]
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
0 - 65536
</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 parameter can be used to assign a data node to a
specific node group. It is read only when the cluster is
started for the first time, and cannot be used to reassign a
data node to a different node group online. It is generally
not desirable to use this parameter in the
<code class="literal">
[ndbd
default]
</code>
section of the
<code class="filename">
config.ini
</code>
file, and care must be taken
not to assign nodes to node groups in such a way that an
invalid numbers of nodes are assigned to any node groups.
</p>
<p>
The
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-nodegroup">
<code class="literal">
NodeGroup
</code>
</a>
parameter is chiefly intended for use in adding a new node
group to a running NDB Cluster without having to perform a
rolling restart. For this purpose, you should set it to
65536 (the maximum value). You are not required to set a
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-nodegroup">
<code class="literal">
NodeGroup
</code>
</a>
value for
all cluster data nodes, only for those nodes which are to be
started and added to the cluster as a new node group at a
later time. For more information, see
<a class="xref" href="mysql-cluster-online-add-node-example.html" title="25.6.7.3 Adding NDB Cluster Data Nodes Online: Detailed Example">
Section 25.6.7.3, “Adding NDB Cluster Data Nodes Online: Detailed Example”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-locationdomainid">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-locationdomainid">
<code class="literal">
LocationDomainId
</code>
</a>
</p>
<a class="indexterm" name="idm46045119818624">
</a>
<div class="informaltable">
<a name="locationdomainid-ndbd-table">
</a>
<table frame="box" rules="all" summary="LocationDomainId data node 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>
integer
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
0
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
0 - 16
</td>
</tr>
<tr>
<th>
Restart Type
</th>
<td>
<p>
<span class="bold">
<strong>
System Restart:
</strong>
</span>
Requires a complete shutdown and restart
of the cluster. (NDB 8.4.0)
</p>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Assigns a data node to a specific
<a class="ulink" href="https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/regions.htm" target="_blank">
availability
domain
</a>
(also known as an availability zone) within a
cloud. By informing
<code class="literal">
NDB
</code>
which nodes are
in which availability domains, performance can be improved
in a cloud environment in the following ways:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
If requested data is not found on the same node, reads
can be directed to another node in the same availability
domain.
</p>
</li>
<li class="listitem">
<p>
Communication between nodes in different availability
domains are guaranteed to use
<code class="literal">
NDB
</code>
transporters' WAN support without any further
manual intervention.
</p>
</li>
<li class="listitem">
<p>
The transporter's group number can be based on
which availability domain is used, such that also SQL
and other API nodes communicate with local data nodes in
the same availability domain whenever possible.
</p>
</li>
<li class="listitem">
<p>
The arbitrator can be selected from an availability
domain in which no data nodes are present, or, if no
such availability domain can be found, from a third
availability domain.
</p>
</li>
</ul>
</div>
<p>
<code class="literal">
LocationDomainId
</code>
takes an integer value
between 0 and 16 inclusive, with 0 being the default; using
0 is the same as leaving the parameter unset.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-noofreplicas">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-noofreplicas">
<code class="literal">
NoOfReplicas
</code>
</a>
</p>
<a class="indexterm" name="idm46045119790944">
</a>
<div class="informaltable">
<a name="noofreplicas-ndbd-table">
</a>
<table frame="box" rules="all" summary="NoOfReplicas data node 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>
integer
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
2
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
1 - 4
</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 global parameter can be set only in the
<code class="literal">
[ndbd
default]
</code>
section, and defines the number of
fragment replicas for each table stored in the cluster. This
parameter also specifies the size of node groups. A node
group is a set of nodes all storing the same information.
</p>
<p>
Node groups are formed implicitly. The first node group is
formed by the set of data nodes with the lowest node IDs,
the next node group by the set of the next lowest node
identities, and so on. By way of example, assume that we
have 4 data nodes and that
<code class="literal">
NoOfReplicas
</code>
is set to 2. The four data nodes have node IDs 2, 3, 4 and
5. Then the first node group is formed from nodes 2 and 3,
and the second node group by nodes 4 and 5. It is important
to configure the cluster in such a manner that nodes in the
same node groups are not placed on the same computer because
a single hardware failure would cause the entire cluster to
fail.
</p>
<p>
If no node IDs are provided, the order of the data nodes is
the determining factor for the node group. Whether or not
explicit assignments are made, they can be viewed in the
output of the management client's
<a class="link" href="mysql-cluster-mgm-client-commands.html#ndbclient-show">
<code class="literal">
SHOW
</code>
</a>
command.
</p>
<p>
The default value for
<code class="literal">
NoOfReplicas
</code>
is 2.
This is the recommended value for most production
environments. Setting this parameter's value to 3 or 4
is also supported.
</p>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Warning
</div>
<p>
Setting
<code class="literal">
NoOfReplicas
</code>
to 1 means that
there is only a single copy of all Cluster data; in this
case, the loss of a single data node causes the cluster to
fail because there are no additional copies of the data
stored by that node.
</p>
</div>
<p>
The number of data nodes in the cluster must be evenly
divisible by the value of this parameter. For example, if
there are two data nodes, then
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-noofreplicas">
<code class="literal">
NoOfReplicas
</code>
</a>
must be
equal to either 1 or 2, since 2/3 and 2/4 both yield
fractional values; if there are four data nodes, then
<code class="literal">
NoOfReplicas
</code>
must be equal to 1, 2, or 4.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-datadir">
</a>
<code class="literal">
DataDir
</code>
</p>
<a class="indexterm" name="idm46045119760400">
</a>
<div class="informaltable">
<a name="datadir-ndbd-table">
</a>
<table frame="box" rules="all" summary="DataDir data node 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>
path
</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 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; each data node must
be restarted with
<a class="link" href="mysql-cluster-programs-ndbd.html#option_ndbd_initial">
<code class="option">
--initial
</code>
</a>
. (NDB 8.4.0)
</p>
</td>
</tr>
</tbody>
</table>
</div>
<p>
This parameter specifies the directory where trace files,
log files, pid files and error logs are placed.
</p>
<p>
The default is the data node process working directory.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-filesystempath">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-filesystempath">
<code class="literal">
FileSystemPath
</code>
</a>
</p>
<a class="indexterm" name="idm46045119738464">
</a>
<div class="informaltable">
<a name="filesystempath-ndbd-table">
</a>
<table frame="box" rules="all" summary="FileSystemPath data node 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>
path
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
DataDir
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
...
</td>
</tr>
<tr>
<th>
Restart Type
</th>
<td>
<p>
<span class="bold">
<strong>
Initial 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; each data node must
be restarted with
<a class="link" href="mysql-cluster-programs-ndbd.html#option_ndbd_initial">
<code class="option">
--initial
</code>
</a>
. (NDB 8.4.0)
</p>
</td>
</tr>
</tbody>
</table>
</div>
<p>
This parameter specifies the directory where all files
created for metadata, REDO logs, UNDO logs (for Disk Data
tables), and data files are placed. The default is the
directory specified by
<code class="literal">
DataDir
</code>
.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
This directory must exist before the
<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
</strong>
</span>
</a>
process is initiated.
</p>
</div>
<p>
The recommended directory hierarchy for NDB Cluster includes
<code class="filename">
/var/lib/mysql-cluster
</code>
, under which a
directory for the node's file system is created. The name of
this subdirectory contains the node ID. For example, if the
node ID is 2, this subdirectory is named
<code class="filename">
ndb_2_fs
</code>
.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-backupdatadir">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-backupdatadir">
<code class="literal">
BackupDataDir
</code>
</a>
</p>
<a class="indexterm" name="idm46045119711920">
</a>
<div class="informaltable">
<a name="backupdatadir-ndbd-table">
</a>
<table frame="box" rules="all" summary="BackupDataDir data node 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>
path
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
FileSystemPath
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
...
</td>
</tr>
<tr>
<th>
Restart Type
</th>
<td>
<p>
<span class="bold">
<strong>
Initial 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; each data node must
be restarted with
<a class="link" href="mysql-cluster-programs-ndbd.html#option_ndbd_initial">
<code class="option">
--initial
</code>
</a>
. (NDB 8.4.0)
</p>
</td>
</tr>
</tbody>
</table>
</div>
<p>
This parameter specifies the directory in which backups are
placed.
</p>
<div class="important" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Important
</div>
<p>
The string '
<code class="literal">
/BACKUP
</code>
' is always appended
to this value. For example, if you set the value of
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-backupdatadir">
<code class="literal">
BackupDataDir
</code>
</a>
to
<code class="filename">
/var/lib/cluster-data
</code>
, then all
backups are stored under
<code class="filename">
/var/lib/cluster-data/BACKUP
</code>
. This
also means that the
<span class="emphasis">
<em>
effective
</em>
</span>
default
backup location is the directory named
<code class="filename">
BACKUP
</code>
under the location specified
by the
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-filesystempath">
<code class="literal">
FileSystemPath
</code>
</a>
parameter.
</p>
</div>
</li>
</ul>
</div>
<h5>
<a name="mysql-cluster-data-memory-index-memory-string-memory">
</a>
Data Memory, Index Memory, and String Memory
</h5>
<p>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-datamemory">
<code class="literal">
DataMemory
</code>
</a>
and
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-indexmemory">
<code class="literal">
IndexMemory
</code>
</a>
are
<code class="literal">
[ndbd]
</code>
parameters specifying the size of
memory segments used to store the actual records and their
indexes. In setting values for these, it is important to
understand how
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-datamemory">
<code class="literal">
DataMemory
</code>
</a>
is used, as
it usually needs to be updated to reflect actual usage by the
cluster.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
<code class="literal">
IndexMemory
</code>
is deprecated, and subject to
removal in a future version of NDB Cluster. See the
descriptions that follow for further information.
</p>
</div>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a name="ndbparam-ndbd-datamemory">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-datamemory">
<code class="literal">
DataMemory
</code>
</a>
</p>
<a class="indexterm" name="idm46045119675104">
</a>
<div class="informaltable">
<a name="datamemory-ndbd-table">
</a>
<table frame="box" rules="all" summary="DataMemory data node 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>
bytes
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
98M
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
1M - 16T
</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 parameter defines the amount of space (in bytes)
available for storing database records. The entire amount
specified by this value is allocated in memory, so it is
extremely important that the machine has sufficient physical
memory to accommodate it.
</p>
<p>
The memory allocated by
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-datamemory">
<code class="literal">
DataMemory
</code>
</a>
is used
to store both the actual records and indexes. There is a
16-byte overhead on each record; an additional amount for
each record is incurred because it is stored in a 32KB page
with 128 byte page overhead (see below). There is also a
small amount wasted per page due to the fact that each
record is stored in only one page.
</p>
<p>
For variable-size table attributes, the data is stored on
separate data pages, allocated from
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-datamemory">
<code class="literal">
DataMemory
</code>
</a>
.
Variable-length records use a fixed-size part with an extra
overhead of 4 bytes to reference the variable-size part. The
variable-size part has 2 bytes overhead plus 2 bytes per
attribute.
</p>
<p>
The maximum record size is 30000 bytes.
</p>
<p>
Resources assigned to
<code class="literal">
DataMemory
</code>
are used
for storing all data and indexes. (Any memory configured as
<code class="literal">
IndexMemory
</code>
is automatically added to
that used by
<code class="literal">
DataMemory
</code>
to form a common
resource pool.)
</p>
<p>
The memory space allocated by
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-datamemory">
<code class="literal">
DataMemory
</code>
</a>
consists
of 32KB pages, which are allocated to table fragments. Each
table is normally partitioned into the same number of
fragments as there are data nodes in the cluster. Thus, for
each node, there are the same number of fragments as are set
in
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-noofreplicas">
<code class="literal">
NoOfReplicas
</code>
</a>
.
</p>
<p>
Once a page has been allocated, it is currently not possible
to return it to the pool of free pages, except by deleting
the table. (This also means that
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-datamemory">
<code class="literal">
DataMemory
</code>
</a>
pages,
once allocated to a given table, cannot be used by other
tables.) Performing a data node recovery also compresses the
partition because all records are inserted into empty
partitions from other live nodes.
</p>
<a class="indexterm" name="idm46045119643344">
</a>
<p>
The
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-datamemory">
<code class="literal">
DataMemory
</code>
</a>
memory space also contains UNDO information: For each
update, a copy of the unaltered record is allocated in the
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-datamemory">
<code class="literal">
DataMemory
</code>
</a>
. There is
also a reference to each copy in the ordered table indexes.
Unique hash indexes are updated only when the unique index
columns are updated, in which case a new entry in the index
table is inserted and the old entry is deleted upon commit.
For this reason, it is also necessary to allocate enough
memory to handle the largest transactions performed by
applications using the cluster. In any case, performing a
few large transactions holds no advantage over using many
smaller ones, for the following reasons:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
Large transactions are not any faster than smaller ones
</p>
</li>
<li class="listitem">
<p>
Large transactions increase the number of operations
that are lost and must be repeated in event of
transaction failure
</p>
</li>
<li class="listitem">
<p>
Large transactions use more memory
</p>
</li>
</ul>
</div>
<p>
The default value for
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-datamemory">
<code class="literal">
DataMemory
</code>
</a>
is 98MB.
The minimum value is 1MB. There is no maximum size, but in
reality the maximum size has to be adapted so that the
process does not start swapping when the limit is reached.
This limit is determined by the amount of physical RAM
available on the machine and by the amount of memory that
the operating system may commit to any one process. 32-bit
operating systems are generally limited to 2−4GB per
process; 64-bit operating systems can use more. For large
databases, it may be preferable to use a 64-bit operating
system for this reason.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-indexmemory">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-indexmemory">
<code class="literal">
IndexMemory
</code>
</a>
</p>
<a class="indexterm" name="idm46045119629008">
</a>
<div class="informaltable">
<a name="indexmemory-ndbd-table">
</a>
<table frame="box" rules="all" summary="IndexMemory data node 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>
bytes
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
0
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
1M - 1T
</td>
</tr>
<tr>
<th>
Deprecated
</th>
<td>
Yes (in NDB 7.6)
</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>
The
<code class="literal">
IndexMemory
</code>
parameter is deprecated
(and subject to future removal); any memory assigned to
<code class="literal">
IndexMemory
</code>
is allocated instead to the
same pool as
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-datamemory">
<code class="literal">
DataMemory
</code>
</a>
, which is
solely responsible for all resources needed for storing data
and indexes in memory. In NDB 8.4, the use of
<code class="literal">
IndexMemory
</code>
in the cluster configuration
file triggers a warning from the management server.
</p>
<p>
You can estimate the size of a hash index using this
formula:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-simple"><div class="docs-select-all right" id="sa22135700"><div class="copy-help left">Press ⌘+C to 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"> size <span class="token operator">=</span> <span class="token punctuation">(</span> <span class="token punctuation">(</span><em class="replaceable">fragments</em> <span class="token operator">*</span> 32K<span class="token punctuation">)</span> <span class="token operator">+</span> <span class="token punctuation">(</span><em class="replaceable">rows</em> <span class="token operator">*</span> 18<span class="token punctuation">)</span> <span class="token punctuation">)</span>
<span class="token operator">*</span> <em class="replaceable">fragment_replicas</em></code></pre>
</div>
<p>
<em class="replaceable">
<code>
fragments
</code>
</em>
is the number of
fragments,
<em class="replaceable">
<code>
fragment_replicas
</code>
</em>
is
the number of fragment replicas (normally 2), and
<em class="replaceable">
<code>
rows
</code>
</em>
is the number of rows. If a
table has one million rows, eight fragments, and two
fragment replicas, the expected index memory usage is
calculated as shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-simple"><div class="docs-select-all right" id="sa80186024"><div class="copy-help left">Press ⌘+C to 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"> <span class="token punctuation">(</span><span class="token punctuation">(</span>8 <span class="token operator">*</span> 32K<span class="token punctuation">)</span> <span class="token operator">+</span> <span class="token punctuation">(</span>1000000 <span class="token operator">*</span> 18<span class="token punctuation">)</span><span class="token punctuation">)</span> <span class="token operator">*</span> 2 <span class="token operator">=</span> <span class="token punctuation">(</span><span class="token punctuation">(</span>8 <span class="token operator">*</span> 32768<span class="token punctuation">)</span> <span class="token operator">+</span> <span class="token punctuation">(</span>1000000 <span class="token operator">*</span> 18<span class="token punctuation">)</span><span class="token punctuation">)</span> <span class="token operator">*</span> 2
<span class="token operator">=</span> <span class="token punctuation">(</span>262144 <span class="token operator">+</span> 18000000<span class="token punctuation">)</span> <span class="token operator">*</span> 2
<span class="token operator">=</span> 18262144 <span class="token operator">*</span> 2 <span class="token operator">=</span> 36524288 bytes <span class="token operator">=</span> <span class="token operator">~</span>35MB</code></pre>
</div>
<p>
Index statistics for ordered indexes (when these are
enabled) are stored in the
<code class="literal">
mysql.ndb_index_stat_sample
</code>
table. Since
this table has a hash index, this adds to index memory
usage. An upper bound to the number of rows for a given
ordered index can be calculated as follows:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-simple"><div class="docs-select-all right" id="sa28190205"><div class="copy-help left">Press ⌘+C to 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"> sample_size<span class="token operator">=</span> key_size <span class="token operator">+</span> <span class="token punctuation">(</span><span class="token punctuation">(</span>key_attributes <span class="token operator">+</span> 1<span class="token punctuation">)</span> <span class="token operator">*</span> 4<span class="token punctuation">)</span>
sample_rows <span class="token operator">=</span> IndexStatSaveSize
<span class="token operator">*</span> <span class="token punctuation">(</span><span class="token punctuation">(</span>0<span class="token punctuation">.</span>01 <span class="token operator">*</span> IndexStatSaveScale <span class="token operator">*</span> log2<span class="token punctuation">(</span>rows <span class="token operator">*</span> sample_size<span class="token punctuation">)</span><span class="token punctuation">)</span> <span class="token operator">+</span> 1<span class="token punctuation">)</span>
<span class="token operator">/</span> sample_size</code></pre>
</div>
<p>
In the preceding formula,
<em class="replaceable">
<code>
key_size
</code>
</em>
is the size of the
ordered index key in bytes,
<em class="replaceable">
<code>
key_attributes
</code>
</em>
is the number of
attributes in the ordered index key, and
<em class="replaceable">
<code>
rows
</code>
</em>
is the number of rows in the
base table.
</p>
<p>
Assume that table
<code class="literal">
t1
</code>
has 1 million rows
and an ordered index named
<code class="literal">
ix1
</code>
on two
four-byte integers. Assume in addition that
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-indexstatsavesize">
<code class="literal">
IndexStatSaveSize
</code>
</a>
and
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-indexstatsavescale">
<code class="literal">
IndexStatSaveScale
</code>
</a>
are set to their default values (32K and 100, respectively).
Using the previous 2 formulas, we can calculate as follows:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-simple"><div class="docs-select-all right" id="sa16453919"><div class="copy-help left">Press ⌘+C to 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"> sample_size <span class="token operator">=</span> 8 <span class="token operator">+</span> <span class="token punctuation">(</span><span class="token punctuation">(</span>1 <span class="token operator">+</span> 2<span class="token punctuation">)</span> <span class="token operator">*</span> 4<span class="token punctuation">)</span> <span class="token operator">=</span> 20 bytes
sample_rows <span class="token operator">=</span> 32K
<span class="token operator">*</span> <span class="token punctuation">(</span><span class="token punctuation">(</span>0<span class="token punctuation">.</span>01 <span class="token operator">*</span> 100 <span class="token operator">*</span> log2<span class="token punctuation">(</span>1000000<span class="token operator">*</span>20<span class="token punctuation">)</span><span class="token punctuation">)</span> <span class="token operator">+</span> 1<span class="token punctuation">)</span>
<span class="token operator">/</span> 20
<span class="token operator">=</span> 32768 <span class="token operator">*</span> <span class="token punctuation">(</span> <span class="token punctuation">(</span>1 <span class="token operator">*</span> <span class="token operator">~</span>16<span class="token punctuation">.</span>811<span class="token punctuation">)</span> <span class="token operator">+</span>1<span class="token punctuation">)</span> <span class="token operator">/</span> 20
<span class="token operator">=</span> 32768 <span class="token operator">*</span> <span class="token operator">~</span>17<span class="token punctuation">.</span>811 <span class="token operator">/</span> 20
<span class="token operator">=</span> <span class="token operator">~</span>29182 rows</code></pre>
</div>
<p>
The expected index memory usage is thus 2 * 18 * 29182 =
~1050550 bytes.
</p>
<p>
The minimum and default value for this parameter is 0
(zero).
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-stringmemory">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-stringmemory">
<code class="literal">
StringMemory
</code>
</a>
</p>
<a class="indexterm" name="idm46045119581248">
</a>
<div class="informaltable">
<a name="stringmemory-ndbd-table">
</a>
<table frame="box" rules="all" summary="StringMemory data node 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>
% or bytes
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
25
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
0 - 4294967039 (0xFFFFFEFF)
</td>
</tr>
<tr>
<th>
Restart Type
</th>
<td>
<p>
<span class="bold">
<strong>
System Restart:
</strong>
</span>
Requires a complete shutdown and restart
of the cluster. (NDB 8.4.0)
</p>
</td>
</tr>
</tbody>
</table>
</div>
<p>
This parameter determines how much memory is allocated for
strings such as table names, and is specified in an
<code class="literal">
[ndbd]
</code>
or
<code class="literal">
[ndbd
default]
</code>
section of the
<code class="filename">
config.ini
</code>
file. A value between
<code class="literal">
0
</code>
and
<code class="literal">
100
</code>
inclusive is
interpreted as a percent of the maximum default value, which
is calculated based on a number of factors including the
number of tables, maximum table name size, maximum size of
<code class="filename">
.FRM
</code>
files,
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxnooftriggers">
<code class="literal">
MaxNoOfTriggers
</code>
</a>
,
maximum column name size, and maximum default column value.
</p>
<p>
A value greater than
<code class="literal">
100
</code>
is interpreted
as a number of bytes.
</p>
<p>
The default value is 25—that is, 25 percent of the
default maximum.
</p>
<p>
Under most circumstances, the default value should be
sufficient, but when you have a great many
<code class="literal">
NDB
</code>
tables (1000 or more), it is possible
to get Error 773
<span class="errortext">
Out of string memory, please
modify StringMemory config parameter: Permanent error:
Schema error
</span>
, in which case you should increase
this value.
<code class="literal">
25
</code>
(25 percent) is not
excessive, and should prevent this error from recurring in
all but the most extreme conditions.
</p>
</li>
</ul>
</div>
<p>
The following example illustrates how memory is used for a
table. Consider this table definition:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa446718"><div class="copy-help left">Press ⌘+C to 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> example <span class="token punctuation">(</span>
a <span class="token datatype">INT</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span><span class="token punctuation">,</span>
b <span class="token datatype">INT</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span><span class="token punctuation">,</span>
c <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">PRIMARY</span> <span class="token keyword">KEY</span><span class="token punctuation">(</span>a<span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">UNIQUE</span><span class="token punctuation">(</span>b<span class="token punctuation">)</span>
<span class="token punctuation">)</span> <span class="token keyword">ENGINE</span><span class="token operator">=</span><span class="token keyword">NDBCLUSTER</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
For each record, there are 12 bytes of data plus 12 bytes
overhead. Having no nullable columns saves 4 bytes of overhead.
In addition, we have two ordered indexes on columns
<code class="literal">
a
</code>
and
<code class="literal">
b
</code>
consuming roughly
10 bytes each per record. There is a primary key hash index on
the base table using roughly 29 bytes per record. The unique
constraint is implemented by a separate table with
<code class="literal">
b
</code>
as primary key and
<code class="literal">
a
</code>
as
a column. This other table consumes an additional 29 bytes of
index memory per record in the
<code class="literal">
example
</code>
table
as well 8 bytes of record data plus 12 bytes of overhead.
</p>
<p>
Thus, for one million records, we need 58MB for index memory to
handle the hash indexes for the primary key and the unique
constraint. We also need 64MB for the records of the base table
and the unique index table, plus the two ordered index tables.
</p>
<p>
You can see that hash indexes takes up a fair amount of memory
space; however, they provide very fast access to the data in
return. They are also used in NDB Cluster to handle uniqueness
constraints.
</p>
<p>
Currently, the only partitioning algorithm is hashing and
ordered indexes are local to each node. Thus, ordered indexes
cannot be used to handle uniqueness constraints in the general
case.
</p>
<p>
An important point for both
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-indexmemory">
<code class="literal">
IndexMemory
</code>
</a>
and
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-datamemory">
<code class="literal">
DataMemory
</code>
</a>
is that the
total database size is the sum of all data memory and all index
memory for each node group. Each node group is used to store
replicated information, so if there are four nodes with two
fragment replicas, there are two node groups. Thus, the total
data memory available is 2 ×
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-datamemory">
<code class="literal">
DataMemory
</code>
</a>
for each data
node.
</p>
<p>
It is highly recommended that
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-datamemory">
<code class="literal">
DataMemory
</code>
</a>
and
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-indexmemory">
<code class="literal">
IndexMemory
</code>
</a>
be set to
the same values for all nodes. Data distribution is even over
all nodes in the cluster, so the maximum amount of space
available for any node can be no greater than that of the
smallest node in the cluster.
</p>
<p>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-datamemory">
<code class="literal">
DataMemory
</code>
</a>
can be
changed, but decreasing it can be risky; doing so can easily
lead to a node or even an entire NDB Cluster that is unable to
restart due to there being insufficient memory space. Increasing
these values should be acceptable, but it is recommended that
such upgrades are performed in the same manner as a software
upgrade, beginning with an update of the configuration file, and
then restarting the management server followed by restarting
each data node in turn.
</p>
<p>
<a name="ndbparam-ndbd-minfreepct">
</a>
<b>
MinFreePct.
</b>
<a class="indexterm" name="idm46045119533824">
</a>
A proportion (5% by default) of data node resources including
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-datamemory">
<code class="literal">
DataMemory
</code>
</a>
is kept in
reserve to insure that the data node does not exhaust its
memory when performing a restart. This can be adjusted using
the
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-minfreepct" title="MinFreePct">
<code class="literal">
MinFreePct
</code>
</a>
data
node configuration parameter (default 5).
</p>
<div class="informaltable">
<a name="minfreepct-ndbd-table">
</a>
<table frame="box" rules="all" summary="MinFreePct data node 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>
unsigned
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
5
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
0 - 100
</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>
Updates do not increase the amount of index memory used. Inserts
take effect immediately; however, rows are not actually deleted
until the transaction is committed.
</p>
<p>
<a name="mysql-cluster-transaction-parameters">
</a>
<b>
Transaction parameters.
</b>
The next few
<code class="literal">
[ndbd]
</code>
parameters that we
discuss are important because they affect the number of
parallel transactions and the sizes of transactions that can
be handled by the system.
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxnoofconcurrenttransactions">
<code class="literal">
MaxNoOfConcurrentTransactions
</code>
</a>
sets the number of parallel transactions possible in a node.
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxnoofconcurrentoperations">
<code class="literal">
MaxNoOfConcurrentOperations
</code>
</a>
sets the number of records that can be in update phase or
locked simultaneously.
</p>
<p>
Both of these parameters (especially
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxnoofconcurrentoperations">
<code class="literal">
MaxNoOfConcurrentOperations
</code>
</a>
)
are likely targets for users setting specific values and not
using the default value. The default value is set for systems
using small transactions, to ensure that these do not use
excessive memory.
</p>
<p>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxdmloperationspertransaction">
<code class="literal">
MaxDMLOperationsPerTransaction
</code>
</a>
sets the maximum number of DML operations that can be performed
in a given transaction.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a name="ndbparam-ndbd-maxnoofconcurrenttransactions">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxnoofconcurrenttransactions">
<code class="literal">
MaxNoOfConcurrentTransactions
</code>
</a>
</p>
<a class="indexterm" name="idm46045119500832">
</a>
<div class="informaltable">
<a name="maxnoofconcurrenttransactions-ndbd-table">
</a>
<table frame="box" rules="all" summary="MaxNoOfConcurrentTransactions data node 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>
integer
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
4096
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
32 - 4294967039 (0xFFFFFEFF)
</td>
</tr>
<tr>
<th>
Deprecated
</th>
<td>
Yes (in NDB 8.0)
</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>
Each cluster data node requires a transaction record for
each active transaction in the cluster. The task of
coordinating transactions is distributed among all of the
data nodes. The total number of transaction records in the
cluster is the number of transactions in any given node
times the number of nodes in the cluster.
</p>
<p>
Transaction records are allocated to individual MySQL
servers. Each connection to a MySQL server requires at least
one transaction record, plus an additional transaction
object per table accessed by that connection. This means
that a reasonable minimum for the total number of
transactions in the cluster can be expressed as
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-simple"><div class="docs-select-all right" id="sa23215414"><div class="copy-help left">Press ⌘+C to 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">TotalNoOfConcurrentTransactions <span class="token operator">=</span>
<span class="token punctuation">(</span>maximum number of tables accessed in any single transaction <span class="token operator">+</span> 1<span class="token punctuation">)</span>
<span class="token operator">*</span> number of SQL nodes</code></pre>
</div>
<p>
Suppose that there are 10 SQL nodes using the cluster. A
single join involving 10 tables requires 11 transaction
records; if there are 10 such joins in a transaction, then
10 * 11 = 110 transaction records are required for this
transaction, per MySQL server, or 110 * 10 = 1100
transaction records total. Each data node can be expected to
handle TotalNoOfConcurrentTransactions / number of data
nodes. For an NDB Cluster having 4 data nodes, this would
mean setting
<code class="literal">
MaxNoOfConcurrentTransactions
</code>
on each
data node to 1100 / 4 = 275. In addition, you should provide
for failure recovery by ensuring that a single node group
can accommodate all concurrent transactions; in other words,
that each data node's MaxNoOfConcurrentTransactions is
sufficient to cover a number of transactions equal to
TotalNoOfConcurrentTransactions / number of node groups. If
this cluster has a single node group, then
<code class="literal">
MaxNoOfConcurrentTransactions
</code>
should be
set to 1100 (the same as the total number of concurrent
transactions for the entire cluster).
</p>
<p>
In addition, each transaction involves at least one
operation; for this reason, the value set for
<code class="literal">
MaxNoOfConcurrentTransactions
</code>
should
always be no more than the value of
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxnoofconcurrentoperations">
<code class="literal">
MaxNoOfConcurrentOperations
</code>
</a>
.
</p>
<p>
This parameter must be set to the same value for all cluster
data nodes. This is due to the fact that, when a data node
fails, the oldest surviving node re-creates the transaction
state of all transactions that were ongoing in the failed
node.
</p>
<p>
It is possible to change this value using a rolling restart,
but the amount of traffic on the cluster must be such that
no more transactions occur than the lower of the old and new
levels while this is taking place.
</p>
<p>
The default value is 4096.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-maxnoofconcurrentoperations">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxnoofconcurrentoperations">
<code class="literal">
MaxNoOfConcurrentOperations
</code>
</a>
</p>
<a class="indexterm" name="idm46045119468240">
</a>
<div class="informaltable">
<a name="maxnoofconcurrentoperations-ndbd-table">
</a>
<table frame="box" rules="all" summary="MaxNoOfConcurrentOperations data node 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>
integer
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
32K
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
32 - 4294967039 (0xFFFFFEFF)
</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>
It is a good idea to adjust the value of this parameter
according to the size and number of transactions. When
performing transactions which involve only a few operations
and records, the default value for this parameter is usually
sufficient. Performing large transactions involving many
records usually requires that you increase its value.
</p>
<p>
Records are kept for each transaction updating cluster data,
both in the transaction coordinator and in the nodes where
the actual updates are performed. These records contain
state information needed to find UNDO records for rollback,
lock queues, and other purposes.
</p>
<p>
This parameter should be set at a minimum to the number of
records to be updated simultaneously in transactions,
divided by the number of cluster data nodes. For example, in
a cluster which has four data nodes and which is expected to
handle one million concurrent updates using transactions,
you should set this value to 1000000 / 4 = 250000. To help
provide resiliency against failures, it is suggested that
you set this parameter to a value that is high enough to
permit an individual data node to handle the load for its
node group. In other words, you should set the value equal
to
<code class="literal">
total number of concurrent operations / number
of node groups
</code>
. (In the case where there is a
single node group, this is the same as the total number of
concurrent operations for the entire cluster.)
</p>
<p>
Because each transaction always involves at least one
operation, the value of
<code class="literal">
MaxNoOfConcurrentOperations
</code>
should always
be greater than or equal to the value of
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxnoofconcurrenttransactions">
<code class="literal">
MaxNoOfConcurrentTransactions
</code>
</a>
.
</p>
<p>
Read queries which set locks also cause operation records to
be created. Some extra space is allocated within individual
nodes to accommodate cases where the distribution is not
perfect over the nodes.
</p>
<p>
When queries make use of the unique hash index, there are
actually two operation records used per record in the
transaction. The first record represents the read in the
index table and the second handles the operation on the base
table.
</p>
<p>
The default value is 32768.
</p>
<p>
This parameter actually handles two values that can be
configured separately. The first of these specifies how many
operation records are to be placed with the transaction
coordinator. The second part specifies how many operation
records are to be local to the database.
</p>
<p>
A very large transaction performed on an eight-node cluster
requires as many operation records in the transaction
coordinator as there are reads, updates, and deletes
involved in the transaction. However, the operation records
of the are spread over all eight nodes. Thus, if it is
necessary to configure the system for one very large
transaction, it is a good idea to configure the two parts
separately.
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxnoofconcurrentoperations">
<code class="literal">
MaxNoOfConcurrentOperations
</code>
</a>
is always used to calculate the number of operation records
in the transaction coordinator portion of the node.
</p>
<p>
It is also important to have an idea of the memory
requirements for operation records. These consume about 1KB
per record.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-maxnooflocaloperations">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxnooflocaloperations">
<code class="literal">
MaxNoOfLocalOperations
</code>
</a>
</p>
<a class="indexterm" name="idm46045119436592">
</a>
<div class="informaltable">
<a name="maxnooflocaloperations-ndbd-table">
</a>
<table frame="box" rules="all" summary="MaxNoOfLocalOperations data node 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>
integer
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
UNDEFINED
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
32 - 4294967039 (0xFFFFFEFF)
</td>
</tr>
<tr>
<th>
Deprecated
</th>
<td>
Yes (in NDB 8.0)
</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>
By default, this parameter is calculated as 1.1 ×
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxnoofconcurrentoperations">
<code class="literal">
MaxNoOfConcurrentOperations
</code>
</a>
.
This fits systems with many simultaneous transactions, none
of them being very large. If there is a need to handle one
very large transaction at a time and there are many nodes,
it is a good idea to override the default value by
explicitly specifying this parameter.
</p>
<p>
This parameter is deprecated and subject to removal in a
future NDB Cluster release. In addition, this parameter is
incompatible with the
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-transactionmemory">
<code class="literal">
TransactionMemory
</code>
</a>
parameter; if you try to set values for both parameters in
the cluster configuration file
(
<code class="filename">
config.ini
</code>
), the management server
refuses to start.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-maxdmloperationspertransaction">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxdmloperationspertransaction">
<code class="literal">
MaxDMLOperationsPerTransaction
</code>
</a>
</p>
<a class="indexterm" name="idm46045119409392">
</a>
<div class="informaltable">
<a name="maxdmloperationspertransaction-ndbd-table">
</a>
<table frame="box" rules="all" summary="MaxDMLOperationsPerTransaction data node 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>
operations (DML)
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
4294967295
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
32 - 4294967295
</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 parameter limits the size of a transaction. The
transaction is aborted if it requires more than this many
DML operations.
</p>
<p>
The value of this parameter cannot exceed that set for
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxnoofconcurrentoperations">
<code class="literal">
MaxNoOfConcurrentOperations
</code>
</a>
.
</p>
</li>
</ul>
</div>
<p>
<a name="mysql-cluster-transaction-temporary-storage">
</a>
<b>
Transaction temporary storage.
</b>
The next set of
<code class="literal">
[ndbd]
</code>
parameters is used
to determine temporary storage when executing a statement that
is part of a Cluster transaction. All records are released
when the statement is completed and the cluster is waiting for
the commit or rollback.
</p>
<p>
The default values for these parameters are adequate for most
situations. However, users with a need to support transactions
involving large numbers of rows or operations may need to
increase these values to enable better parallelism in the
system, whereas users whose applications require relatively
small transactions can decrease the values to save memory.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a name="ndbparam-ndbd-maxnoofconcurrentindexoperations">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxnoofconcurrentindexoperations">
<code class="literal">
MaxNoOfConcurrentIndexOperations
</code>
</a>
</p>
<a class="indexterm" name="idm46045119383056">
</a>
<div class="informaltable">
<a name="maxnoofconcurrentindexoperations-ndbd-table">
</a>
<table frame="box" rules="all" summary="MaxNoOfConcurrentIndexOperations data node 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>
integer
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
8K
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
0 - 4294967039 (0xFFFFFEFF)
</td>
</tr>
<tr>
<th>
Deprecated
</th>
<td>
Yes (in NDB 8.0)
</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>
For queries using a unique hash index, another temporary set
of operation records is used during a query's execution
phase. This parameter sets the size of that pool of records.
Thus, this record is allocated only while executing a part
of a query. As soon as this part has been executed, the
record is released. The state needed to handle aborts and
commits is handled by the normal operation records, where
the pool size is set by the parameter
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxnoofconcurrentoperations">
<code class="literal">
MaxNoOfConcurrentOperations
</code>
</a>
.
</p>
<p>
The default value of this parameter is 8192. Only in rare
cases of extremely high parallelism using unique hash
indexes should it be necessary to increase this value. Using
a smaller value is possible and can save memory if the DBA
is certain that a high degree of parallelism is not required
for the cluster.
</p>
<p>
This parameter is deprecated and subject to removal in a
future NDB Cluster release. In addition, this parameter is
incompatible with the
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-transactionmemory">
<code class="literal">
TransactionMemory
</code>
</a>
parameter; if you try to set values for both parameters in
the cluster configuration file
(
<code class="filename">
config.ini
</code>
), the management server
refuses to start.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-maxnooffiredtriggers">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxnooffiredtriggers">
<code class="literal">
MaxNoOfFiredTriggers
</code>
</a>
</p>
<a class="indexterm" name="idm46045119354736">
</a>
<div class="informaltable">
<a name="maxnooffiredtriggers-ndbd-table">
</a>
<table frame="box" rules="all" summary="MaxNoOfFiredTriggers data node 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>
integer
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
4000
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
0 - 4294967039 (0xFFFFFEFF)
</td>
</tr>
<tr>
<th>
Deprecated
</th>
<td>
Yes (in NDB 8.0)
</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>
The default value of
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxnooffiredtriggers">
<code class="literal">
MaxNoOfFiredTriggers
</code>
</a>
is 4000, which is sufficient for most situations. In some
cases it can even be decreased if the DBA feels certain the
need for parallelism in the cluster is not high.
</p>
<p>
A record is created when an operation is performed that
affects a unique hash index. Inserting or deleting a record
in a table with unique hash indexes or updating a column
that is part of a unique hash index fires an insert or a
delete in the index table. The resulting record is used to
represent this index table operation while waiting for the
original operation that fired it to complete. This operation
is short-lived but can still require a large number of
records in its pool for situations with many parallel write
operations on a base table containing a set of unique hash
indexes.
</p>
<p>
This parameter is deprecated and subject to removal in a
future NDB Cluster release. In addition, this parameter is
incompatible with the
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-transactionmemory">
<code class="literal">
TransactionMemory
</code>
</a>
parameter; if you try to set values for both parameters in
the cluster configuration file
(
<code class="filename">
config.ini
</code>
), the management server
refuses to start.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-transactionbuffermemory">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-transactionbuffermemory">
<code class="literal">
TransactionBufferMemory
</code>
</a>
</p>
<a class="indexterm" name="idm46045119326784">
</a>
<div class="informaltable">
<a name="transactionbuffermemory-ndbd-table">
</a>
<table frame="box" rules="all" summary="TransactionBufferMemory data node 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>
bytes
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
1M
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
1K - 4294967039 (0xFFFFFEFF)
</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>
The memory affected by this parameter is used for tracking
operations fired when updating index tables and reading
unique indexes. This memory is used to store the key and
column information for these operations. It is only very
rarely that the value for this parameter needs to be altered
from the default.
</p>
<p>
The default value for
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-transactionbuffermemory">
<code class="literal">
TransactionBufferMemory
</code>
</a>
is 1MB.
</p>
<p>
Normal read and write operations use a similar buffer, whose
usage is even more short-lived. The compile-time parameter
<code class="literal">
ZATTRBUF_FILESIZE
</code>
(found in
<code class="filename">
ndb/src/kernel/blocks/Dbtc/Dbtc.hpp
</code>
)
set to 4000 × 128 bytes (500KB). A similar buffer for
key information,
<code class="literal">
ZDATABUF_FILESIZE
</code>
(also
in
<code class="filename">
Dbtc.hpp
</code>
) contains 4000 × 16 =
62.5KB of buffer space.
<code class="literal">
Dbtc
</code>
is the
module that handles transaction coordination.
</p>
</li>
</ul>
</div>
<p>
<a name="mysql-cluster-transaction-resource-allocation">
</a>
<b>
Transaction resource allocation parameters.
</b>
The parameters in the following list are used to allocate
transaction resources in the transaction coordinator
(
<a class="ulink" href="/doc/ndb-internals/en/ndb-internals-kernel-blocks-dbtc.html" target="_top">
<code class="literal">
DBTC
</code>
</a>
). Leaving any one of
these set to the default (0) dedicates transaction memory for
25% of estimated total data node usage for the corresponding
resource. The actual maximum possible values for these
parameters are typically limited by the amount of memory
available to the data node; setting them has no impact on the
total amount of memory allocated to the data node. In
addition, you should keep in mind that they control numbers of
reserved internal records for the data node independent of any
settings for
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxdmloperationspertransaction">
<code class="literal">
MaxDMLOperationsPerTransaction
</code>
</a>
,
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxnoofconcurrentindexoperations">
<code class="literal">
MaxNoOfConcurrentIndexOperations
</code>
</a>
,
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxnoofconcurrentoperations">
<code class="literal">
MaxNoOfConcurrentOperations
</code>
</a>
,
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxnoofconcurrentscans">
<code class="literal">
MaxNoOfConcurrentScans
</code>
</a>
,
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxnoofconcurrenttransactions">
<code class="literal">
MaxNoOfConcurrentTransactions
</code>
</a>
,
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxnooffiredtriggers">
<code class="literal">
MaxNoOfFiredTriggers
</code>
</a>
,
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxnooflocalscans">
<code class="literal">
MaxNoOfLocalScans
</code>
</a>
, or
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-transactionbuffermemory">
<code class="literal">
TransactionBufferMemory
</code>
</a>
(see
<a class="xref" href="mysql-cluster-ndbd-definition.html#mysql-cluster-transaction-parameters" title="Transaction parameters">
Transaction parameters
</a>
and
<a class="xref" href="mysql-cluster-ndbd-definition.html#mysql-cluster-transaction-temporary-storage" title="Transaction temporary storage">
Transaction temporary storage
</a>
).
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a name="ndbparam-ndbd-reservedconcurrentindexoperations">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-reservedconcurrentindexoperations">
<code class="literal">
ReservedConcurrentIndexOperations
</code>
</a>
</p>
<a class="indexterm" name="idm46045119283648">
</a>
<div class="informaltable">
<a name="reservedconcurrentindexoperations-ndbd-table">
</a>
<table frame="box" rules="all" summary="ReservedConcurrentIndexOperations data node 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>
numeric
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
0
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
0 - 4294967039 (0xFFFFFEFF)
</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>
Number of simultaneous index operations having dedicated
resources on one data node.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-reservedconcurrentoperations">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-reservedconcurrentoperations">
<code class="literal">
ReservedConcurrentOperations
</code>
</a>
</p>
<a class="indexterm" name="idm46045119263008">
</a>
<div class="informaltable">
<a name="reservedconcurrentoperations-ndbd-table">
</a>
<table frame="box" rules="all" summary="ReservedConcurrentOperations data node 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>
numeric
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
0
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
0 - 4294967039 (0xFFFFFEFF)
</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>
Number of simultaneous operations having dedicated resources
in transaction coordinators on one data node.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-reservedconcurrentscans">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-reservedconcurrentscans">
<code class="literal">
ReservedConcurrentScans
</code>
</a>
</p>
<a class="indexterm" name="idm46045119242480">
</a>
<div class="informaltable">
<a name="reservedconcurrentscans-ndbd-table">
</a>
<table frame="box" rules="all" summary="ReservedConcurrentScans data node 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>
numeric
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
0
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
0 - 4294967039 (0xFFFFFEFF)
</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>
Number of simultaneous scans having dedicated resources on
one data node.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-reservedconcurrenttransactions">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-reservedconcurrenttransactions">
<code class="literal">
ReservedConcurrentTransactions
</code>
</a>
</p>
<a class="indexterm" name="idm46045119221952">
</a>
<div class="informaltable">
<a name="reservedconcurrenttransactions-ndbd-table">
</a>
<table frame="box" rules="all" summary="ReservedConcurrentTransactions data node 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>
numeric
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
0
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
0 - 4294967039 (0xFFFFFEFF)
</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>
Number of simultaneous transactions having dedicated
resources on one data node.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-reservedfiredtriggers">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-reservedfiredtriggers">
<code class="literal">
ReservedFiredTriggers
</code>
</a>
</p>
<a class="indexterm" name="idm46045119201488">
</a>
<div class="informaltable">
<a name="reservedfiredtriggers-ndbd-table">
</a>
<table frame="box" rules="all" summary="ReservedFiredTriggers data node 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>
numeric
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
0
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
0 - 4294967039 (0xFFFFFEFF)
</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>
Number of triggers that have dedicated resources on one
ndbd(DB) node.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-reservedlocalscans">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-reservedlocalscans">
<code class="literal">
ReservedLocalScans
</code>
</a>
</p>
<a class="indexterm" name="idm46045119180944">
</a>
<div class="informaltable">
<a name="reservedlocalscans-ndbd-table">
</a>
<table frame="box" rules="all" summary="ReservedLocalScans data node 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>
numeric
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
0
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
0 - 4294967039 (0xFFFFFEFF)
</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>
Number of simultaneous fragment scans having dedicated
resources on one data node.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-reservedtransactionbuffermemory">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-reservedtransactionbuffermemory">
<code class="literal">
ReservedTransactionBufferMemory
</code>
</a>
</p>
<a class="indexterm" name="idm46045119160432">
</a>
<div class="informaltable">
<a name="reservedtransactionbuffermemory-ndbd-table">
</a>
<table frame="box" rules="all" summary="ReservedTransactionBufferMemory data node 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>
numeric
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
0
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
0 - 4294967039 (0xFFFFFEFF)
</td>
</tr>
<tr>
<th>
Deprecated
</th>
<td>
Yes (in NDB 8.0)
</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>
Dynamic buffer space (in bytes) for key and attribute data
allocated to each data node.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-transactionmemory">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-transactionmemory">
<code class="literal">
TransactionMemory
</code>
</a>
</p>
<a class="indexterm" name="idm46045119137712">
</a>
<div class="informaltable">
<a name="transactionmemory-ndbd-table">
</a>
<table frame="box" rules="all" summary="TransactionMemory data node 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>
bytes
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
0
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
0 - 16384G
</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>
<div class="important" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Important
</div>
<p>
A number of configuration parameters are incompatible with
<code class="literal">
TransactionMemory
</code>
; it is not possible
to set any of these parameters concurrently with
<code class="literal">
TransactionMemory
</code>
, and if you attempt
to do so, the management server is unable to start (see
<a class="xref" href="mysql-cluster-ndbd-definition.html#mysql-cluster-transactionmemory-incompatible" title="Parameters incompatible with TransactionMemory">
Parameters incompatible with TransactionMemory
</a>
).
</p>
</div>
<p>
This parameter determines the memory (in bytes) allocated
for transactions on each data node. Setting of transaction
memory is handled as follows:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
If
<code class="literal">
TransactionMemory
</code>
is set, this
value is used for determining transaction memory.
</p>
</li>
<li class="listitem">
<p>
Otherwise, transaction memory is calculated as it was
previous to NDB 8.0.
</p>
</li>
</ul>
</div>
<p>
<a name="mysql-cluster-transactionmemory-incompatible">
</a>
<b>
Parameters incompatible with TransactionMemory.
</b>
The following parameters cannot be used concurrently with
<code class="literal">
TransactionMemory
</code>
and are therefore
deprecated:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxnoofconcurrentindexoperations">
<code class="literal">
MaxNoOfConcurrentIndexOperations
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxnooffiredtriggers">
<code class="literal">
MaxNoOfFiredTriggers
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxnooflocaloperations">
<code class="literal">
MaxNoOfLocalOperations
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxnooflocalscans">
<code class="literal">
MaxNoOfLocalScans
</code>
</a>
</p>
</li>
</ul>
</div>
<p>
Explicitly setting any of the parameters just listed when
<code class="literal">
TransactionMemory
</code>
has also been set in
the cluster configuration file
(
<code class="filename">
config.ini
</code>
) keeps the management node
from starting.
</p>
<p>
For more information regarding resource allocation in NDB
Cluster data nodes, see
<a class="xref" href="mysql-cluster-data-node-memory-management.html" title="25.4.3.13 Data Node Memory Management">
Section 25.4.3.13, “Data Node Memory Management”
</a>
.
</p>
</li>
</ul>
</div>
<p>
<a name="mysql-cluster-scans-and-buffering">
</a>
<b>
Scans and buffering.
</b>
There are additional
<code class="literal">
[ndbd]
</code>
parameters in
the
<code class="literal">
Dblqh
</code>
module (in
<code class="filename">
ndb/src/kernel/blocks/Dblqh/Dblqh.hpp
</code>
)
that affect reads and updates. These include
<code class="literal">
ZATTRINBUF_FILESIZE
</code>
, set by default to
10000 × 128 bytes (1250KB) and
<code class="literal">
ZDATABUF_FILE_SIZE
</code>
, set by default to
10000*16 bytes (roughly 156KB) of buffer space. To date, there
have been neither any reports from users nor any results from
our own extensive tests suggesting that either of these
compile-time limits should be increased.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a name="ndbparam-ndbd-batchsizeperlocalscan">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-batchsizeperlocalscan">
<code class="literal">
BatchSizePerLocalScan
</code>
</a>
</p>
<a class="indexterm" name="idm46045119090416">
</a>
<div class="informaltable">
<a name="batchsizeperlocalscan-ndbd-table">
</a>
<table frame="box" rules="all" summary="BatchSizePerLocalScan data node 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>
integer
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
256
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
1 - 992
</td>
</tr>
<tr>
<th>
Deprecated
</th>
<td>
Yes (in NDB 8.0)
</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 parameter is used to calculate the number of lock
records used to handle concurrent scan operations.
</p>
<p>
Deprecated.
</p>
<p>
<code class="literal">
BatchSizePerLocalScan
</code>
has a strong
connection to the
<a class="link" href="mysql-cluster-api-definition.html#ndbparam-api-batchsize">
<code class="literal">
BatchSize
</code>
</a>
defined in
the SQL nodes.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-longmessagebuffer">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-longmessagebuffer">
<code class="literal">
LongMessageBuffer
</code>
</a>
</p>
<a class="indexterm" name="idm46045119064960">
</a>
<div class="informaltable">
<a name="longmessagebuffer-ndbd-table">
</a>
<table frame="box" rules="all" summary="LongMessageBuffer data node 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>
bytes
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
64M
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
512K - 4294967039 (0xFFFFFEFF)
</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 an internal buffer used for passing messages within
individual nodes and between nodes. The default is 64MB.
</p>
<p>
This parameter seldom needs to be changed from the default.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-maxfkbuildbatchsize">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxfkbuildbatchsize">
<code class="literal">
MaxFKBuildBatchSize
</code>
</a>
</p>
<a class="indexterm" name="idm46045119043968">
</a>
<div class="informaltable">
<a name="maxfkbuildbatchsize-ndbd-table">
</a>
<table frame="box" rules="all" summary="MaxFKBuildBatchSize data node 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>
integer
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
64
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
16 - 512
</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>
Maximum scan batch size used for building foreign keys.
Increasing the value set for this parameter may speed up
building of foreign key builds at the expense of greater
impact to ongoing traffic.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-maxnoofconcurrentscans">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxnoofconcurrentscans">
<code class="literal">
MaxNoOfConcurrentScans
</code>
</a>
</p>
<a class="indexterm" name="idm46045119023360">
</a>
<div class="informaltable">
<a name="maxnoofconcurrentscans-ndbd-table">
</a>
<table frame="box" rules="all" summary="MaxNoOfConcurrentScans data node 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>
integer
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
256
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
2 - 500
</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 parameter is used to control the number of parallel
scans that can be performed in the cluster. Each transaction
coordinator can handle the number of parallel scans defined
for this parameter. Each scan query is performed by scanning
all partitions in parallel. Each partition scan uses a scan
record in the node where the partition is located, the
number of records being the value of this parameter times
the number of nodes. The cluster should be able to sustain
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxnoofconcurrentscans">
<code class="literal">
MaxNoOfConcurrentScans
</code>
</a>
scans concurrently from all nodes in the cluster.
</p>
<p>
Scans are actually performed in two cases. The first of
these cases occurs when no hash or ordered indexes exists to
handle the query, in which case the query is executed by
performing a full table scan. The second case is encountered
when there is no hash index to support the query but there
is an ordered index. Using the ordered index means executing
a parallel range scan. The order is kept on the local
partitions only, so it is necessary to perform the index
scan on all partitions.
</p>
<p>
The default value of
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxnoofconcurrentscans">
<code class="literal">
MaxNoOfConcurrentScans
</code>
</a>
is 256. The maximum value is 500.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-maxnooflocalscans">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxnooflocalscans">
<code class="literal">
MaxNoOfLocalScans
</code>
</a>
</p>
<a class="indexterm" name="idm46045118998336">
</a>
<div class="informaltable">
<a name="maxnooflocalscans-ndbd-table">
</a>
<table frame="box" rules="all" summary="MaxNoOfLocalScans data node 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>
integer
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
4 * MaxNoOfConcurrentScans * [# of data nodes] + 2
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
32 - 4294967039 (0xFFFFFEFF)
</td>
</tr>
<tr>
<th>
Deprecated
</th>
<td>
Yes (in NDB 8.0)
</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>
Specifies the number of local scan records if many scans are
not fully parallelized. When the number of local scan
records is not provided, it is calculated as shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-simple"><div class="docs-select-all right" id="sa83333575"><div class="copy-help left">Press ⌘+C to 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">4 <span class="token operator">*</span> MaxNoOfConcurrentScans <span class="token operator">*</span> <span class="token punctuation">[</span><span class="token comment" spellcheck="true"># data nodes] + 2</span></code></pre>
</div>
<p>
This parameter is deprecated and subject to removal in a
future NDB Cluster release. In addition, this parameter is
incompatible with the
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-transactionmemory">
<code class="literal">
TransactionMemory
</code>
</a>
parameter; if you try to set values for both parameters in
the cluster configuration file
(
<code class="filename">
config.ini
</code>
), the management server
refuses to start.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-maxparallelcopyinstances">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxparallelcopyinstances">
<code class="literal">
MaxParallelCopyInstances
</code>
</a>
</p>
<a class="indexterm" name="idm46045118970576">
</a>
<div class="informaltable">
<a name="maxparallelcopyinstances-ndbd-table">
</a>
<table frame="box" rules="all" summary="MaxParallelCopyInstances data node 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>
integer
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
0
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
0 - 64
</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 parameter sets the parallelization used in the copy
phase of a node restart or system restart, when a node that
is currently just starting is synchronised with a node that
already has current data by copying over any changed records
from the node that is up to date. Because full parallelism
in such cases can lead to overload situations,
<code class="literal">
MaxParallelCopyInstances
</code>
provides a means
to decrease it. This parameter's default value 0. This
value means that the effective parallelism is equal to the
number of LDM instances in the node just starting as well as
the node updating it.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-maxparallelscansperfragment">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxparallelscansperfragment">
<code class="literal">
MaxParallelScansPerFragment
</code>
</a>
</p>
<a class="indexterm" name="idm46045118948272">
</a>
<div class="informaltable">
<a name="maxparallelscansperfragment-ndbd-table">
</a>
<table frame="box" rules="all" summary="MaxParallelScansPerFragment data node 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>
bytes
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
256
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
1 - 4294967039 (0xFFFFFEFF)
</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>
It is possible to configure the maximum number of parallel
scans (
<a class="ulink" href="/doc/ndb-internals/en/ndb-internals-kernel-blocks-dbtup.html" target="_top">
<code class="literal">
TUP
</code>
</a>
scans and
<a class="ulink" href="/doc/ndb-internals/en/ndb-internals-kernel-blocks-dbtux.html" target="_top">
<code class="literal">
TUX
</code>
</a>
scans) allowed
before they begin queuing for serial handling. You can
increase this to take advantage of any unused CPU when
performing large number of scans in parallel and improve
their performance.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-maxreorgbuildbatchsize">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxreorgbuildbatchsize">
<code class="literal">
MaxReorgBuildBatchSize
</code>
</a>
</p>
<a class="indexterm" name="idm46045118925264">
</a>
<div class="informaltable">
<a name="maxreorgbuildbatchsize-ndbd-table">
</a>
<table frame="box" rules="all" summary="MaxReorgBuildBatchSize data node 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>
integer
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
64
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
16 - 512
</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>
Maximum scan batch size used for reorganization of table
partitions. Increasing the value set for this parameter may
speed up reorganization at the expense of greater impact to
ongoing traffic.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-maxuibuildbatchsize">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxuibuildbatchsize">
<code class="literal">
MaxUIBuildBatchSize
</code>
</a>
</p>
<a class="indexterm" name="idm46045118904656">
</a>
<div class="informaltable">
<a name="maxuibuildbatchsize-ndbd-table">
</a>
<table frame="box" rules="all" summary="MaxUIBuildBatchSize data node 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>
integer
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
64
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
16 - 512
</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>
Maximum scan batch size used for building unique keys.
Increasing the value set for this parameter may speed up
such builds at the expense of greater impact to ongoing
traffic.
</p>
</li>
</ul>
</div>
<h5>
<a name="mysql-cluster-memory-allocation">
</a>
Memory Allocation
</h5>
<p>
<a name="ndbparam-ndbd-maxallocate">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxallocate">
<code class="literal">
MaxAllocate
</code>
</a>
</p>
<a class="indexterm" name="idm46045118882320">
</a>
<div class="informaltable">
<a name="maxallocate-ndbd-table">
</a>
<table frame="box" rules="all" summary="MaxAllocate data node 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>
unsigned
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
32M
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
1M - 1G
</td>
</tr>
<tr>
<th>
Deprecated
</th>
<td>
Yes (in NDB 8.0)
</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 parameter was used in older versions of NDB Cluster, but
has no effect in NDB 8.4. It is deprecated and
subject to removal in a future release.
</p>
<h5>
<a name="mysql-cluster-multiple-transporters">
</a>
Multiple Transporters
</h5>
<p>
<code class="literal">
NDB
</code>
allocates multiple transporters for
communication between pairs of data nodes. The number of
transporters so allocated can be influenced by setting an
appropriate value for the
<code class="literal">
NodeGroupTransporters
</code>
parameter introduced in
that release.
</p>
<p>
<a name="ndbparam-ndbd-nodegrouptransporters">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-nodegrouptransporters">
<code class="literal">
NodeGroupTransporters
</code>
</a>
</p>
<a class="indexterm" name="idm46045118856112">
</a>
<div class="informaltable">
<a name="nodegrouptransporters-ndbd-table">
</a>
<table frame="box" rules="all" summary="NodeGroupTransporters data node 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>
integer
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
0
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
0 - 32
</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 parameter determines the number of transporters used
between nodes in the same node group. The default value (0)
means that the number of transporters used is the same as the
number of LDMs in the node. This should be sufficient for most
use cases; thus it should seldom be necessary to change this
value from its default.
</p>
<p>
Setting
<code class="literal">
NodeGroupTransporters
</code>
to a number
greater than the number of LDM threads or the number of TC
threads, whichever is higher, causes
<code class="literal">
NDB
</code>
to
use the maximum of these two numbers of threads. This means that
a value greater than this is effectively ignored.
</p>
<h5>
<a name="mysql-cluster-hash-map-size">
</a>
Hash Map Size
</h5>
<p>
<a name="ndbparam-ndbd-defaulthashmapsize">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-defaulthashmapsize">
<code class="literal">
DefaultHashMapSize
</code>
</a>
</p>
<a class="indexterm" name="idm46045118831776">
</a>
<div class="informaltable">
<a name="defaulthashmapsize-ndbd-table">
</a>
<table frame="box" rules="all" summary="DefaultHashMapSize data node 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>
LDM threads
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
240
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
0 - 3840
</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>
The original intended use for this parameter was to facilitate
upgrades and especially downgrades to and from very old releases
with differing default hash map sizes. This is not an issue when
upgrading from NDB Cluster 7.3 (or later) to later versions.
</p>
<p>
Decreasing this parameter online after any tables have been
created or modified with
<code class="literal">
DefaultHashMapSize
</code>
equal to 3840 is not currently supported.
</p>
<p>
<a name="mysql-cluster-logging-and-checkpointing">
</a>
<b>
Logging and checkpointing.
</b>
The following
<code class="literal">
[ndbd]
</code>
parameters control log
and checkpoint behavior.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a name="ndbparam-ndbd-fragmentlogfilesize">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-fragmentlogfilesize">
<code class="literal">
FragmentLogFileSize
</code>
</a>
</p>
<a class="indexterm" name="idm46045118807312">
</a>
<div class="informaltable">
<a name="fragmentlogfilesize-ndbd-table">
</a>
<table frame="box" rules="all" summary="FragmentLogFileSize data node 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>
bytes
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
16M
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
4M - 1G
</td>
</tr>
<tr>
<th>
Restart Type
</th>
<td>
<p>
<span class="bold">
<strong>
Initial 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; each data node must
be restarted with
<a class="link" href="mysql-cluster-programs-ndbd.html#option_ndbd_initial">
<code class="option">
--initial
</code>
</a>
. (NDB 8.4.0)
</p>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Setting this parameter enables you to control directly the
size of redo log files. This can be useful in situations
when NDB Cluster is operating under a high load and it is
unable to close fragment log files quickly enough before
attempting to open new ones (only 2 fragment log files can
be open at one time); increasing the size of the fragment
log files gives the cluster more time before having to open
each new fragment log file. The default value for this
parameter is 16M.
</p>
<p>
For more information about fragment log files, see the
description for
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-nooffragmentlogfiles">
<code class="literal">
NoOfFragmentLogFiles
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-initialnoofopenfiles">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-initialnoofopenfiles">
<code class="literal">
InitialNoOfOpenFiles
</code>
</a>
</p>
<a class="indexterm" name="idm46045118783536">
</a>
<div class="informaltable">
<a name="initialnoofopenfiles-ndbd-table">
</a>
<table frame="box" rules="all" summary="InitialNoOfOpenFiles data node 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>
files
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
27
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
20 - 4294967039 (0xFFFFFEFF)
</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 parameter sets the initial number of internal threads
to allocate for open files.
</p>
<p>
The default value is 27.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-initfragmentlogfiles">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-initfragmentlogfiles">
<code class="literal">
InitFragmentLogFiles
</code>
</a>
</p>
<a class="indexterm" name="idm46045118762592">
</a>
<div class="informaltable">
<a name="initfragmentlogfiles-ndbd-table">
</a>
<table frame="box" rules="all" summary="InitFragmentLogFiles data node 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>
[see values]
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
SPARSE
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
SPARSE, FULL
</td>
</tr>
<tr>
<th>
Restart Type
</th>
<td>
<p>
<span class="bold">
<strong>
Initial 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; each data node must
be restarted with
<a class="link" href="mysql-cluster-programs-ndbd.html#option_ndbd_initial">
<code class="option">
--initial
</code>
</a>
. (NDB 8.4.0)
</p>
</td>
</tr>
</tbody>
</table>
</div>
<p>
By default, fragment log files are created sparsely when
performing an initial start of a data node—that is,
depending on the operating system and file system in use,
not all bytes are necessarily written to disk. However, it
is possible to override this behavior and force all bytes to
be written, regardless of the platform and file system type
being used, by means of this parameter.
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-initfragmentlogfiles">
<code class="literal">
InitFragmentLogFiles
</code>
</a>
takes either of two values:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<code class="literal">
SPARSE
</code>
. Fragment log files are
created sparsely. This is the default value.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
FULL
</code>
. Force all bytes of the fragment
log file to be written to disk.
</p>
</li>
</ul>
</div>
<p>
Depending on your operating system and file system, setting
<code class="literal">
InitFragmentLogFiles=FULL
</code>
may help
eliminate I/O errors on writes to the redo log.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-enablepartiallcp">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-enablepartiallcp">
<code class="literal">
EnablePartialLcp
</code>
</a>
</p>
<a class="indexterm" name="idm46045118734224">
</a>
<div class="informaltable">
<a name="enablepartiallcp-ndbd-table">
</a>
<table frame="box" rules="all" summary="EnablePartialLcp data node 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>
boolean
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
true
</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>
When
<code class="literal">
true
</code>
, enable partial local
checkpoints: This means that each LCP records only part of
the full database, plus any records containing rows changed
since the last LCP; if no rows have changed, the LCP updates
only the LCP control file and does not update any data
files.
</p>
<p>
If
<code class="literal">
EnablePartialLcp
</code>
is disabled
(
<code class="literal">
false
</code>
), each LCP uses only a single file
and writes a full checkpoint; this requires the least amount
of disk space for LCPs, but increases the write load for
each LCP. The default value is enabled
(
<code class="literal">
true
</code>
). The proportion of space used by
partial LCPS can be modified by the setting for the
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-recoverywork">
<code class="literal">
RecoveryWork
</code>
</a>
configuration parameter.
</p>
<p>
For more information about files and directories used for
full and partial LCPs, 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>
Setting this parameter to
<code class="literal">
false
</code>
also
disables the calculation of disk write speed used by the
adaptive LCP control mechanism.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-lcpscanprogresstimeout">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-lcpscanprogresstimeout">
<code class="literal">
LcpScanProgressTimeout
</code>
</a>
</p>
<a class="indexterm" name="idm46045118706064">
</a>
<div class="informaltable">
<a name="lcpscanprogresstimeout-ndbd-table">
</a>
<table frame="box" rules="all" summary="LcpScanProgressTimeout data node 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>
second
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
180
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
0 - 4294967039 (0xFFFFFEFF)
</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>
A local checkpoint fragment scan watchdog checks
periodically for no progress in each fragment scan performed
as part of a local checkpoint, and shuts down the node if
there is no progress after a given amount of time has
elapsed. This interval can be set using the
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-lcpscanprogresstimeout">
<code class="literal">
LcpScanProgressTimeout
</code>
</a>
data node configuration parameter, which sets the maximum
time for which the local checkpoint can be stalled before
the LCP fragment scan watchdog shuts down the node.
</p>
<p>
The default value is 60 seconds (providing compatibility
with previous releases). Setting this parameter to 0
disables the LCP fragment scan watchdog altogether.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-maxnoofopenfiles">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxnoofopenfiles">
<code class="literal">
MaxNoOfOpenFiles
</code>
</a>
</p>
<a class="indexterm" name="idm46045118683248">
</a>
<div class="informaltable">
<a name="maxnoofopenfiles-ndbd-table">
</a>
<table frame="box" rules="all" summary="MaxNoOfOpenFiles data node 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>
unsigned
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
0
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
20 - 4294967039 (0xFFFFFEFF)
</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 parameter sets a ceiling on how many internal threads
to allocate for open files.
<span class="emphasis">
<em>
Any situation
requiring a change in this parameter should be reported as a
bug
</em>
</span>
.
</p>
<p>
The default value is 0. However, the minimum value to which
this parameter can be set is 20.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-maxnoofsavedmessages">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxnoofsavedmessages">
<code class="literal">
MaxNoOfSavedMessages
</code>
</a>
</p>
<a class="indexterm" name="idm46045118661776">
</a>
<div class="informaltable">
<a name="maxnoofsavedmessages-ndbd-table">
</a>
<table frame="box" rules="all" summary="MaxNoOfSavedMessages data node 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>
integer
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
25
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
0 - 4294967039 (0xFFFFFEFF)
</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 parameter sets the maximum number of errors written in
the error log as well as the maximum number of trace files
that are kept before overwriting the existing ones. Trace
files are generated when, for whatever reason, the node
crashes.
</p>
<p>
The default is 25, which sets these maximums to 25 error
messages and 25 trace files.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-maxlcpstartdelay">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxlcpstartdelay">
<code class="literal">
MaxLCPStartDelay
</code>
</a>
</p>
<a class="indexterm" name="idm46045118640560">
</a>
<div class="informaltable">
<a name="maxlcpstartdelay-ndbd-table">
</a>
<table frame="box" rules="all" summary="MaxLCPStartDelay data node 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>
seconds
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
0
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
0 - 600
</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>
In parallel data node recovery, only table data is actually
copied and synchronized in parallel; synchronization of
metadata such as dictionary and checkpoint information is
done in a serial fashion. In addition, recovery of
dictionary and checkpoint information cannot be executed in
parallel with performing of local checkpoints. This means
that, when starting or restarting many data nodes
concurrently, data nodes may be forced to wait while a local
checkpoint is performed, which can result in longer node
recovery times.
</p>
<p>
It is possible to force a delay in the local checkpoint to
permit more (and possibly all) data nodes to complete
metadata synchronization; once each data node's
metadata synchronization is complete, all of the data nodes
can recover table data in parallel, even while the local
checkpoint is being executed. To force such a delay, set
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxlcpstartdelay">
<code class="literal">
MaxLCPStartDelay
</code>
</a>
,
which determines the number of seconds the cluster can wait
to begin a local checkpoint while data nodes continue to
synchronize metadata. This parameter should be set in the
<code class="literal">
[ndbd default]
</code>
section of the
<code class="filename">
config.ini
</code>
file, so that it is the same
for all data nodes. The maximum value is 600; the default is
0.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-nooffragmentlogfiles">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-nooffragmentlogfiles">
<code class="literal">
NoOfFragmentLogFiles
</code>
</a>
</p>
<a class="indexterm" name="idm46045118615760">
</a>
<div class="informaltable">
<a name="nooffragmentlogfiles-ndbd-table">
</a>
<table frame="box" rules="all" summary="NoOfFragmentLogFiles data node 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>
integer
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
16
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
3 - 4294967039 (0xFFFFFEFF)
</td>
</tr>
<tr>
<th>
Restart Type
</th>
<td>
<p>
<span class="bold">
<strong>
Initial 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; each data node must
be restarted with
<a class="link" href="mysql-cluster-programs-ndbd.html#option_ndbd_initial">
<code class="option">
--initial
</code>
</a>
. (NDB 8.4.0)
</p>
</td>
</tr>
</tbody>
</table>
</div>
<p>
This parameter sets the number of REDO log files for the
node, and thus the amount of space allocated to REDO
logging. Because the REDO log files are organized in a ring,
it is extremely important that the first and last log files
in the set (sometimes referred to as the
<span class="quote">
“
<span class="quote">
head
</span>
”
</span>
and
<span class="quote">
“
<span class="quote">
tail
</span>
”
</span>
log files, respectively) do not
meet. When these approach one another too closely, the node
begins aborting all transactions encompassing updates due to
a lack of room for new log records.
</p>
<p>
A
<code class="literal">
REDO
</code>
log record is not removed until
both required local checkpoints have been completed since
that log record was inserted. Checkpointing frequency is
determined by its own set of configuration parameters
discussed elsewhere in this chapter.
</p>
<p>
The default parameter value is 16, which by default means 16
sets of 4 16MB files for a total of 1024MB. The size of the
individual log files is configurable using the
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-fragmentlogfilesize">
<code class="literal">
FragmentLogFileSize
</code>
</a>
parameter. In scenarios requiring a great many updates, the
value for
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-nooffragmentlogfiles">
<code class="literal">
NoOfFragmentLogFiles
</code>
</a>
may need to be set as high as 300 or even higher to provide
sufficient space for REDO logs.
</p>
<p>
If the checkpointing is slow and there are so many writes to
the database that the log files are full and the log tail
cannot be cut without jeopardizing recovery, all updating
transactions are aborted with internal error code 410
(
<code class="literal">
Out of log file space temporarily
</code>
). This
condition prevails until a checkpoint has completed and the
log tail can be moved forward.
</p>
<div class="important" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Important
</div>
<p>
This parameter cannot be changed
<span class="quote">
“
<span class="quote">
on the
fly
</span>
”
</span>
; you must restart the node using
<code class="option">
--initial
</code>
. If you wish to change this
value for all data nodes in a running cluster, you can do
so using a rolling node restart (using
<code class="option">
--initial
</code>
when starting each data node).
</p>
</div>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-recoverywork">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-recoverywork">
<code class="literal">
RecoveryWork
</code>
</a>
</p>
<a class="indexterm" name="idm46045118584224">
</a>
<div class="informaltable">
<a name="recoverywork-ndbd-table">
</a>
<table frame="box" rules="all" summary="RecoveryWork data node 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>
integer
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
60
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
25 - 100
</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>
Percentage of storage overhead for LCP files. This parameter
has an effect only when
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-enablepartiallcp">
<code class="literal">
EnablePartialLcp
</code>
</a>
is
true, that is, only when partial local checkpoints are
enabled. A higher value means:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
Fewer records are written for each LCP, LCPs use more
space
</p>
</li>
<li class="listitem">
<p>
More work is needed during restarts
</p>
</li>
</ul>
</div>
<p>
A lower value for
<code class="literal">
RecoveryWork
</code>
means:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
More records are written during each LCP, but LCPs
require less space on disk.
</p>
</li>
<li class="listitem">
<p>
Less work during restart and thus faster restarts, at
the expense of more work during normal operations
</p>
</li>
</ul>
</div>
<p>
For example, setting
<code class="literal">
RecoveryWork
</code>
to 60
means that the total size of an LCP is roughly 1 + 0.6 = 1.6
times the size of the data to be checkpointed. This means
that 60% more work is required during the restore phase of a
restart compared to the work done during a restart that uses
full checkpoints. (This is more than compensated for during
other phases of the restart such that the restart as a whole
is still faster when using partial LCPs than when using full
LCPs.) In order not to fill up the redo log, it is necessary
to write at 1 + (1 /
<code class="literal">
RecoveryWork
</code>
) times
the rate of data changes during checkpoints—thus, when
<code class="literal">
RecoveryWork
</code>
= 60, it is necessary to
write at approximately 1 + (1 / 0.6 ) = 2.67 times the
change rate. In other words, if changes are being written at
10 MByte per second, the checkpoint needs to be written at
roughly 26.7 MByte per second.
</p>
<p>
Setting
<code class="literal">
RecoveryWork
</code>
= 40 means that only
1.4 times the total LCP size is needed (and thus the restore
phase takes 10 to 15 percent less time. In this case, the
checkpoint write rate is 3.5 times the rate of change.
</p>
<a class="indexterm" name="idm46045118554352">
</a>
<p>
The NDB source distribution includes a test program for
simulating LCPs.
<code class="filename">
lcp_simulator.cc
</code>
can
be found in
<code class="filename">
storage/ndb/src/kernel/blocks/backup/
</code>
.
To compile and run it on Unix platforms, execute the
commands shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa54795723"><div class="copy-help left">Press ⌘+C to 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">gcc</span> lcp_simulator<span class="token punctuation">.</span>cc
<span class="token prompt">$> </span><span class="token command">./a.out</span></code></pre>
</div>
<p>
This program has no dependencies other than
<code class="filename">
stdio.h
</code>
, and does not require a
connection to an NDB cluster or a MySQL server. By default,
it simulates 300 LCPs (three sets of 100 LCPs, each
consisting of inserts, updates, and deletes, in turn),
reporting the size of the LCP after each one. You can alter
the simulation by changing the values of
<code class="literal">
recovery_work
</code>
,
<code class="literal">
insert_work
</code>
, and
<code class="literal">
delete_work
</code>
in the source and
recompiling. For more information, see the source of the
program.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-insertrecoverywork">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-insertrecoverywork">
<code class="literal">
InsertRecoveryWork
</code>
</a>
</p>
<a class="indexterm" name="idm46045118542512">
</a>
<div class="informaltable">
<a name="insertrecoverywork-ndbd-table">
</a>
<table frame="box" rules="all" summary="InsertRecoveryWork data node 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>
integer
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
40
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
0 - 70
</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>
Percentage of
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-recoverywork">
<code class="literal">
RecoveryWork
</code>
</a>
used
for inserted rows. A higher value increases the number of
writes during a local checkpoint, and decreases the total
size of the LCP. A lower value decreases the number of
writes during an LCP, but results in more space being used
for the LCP, which means that recovery takes longer. This
parameter has an effect only when
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-enablepartiallcp">
<code class="literal">
EnablePartialLcp
</code>
</a>
is
true, that is, only when partial local checkpoints are
enabled.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-enableredocontrol">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-enableredocontrol">
<code class="literal">
EnableRedoControl
</code>
</a>
</p>
<a class="indexterm" name="idm46045118519056">
</a>
<div class="informaltable">
<a name="enableredocontrol-ndbd-table">
</a>
<table frame="box" rules="all" summary="EnableRedoControl data node 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>
boolean
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
true
</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>
Enable adaptive checkpointing speed for controlling redo log
usage.
</p>
<p>
When enabled (the default),
<code class="literal">
EnableRedoControl
</code>
allows the data nodes
greater flexibility with regard to the rate at which they
write LCPs to disk. More specifically, enabling this
parameter means that higher write rates can be employed, so
that LCPs can complete and redo logs be trimmed more
quickly, thereby reducing recovery time and disk space
requirements. This functionality allows data nodes to make
better use of the higher rate of I/O and greater bandwidth
available from modern solid-state storage devices and
protocols, such as solid-state drives (SSDs) using
Non-Volatile Memory Express (NVMe).
</p>
<p>
When
<code class="literal">
NDB
</code>
is deployed on systems whose I/O
or bandwidth is constrained relative to those employing
solid-state technology, such as those using conventional
hard disks (HDDs), the
<code class="literal">
EnableRedoControl
</code>
mechanism can easily cause the I/O subsystem to become
saturated, increasing wait times for data node input and
output. In particular, this can cause issues with NDB Disk
Data tables which have tablespaces or log file groups
sharing a constrained I/O subsystem with data node LCP and
redo log files; such problems potentially include node or
cluster failure due to GCP stop errors. Set
<code class="literal">
EnableRedoControl
</code>
to
<code class="literal">
false
</code>
to disable it in such situations.
Setting
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-enablepartiallcp">
<code class="literal">
EnablePartialLcp
</code>
</a>
to
<code class="literal">
false
</code>
also disables the adaptive
calculation.
</p>
</li>
</ul>
</div>
<p>
<a name="mysql-cluster-metadata-objects">
</a>
<b>
Metadata objects.
</b>
The next set of
<code class="literal">
[ndbd]
</code>
parameters defines
pool sizes for metadata objects, used to define the maximum
number of attributes, tables, indexes, and trigger objects
used by indexes, events, and replication between clusters.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
These act merely as
<span class="quote">
“
<span class="quote">
suggestions
</span>
”
</span>
to the cluster,
and any that are not specified revert to the default values
shown.
</p>
</div>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a name="ndbparam-ndbd-maxnoofattributes">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxnoofattributes">
<code class="literal">
MaxNoOfAttributes
</code>
</a>
</p>
<a class="indexterm" name="idm46045118485776">
</a>
<div class="informaltable">
<a name="maxnoofattributes-ndbd-table">
</a>
<table frame="box" rules="all" summary="MaxNoOfAttributes data node 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>
integer
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
1000
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
32 - 4294967039 (0xFFFFFEFF)
</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 parameter sets a suggested maximum number of attributes
that can be defined in the cluster; like
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxnooftables">
<code class="literal">
MaxNoOfTables
</code>
</a>
, it is
not intended to function as a hard upper limit.
</p>
<p>
(In older NDB Cluster releases, this parameter was sometimes
treated as a hard limit for certain operations. This caused
problems with NDB Cluster Replication, when it was possible
to create more tables than could be replicated, and
sometimes led to confusion when it was possible [or not
possible, depending on the circumstances] to create more
than
<code class="literal">
MaxNoOfAttributes
</code>
attributes.)
</p>
<p>
The default value is 1000, with the minimum possible value
being 32. The maximum is 4294967039. Each attribute consumes
around 200 bytes of storage per node due to the fact that
all metadata is fully replicated on the servers.
</p>
<p>
When setting
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxnoofattributes">
<code class="literal">
MaxNoOfAttributes
</code>
</a>
,
it is important to prepare in advance for any
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER TABLE
</code>
</a>
statements that
you might want to perform in the future. This is due to the
fact, during the execution of
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER
TABLE
</code>
</a>
on a Cluster table, 3 times the number of
attributes as in the original table are used, and a good
practice is to permit double this amount. For example, if
the NDB Cluster table having the greatest number of
attributes
(
<em class="replaceable">
<code>
greatest_number_of_attributes
</code>
</em>
)
has 100 attributes, a good starting point for the value of
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxnoofattributes">
<code class="literal">
MaxNoOfAttributes
</code>
</a>
would be
<code class="literal">
6 *
<em class="replaceable">
<code>
greatest_number_of_attributes
</code>
</em>
=
600
</code>
.
</p>
<p>
You should also estimate the average number of attributes
per table and multiply this by
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxnooftables">
<code class="literal">
MaxNoOfTables
</code>
</a>
. If
this value is larger than the value obtained in the previous
paragraph, you should use the larger value instead.
</p>
<p>
Assuming that you can create all desired tables without any
problems, you should also verify that this number is
sufficient by trying an actual
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER
TABLE
</code>
</a>
after configuring the parameter. If this is
not successful, increase
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxnoofattributes">
<code class="literal">
MaxNoOfAttributes
</code>
</a>
by
another multiple of
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxnooftables">
<code class="literal">
MaxNoOfTables
</code>
</a>
and
test it again.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-maxnooftables">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxnooftables">
<code class="literal">
MaxNoOfTables
</code>
</a>
</p>
<a class="indexterm" name="idm46045118447712">
</a>
<div class="informaltable">
<a name="maxnooftables-ndbd-table">
</a>
<table frame="box" rules="all" summary="MaxNoOfTables data node 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>
integer
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
128
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
8 - 20320
</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>
A table object is allocated for each table and for each
unique hash index in the cluster. This parameter sets a
suggested maximum number of table objects for the cluster as
a whole; like
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxnoofattributes">
<code class="literal">
MaxNoOfAttributes
</code>
</a>
,
it is not intended to function as a hard upper limit.
</p>
<p>
(In older NDB Cluster releases, this parameter was sometimes
treated as a hard limit for certain operations. This caused
problems with NDB Cluster Replication, when it was possible
to create more tables than could be replicated, and
sometimes led to confusion when it was possible [or not
possible, depending on the circumstances] to create more
than
<code class="literal">
MaxNoOfTables
</code>
tables.)
</p>
<p>
For each attribute that has a
<a class="link" href="blob.html" title="13.3.4 The BLOB and TEXT Types">
<code class="literal">
BLOB
</code>
</a>
data type an extra table
is used to store most of the
<a class="link" href="blob.html" title="13.3.4 The BLOB and TEXT Types">
<code class="literal">
BLOB
</code>
</a>
data. These tables also
must be taken into account when defining the total number of
tables.
</p>
<p>
The default value of this parameter is 128. The minimum is 8
and the maximum is 20320. Each table object consumes
approximately 20KB per node.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
The sum of
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxnooftables">
<code class="literal">
MaxNoOfTables
</code>
</a>
,
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxnooforderedindexes">
<code class="literal">
MaxNoOfOrderedIndexes
</code>
</a>
,
and
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxnoofuniquehashindexes">
<code class="literal">
MaxNoOfUniqueHashIndexes
</code>
</a>
must not exceed
<code class="literal">
2
<sup>
32
</sup>
− 2
</code>
(4294967294).
</p>
</div>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-maxnooforderedindexes">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxnooforderedindexes">
<code class="literal">
MaxNoOfOrderedIndexes
</code>
</a>
</p>
<a class="indexterm" name="idm46045118414784">
</a>
<div class="informaltable">
<a name="maxnooforderedindexes-ndbd-table">
</a>
<table frame="box" rules="all" summary="MaxNoOfOrderedIndexes data node 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>
integer
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
128
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
0 - 4294967039 (0xFFFFFEFF)
</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>
For each ordered index in the cluster, an object is
allocated describing what is being indexed and its storage
segments. By default, each index so defined also defines an
ordered index. Each unique index and primary key has both an
ordered index and a hash index.
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxnooforderedindexes">
<code class="literal">
MaxNoOfOrderedIndexes
</code>
</a>
sets the total number of ordered indexes that can be in use
in the system at any one time.
</p>
<p>
The default value of this parameter is 128. Each index
object consumes approximately 10KB of data per node.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
The sum of
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxnooftables">
<code class="literal">
MaxNoOfTables
</code>
</a>
,
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxnooforderedindexes">
<code class="literal">
MaxNoOfOrderedIndexes
</code>
</a>
,
and
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxnoofuniquehashindexes">
<code class="literal">
MaxNoOfUniqueHashIndexes
</code>
</a>
must not exceed
<code class="literal">
2
<sup>
32
</sup>
− 2
</code>
(4294967294).
</p>
</div>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-maxnoofuniquehashindexes">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxnoofuniquehashindexes">
<code class="literal">
MaxNoOfUniqueHashIndexes
</code>
</a>
</p>
<a class="indexterm" name="idm46045118386368">
</a>
<div class="informaltable">
<a name="maxnoofuniquehashindexes-ndbd-table">
</a>
<table frame="box" rules="all" summary="MaxNoOfUniqueHashIndexes data node 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>
integer
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
64
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
0 - 4294967039 (0xFFFFFEFF)
</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>
For each unique index that is not a primary key, a special
table is allocated that maps the unique key to the primary
key of the indexed table. By default, an ordered index is
also defined for each unique index. To prevent this, you
must specify the
<code class="literal">
USING HASH
</code>
option when
defining the unique index.
</p>
<p>
The default value is 64. Each index consumes approximately
15KB per node.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
The sum of
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxnooftables">
<code class="literal">
MaxNoOfTables
</code>
</a>
,
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxnooforderedindexes">
<code class="literal">
MaxNoOfOrderedIndexes
</code>
</a>
,
and
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxnoofuniquehashindexes">
<code class="literal">
MaxNoOfUniqueHashIndexes
</code>
</a>
must not exceed
<code class="literal">
2
<sup>
32
</sup>
− 2
</code>
(4294967294).
</p>
</div>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-maxnooftriggers">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxnooftriggers">
<code class="literal">
MaxNoOfTriggers
</code>
</a>
</p>
<a class="indexterm" name="idm46045118358528">
</a>
<div class="informaltable">
<a name="maxnooftriggers-ndbd-table">
</a>
<table frame="box" rules="all" summary="MaxNoOfTriggers data node 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>
integer
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
768
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
0 - 4294967039 (0xFFFFFEFF)
</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>
Internal update, insert, and delete triggers are allocated
for each unique hash index. (This means that three triggers
are created for each unique hash index.) However, an
<span class="emphasis">
<em>
ordered
</em>
</span>
index requires only a single
trigger object. Backups also use three trigger objects for
each normal table in the cluster.
</p>
<p>
Replication between clusters also makes use of internal
triggers.
</p>
<p>
This parameter sets the maximum number of trigger objects in
the cluster.
</p>
<p>
The default value is 768.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-maxnoofsubscriptions">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxnoofsubscriptions">
<code class="literal">
MaxNoOfSubscriptions
</code>
</a>
</p>
<a class="indexterm" name="idm46045118335904">
</a>
<div class="informaltable">
<a name="maxnoofsubscriptions-ndbd-table">
</a>
<table frame="box" rules="all" summary="MaxNoOfSubscriptions data node 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>
unsigned
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
0
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
0 - 4294967039 (0xFFFFFEFF)
</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>
Each
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
table in an NDB
Cluster requires a subscription in the NDB kernel. For some
NDB API applications, it may be necessary or desirable to
change this parameter. However, for normal usage with MySQL
servers acting as SQL nodes, there is not any need to do so.
</p>
<p>
The default value for
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxnoofsubscriptions">
<code class="literal">
MaxNoOfSubscriptions
</code>
</a>
is 0, which is treated as equal to
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxnooftables">
<code class="literal">
MaxNoOfTables
</code>
</a>
. Each
subscription consumes 108 bytes.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-maxnoofsubscribers">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxnoofsubscribers">
<code class="literal">
MaxNoOfSubscribers
</code>
</a>
</p>
<a class="indexterm" name="idm46045118310880">
</a>
<div class="informaltable">
<a name="maxnoofsubscribers-ndbd-table">
</a>
<table frame="box" rules="all" summary="MaxNoOfSubscribers data node 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>
unsigned
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
0
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
0 - 4294967039 (0xFFFFFEFF)
</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 parameter is of interest only when using NDB Cluster
Replication. The default value is 0. It is treated as
<code class="literal">
2 * MaxNoOfTables + 2 * [number of API
nodes]
</code>
. There is one subscription per
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
table for each of two MySQL
servers (one acting as the replication source and the other
as the replica). Each subscriber uses 16 bytes of memory.
</p>
<p>
When using circular replication, multi-source replication,
and other replication setups involving more than 2 MySQL
servers, you should increase this parameter to the number of
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
processes included in replication
(this is often, but not always, the same as the number of
clusters). For example, if you have a circular replication
setup using three NDB Clusters, with one
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
attached to each cluster, and each
of these
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
processes acts as a
source and as a replica, you should set
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxnoofsubscribers">
<code class="literal">
MaxNoOfSubscribers
</code>
</a>
equal to
<code class="literal">
3 * MaxNoOfTables
</code>
.
</p>
<p>
For more information, see
<a class="xref" href="mysql-cluster-replication.html" title="25.7 NDB Cluster Replication">
Section 25.7, “NDB Cluster Replication”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-maxnoofconcurrentsuboperations">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxnoofconcurrentsuboperations">
<code class="literal">
MaxNoOfConcurrentSubOperations
</code>
</a>
</p>
<a class="indexterm" name="idm46045118280384">
</a>
<div class="informaltable">
<a name="maxnoofconcurrentsuboperations-ndbd-table">
</a>
<table frame="box" rules="all" summary="MaxNoOfConcurrentSubOperations data node 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>
unsigned
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
256
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
0 - 4294967039 (0xFFFFFEFF)
</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 parameter sets a ceiling on the number of operations
that can be performed by all API nodes in the cluster at one
time. The default value (256) is sufficient for normal
operations, and might need to be adjusted only in scenarios
where there are a great many API nodes each performing a
high volume of operations concurrently.
</p>
</li>
</ul>
</div>
<p>
<a name="mysql-cluster-boolean-parameters">
</a>
<b>
Boolean parameters.
</b>
The behavior of data nodes is also affected by a set of
<code class="literal">
[ndbd]
</code>
parameters taking on boolean values.
These parameters can each be specified as
<code class="literal">
TRUE
</code>
by setting them equal to
<code class="literal">
1
</code>
or
<code class="literal">
Y
</code>
, and as
<code class="literal">
FALSE
</code>
by setting them equal to
<code class="literal">
0
</code>
or
<code class="literal">
N
</code>
.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a name="ndbparam-ndbd-compressedlcp">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-compressedlcp">
<code class="literal">
CompressedLCP
</code>
</a>
</p>
<a class="indexterm" name="idm46045118252000">
</a>
<div class="informaltable">
<a name="compressedlcp-ndbd-table">
</a>
<table frame="box" rules="all" summary="CompressedLCP data node 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>
boolean
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
false
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
true, false
</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>
Setting this parameter to
<code class="literal">
1
</code>
causes local
checkpoint files to be compressed. The compression used is
equivalent to
<span class="command">
<strong>
gzip --fast
</strong>
</span>
, and can save
50% or more of the space required on the data node to store
uncompressed checkpoint files. Compressed LCPs can be
enabled for individual data nodes, or for all data nodes (by
setting this parameter in the
<code class="literal">
[ndbd
default]
</code>
section of the
<code class="filename">
config.ini
</code>
file).
</p>
<div class="important" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Important
</div>
<p>
You cannot restore a compressed local checkpoint to a
cluster running a MySQL version that does not support this
feature.
</p>
</div>
<p>
The default value is
<code class="literal">
0
</code>
(disabled).
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-crashoncorruptedtuple">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-crashoncorruptedtuple">
<code class="literal">
CrashOnCorruptedTuple
</code>
</a>
</p>
<a class="indexterm" name="idm46045118226336">
</a>
<div class="informaltable">
<a name="crashoncorruptedtuple-ndbd-table">
</a>
<table frame="box" rules="all" summary="CrashOnCorruptedTuple data node 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>
boolean
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
true
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
true, false
</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>
When this parameter is enabled (the default), it forces a
data node to shut down whenever it encounters a corrupted
tuple.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-diskless">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-diskless">
<code class="literal">
Diskless
</code>
</a>
</p>
<a class="indexterm" name="idm46045118205888">
</a>
<div class="informaltable">
<a name="diskless-ndbd-table">
</a>
<table frame="box" rules="all" summary="Diskless data node 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>
true|false (1|0)
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
false
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
true, false
</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>
It is possible to specify NDB Cluster tables as
<span class="firstterm">
diskless
</span>
, meaning that
tables are not checkpointed to disk and that no logging
occurs. Such tables exist only in main memory. A consequence
of using diskless tables is that neither the tables nor the
records in those tables survive a crash. However, when
operating in diskless mode, it is possible to run
<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
</strong>
</span>
</a>
on a diskless computer.
</p>
<div class="important" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Important
</div>
<p>
This feature causes the
<span class="emphasis">
<em>
entire
</em>
</span>
cluster to operate in diskless mode.
</p>
</div>
<p>
When this feature is enabled, NDB Cluster online backup is
disabled. In addition, a partial start of the cluster is not
possible.
</p>
<p>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-diskless">
<code class="literal">
Diskless
</code>
</a>
is disabled
by default.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-encryptedfilesystem">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-encryptedfilesystem">
<code class="literal">
EncryptedFileSystem
</code>
</a>
</p>
<div class="informaltable">
<a name="encryptedfilesystem-ndbd-table">
</a>
<table frame="box" rules="all" summary="EncryptedFileSystem data node 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>
unsigned
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
0
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
0 - 1
</td>
</tr>
<tr>
<th>
Restart Type
</th>
<td>
<p>
<span class="bold">
<strong>
Initial 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; each data node must
be restarted with
<a class="link" href="mysql-cluster-programs-ndbd.html#option_ndbd_initial">
<code class="option">
--initial
</code>
</a>
. (NDB 8.4.0)
</p>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Encrypt LCP and tablespace files, including undo logs and
redo logs. Disabled by default (
<code class="literal">
0
</code>
); set
to
<code class="literal">
1
</code>
to enable.
</p>
<div class="important" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Important
</div>
<p>
When file system encryption is enabled, you must supply a
password to each data node when starting it, using one of
the options
<a class="link" href="mysql-cluster-programs-ndbd.html#option_ndbd_filesystem-password">
<code class="option">
--filesystem-password
</code>
</a>
or
<a class="link" href="mysql-cluster-programs-ndbd.html#option_ndbd_filesystem-password-from-stdin">
<code class="option">
--filesystem-password-from-stdin
</code>
</a>
.
Otherwise, the data node cannot start.
</p>
</div>
<p>
For more information, see
<a class="xref" href="mysql-cluster-tde.html" title="25.6.14 File System Encryption for NDB Cluster">
Section 25.6.14, “File System Encryption for NDB Cluster”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-latealloc">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-latealloc">
<code class="literal">
LateAlloc
</code>
</a>
</p>
<a class="indexterm" name="idm46045118153200">
</a>
<div class="informaltable">
<a name="latealloc-ndbd-table">
</a>
<table frame="box" rules="all" summary="LateAlloc data node 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>
numeric
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
1
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
0 - 1
</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>
Allocate memory for this data node after a connection to the
management server has been established. Enabled by default.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-lockpagesinmainmemory">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-lockpagesinmainmemory">
<code class="literal">
LockPagesInMainMemory
</code>
</a>
</p>
<a class="indexterm" name="idm46045118132688">
</a>
<div class="informaltable">
<a name="lockpagesinmainmemory-ndbd-table">
</a>
<table frame="box" rules="all" summary="LockPagesInMainMemory data node 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>
numeric
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
0
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
0 - 2
</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>
For a number of operating systems, including Solaris and
Linux, it is possible to lock a process into memory and so
avoid any swapping to disk. This can be used to help
guarantee the cluster's real-time characteristics.
</p>
<p>
This parameter takes one of the integer values
<code class="literal">
0
</code>
,
<code class="literal">
1
</code>
, or
<code class="literal">
2
</code>
, which act as shown in the following
list:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<code class="literal">
0
</code>
: Disables locking. This is the
default value.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
1
</code>
: Performs the lock after allocating
memory for the process.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
2
</code>
: Performs the lock before memory
for the process is allocated.
</p>
</li>
</ul>
</div>
<p>
If the operating system is not configured to permit
unprivileged users to lock pages, then the data node process
making use of this parameter may have to be run as system
root.
(
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-lockpagesinmainmemory">
<code class="literal">
LockPagesInMainMemory
</code>
</a>
uses the
<code class="literal">
mlockall
</code>
function. From Linux
kernel 2.6.9, unprivileged users can lock memory as limited
by
<code class="literal">
max locked memory
</code>
. For more
information, see
<span class="command">
<strong>
ulimit -l
</strong>
</span>
and
<a class="ulink" href="http://linux.die.net/man/2/mlock" target="_blank">
http://linux.die.net/man/2/mlock
</a>
).
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
In older NDB Cluster releases, this parameter was a
Boolean.
<code class="literal">
0
</code>
or
<code class="literal">
false
</code>
was the default setting, and disabled locking.
<code class="literal">
1
</code>
or
<code class="literal">
true
</code>
enabled
locking of the process after its memory was allocated. NDB
Cluster 8.4 treats
<code class="literal">
true
</code>
or
<code class="literal">
false
</code>
for the value of this parameter
as an error.
</p>
</div>
<div class="important" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Important
</div>
<p>
Beginning with
<code class="literal">
glibc
</code>
2.10,
<code class="literal">
glibc
</code>
uses per-thread arenas to reduce
lock contention on a shared pool, which consumes real
memory. In general, a data node process does not need
per-thread arenas, since it does not perform any memory
allocation after startup. (This difference in allocators
does not appear to affect performance significantly.)
</p>
<p>
The
<code class="literal">
glibc
</code>
behavior is intended to be
configurable via the
<code class="literal">
MALLOC_ARENA_MAX
</code>
environment variable, but a bug in this mechanism prior to
<code class="literal">
glibc
</code>
2.16 meant that this variable
could not be set to less than 8, so that the wasted memory
could not be reclaimed. (Bug #15907219; see also
<a class="ulink" href="http://sourceware.org/bugzilla/show_bug.cgi?id=13137" target="_blank">
http://sourceware.org/bugzilla/show_bug.cgi?id=13137
</a>
for more information concerning this issue.)
</p>
<p>
One possible workaround for this problem is to use the
<code class="literal">
LD_PRELOAD
</code>
environment variable to
preload a
<code class="literal">
jemalloc
</code>
memory allocation
library to take the place of that supplied with
<code class="literal">
glibc
</code>
.
</p>
</div>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-odirect">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-odirect">
<code class="literal">
ODirect
</code>
</a>
</p>
<a class="indexterm" name="idm46045118085616">
</a>
<div class="informaltable">
<a name="odirect-ndbd-table">
</a>
<table frame="box" rules="all" summary="ODirect data node 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>
boolean
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
false
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
true, false
</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>
Enabling this parameter causes
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
to attempt using
<code class="literal">
O_DIRECT
</code>
writes for LCP, backups, and
redo logs, often lowering
<span class="command">
<strong>
kswapd
</strong>
</span>
and CPU
usage. When using NDB Cluster on Linux, enable
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-odirect">
<code class="literal">
ODirect
</code>
</a>
if you are
using a 2.6 or later kernel.
</p>
<p>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-odirect">
<code class="literal">
ODirect
</code>
</a>
is disabled
by default.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-odirectsyncflag">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-odirectsyncflag">
<code class="literal">
ODirectSyncFlag
</code>
</a>
</p>
<a class="indexterm" name="idm46045118059536">
</a>
<div class="informaltable">
<a name="odirectsyncflag-ndbd-table">
</a>
<table frame="box" rules="all" summary="ODirectSyncFlag data node 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>
boolean
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
false
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
true, false
</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>
When this parameter is enabled, redo log writes are
performed such that each completed file system write is
handled as a call to
<code class="literal">
fsync
</code>
. The setting
for this parameter is ignored if at least one of the
following conditions is true:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-odirect">
<code class="literal">
ODirect
</code>
</a>
is not
enabled.
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-initfragmentlogfiles">
<code class="literal">
InitFragmentLogFiles
</code>
</a>
is set to
<code class="literal">
SPARSE
</code>
.
</p>
</li>
</ul>
</div>
<p>
Disabled by default.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-requirecertificate">
</a>
<code class="literal">
RequireCertificate
</code>
</p>
<a class="indexterm" name="idm46045118033184">
</a>
<div class="informaltable">
<a name="requirecertificate-ndbd-table">
</a>
<table frame="box" rules="all" summary="RequireCertificate data node 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>
boolean
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
false
</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>
If this parameter is set to
<code class="literal">
true
</code>
, the
data node looks for a key and a valid and current
certificate in the TLS search path, and cannot start if it
does not find them.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-requiretls">
</a>
<code class="literal">
RequireTls
</code>
</p>
<a class="indexterm" name="idm46045118012096">
</a>
<div class="informaltable">
<a name="requiretls-ndbd-table">
</a>
<table frame="box" rules="all" summary="RequireTls data node 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>
boolean
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
false
</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>
If this parameter is set to
<code class="literal">
true
</code>
,
connections to this data node must be authenticated using
TLS.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-restartonerrorinsert">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-restartonerrorinsert">
<code class="literal">
RestartOnErrorInsert
</code>
</a>
</p>
<a class="indexterm" name="idm46045117990464">
</a>
<div class="informaltable">
<a name="restartonerrorinsert-ndbd-table">
</a>
<table frame="box" rules="all" summary="RestartOnErrorInsert data node 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>
error code
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
2
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
0 - 4
</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 feature is accessible only when building the debug
version where it is possible to insert errors in the
execution of individual blocks of code as part of testing.
</p>
<p>
This feature is disabled by default.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-stoponerror">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-stoponerror">
<code class="literal">
StopOnError
</code>
</a>
</p>
<a class="indexterm" name="idm46045117969504">
</a>
<div class="informaltable">
<a name="stoponerror-ndbd-table">
</a>
<table frame="box" rules="all" summary="StopOnError data node 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>
boolean
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
1
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
0, 1
</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 parameter specifies whether a data node process should
exit or perform an automatic restart when an error condition
is encountered.
</p>
<p>
This parameter's default value is 1; this means that,
by default, an error causes the data node process to halt.
</p>
<p>
When an error is encountered and
<code class="literal">
StopOnError
</code>
is 0, the data node process
is restarted.
</p>
<p>
Users of MySQL Cluster Manager should note that, when
<code class="literal">
StopOnError
</code>
equals 1, this prevents the
MySQL Cluster Manager agent from restarting any data nodes after it has
performed its own restart and recovery. See
<a class="ulink" href="/doc/mysql-cluster-manager/8.4/en/mcm-using-start-stop-agent-linux.html" target="_top">
Starting and Stopping the Agent on Linux
</a>
, for more
information.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-useshm">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-useshm">
<code class="literal">
UseShm
</code>
</a>
</p>
<a class="indexterm" name="idm46045117945104">
</a>
<div class="informaltable">
<a name="useshm-ndbd-table">
</a>
<table frame="box" rules="all" summary="UseShm data node 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>
boolean
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
false
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
true, false
</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>
Enable a shared memory connection between this data node and
the API node also running on this host. Set to 1 to enable.
</p>
</li>
</ul>
</div>
<h5>
<a name="mysql-cluster-timeouts-intervals-disk-paging">
</a>
Controlling Timeouts, Intervals, and Disk Paging
</h5>
<p>
There are a number of
<code class="literal">
[ndbd]
</code>
parameters
specifying timeouts and intervals between various actions in
Cluster data nodes. Most of the timeout values are specified in
milliseconds. Any exceptions to this are mentioned where
applicable.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a name="ndbparam-ndbd-timebetweenwatchdogcheck">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-timebetweenwatchdogcheck">
<code class="literal">
TimeBetweenWatchDogCheck
</code>
</a>
</p>
<a class="indexterm" name="idm46045117921600">
</a>
<div class="informaltable">
<a name="timebetweenwatchdogcheck-ndbd-table">
</a>
<table frame="box" rules="all" summary="TimeBetweenWatchDogCheck data node 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>
milliseconds
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
6000
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
70 - 4294967039 (0xFFFFFEFF)
</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>
To prevent the main thread from getting stuck in an endless
loop at some point, a
<span class="quote">
“
<span class="quote">
watchdog
</span>
”
</span>
thread checks
the main thread. This parameter specifies the number of
milliseconds between checks. If the process remains in the
same state after three checks, the watchdog thread
terminates it.
</p>
<p>
This parameter can easily be changed for purposes of
experimentation or to adapt to local conditions. It can be
specified on a per-node basis although there seems to be
little reason for doing so.
</p>
<p>
The default timeout is 6000 milliseconds (6 seconds).
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-timebetweenwatchdogcheckinitial">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-timebetweenwatchdogcheckinitial">
<code class="literal">
TimeBetweenWatchDogCheckInitial
</code>
</a>
</p>
<a class="indexterm" name="idm46045117899104">
</a>
<div class="informaltable">
<a name="timebetweenwatchdogcheckinitial-ndbd-table">
</a>
<table frame="box" rules="all" summary="TimeBetweenWatchDogCheckInitial data node 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>
milliseconds
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
6000
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
70 - 4294967039 (0xFFFFFEFF)
</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 similar to the
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-timebetweenwatchdogcheck">
<code class="literal">
TimeBetweenWatchDogCheck
</code>
</a>
parameter, except that
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-timebetweenwatchdogcheckinitial">
<code class="literal">
TimeBetweenWatchDogCheckInitial
</code>
</a>
controls the amount of time that passes between execution
checks inside a storage node in the early start phases
during which memory is allocated.
</p>
<p>
The default timeout is 6000 milliseconds (6 seconds).
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-startpartialtimeout">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-startpartialtimeout">
<code class="literal">
StartPartialTimeout
</code>
</a>
</p>
<a class="indexterm" name="idm46045117875392">
</a>
<div class="informaltable">
<a name="startpartialtimeout-ndbd-table">
</a>
<table frame="box" rules="all" summary="StartPartialTimeout data node 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>
milliseconds
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
30000
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
0 - 4294967039 (0xFFFFFEFF)
</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 parameter specifies how long the Cluster waits for all
data nodes to come up before the cluster initialization
routine is invoked. This timeout is used to avoid a partial
Cluster startup whenever possible.
</p>
<p>
This parameter is overridden when performing an initial
start or initial restart of the cluster.
</p>
<p>
The default value is 30000 milliseconds (30 seconds). 0
disables the timeout, in which case the cluster may start
only if all nodes are available.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-startpartitionedtimeout">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-startpartitionedtimeout">
<code class="literal">
StartPartitionedTimeout
</code>
</a>
</p>
<a class="indexterm" name="idm46045117853664">
</a>
<div class="informaltable">
<a name="startpartitionedtimeout-ndbd-table">
</a>
<table frame="box" rules="all" summary="StartPartitionedTimeout data node 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>
milliseconds
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
0
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
0 - 4294967039 (0xFFFFFEFF)
</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>
If the cluster is ready to start after waiting for
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-startpartialtimeout">
<code class="literal">
StartPartialTimeout
</code>
</a>
milliseconds but is still possibly in a partitioned state,
the cluster waits until this timeout has also passed. If
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-startpartitionedtimeout">
<code class="literal">
StartPartitionedTimeout
</code>
</a>
is set to 0, the cluster waits indefinitely
(2
<sup>
32
</sup>
−1 ms, or approximately
49.71 days).
</p>
<p>
This parameter is overridden when performing an initial
start or initial restart of the cluster.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-startfailuretimeout">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-startfailuretimeout">
<code class="literal">
StartFailureTimeout
</code>
</a>
</p>
<a class="indexterm" name="idm46045117829504">
</a>
<div class="informaltable">
<a name="startfailuretimeout-ndbd-table">
</a>
<table frame="box" rules="all" summary="StartFailureTimeout data node 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>
milliseconds
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
0
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
0 - 4294967039 (0xFFFFFEFF)
</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>
If a data node has not completed its startup sequence within
the time specified by this parameter, the node startup
fails. Setting this parameter to 0 (the default value) means
that no data node timeout is applied.
</p>
<p>
For nonzero values, this parameter is measured in
milliseconds. For data nodes containing extremely large
amounts of data, this parameter should be increased. For
example, in the case of a data node containing several
gigabytes of data, a period as long as 10−15 minutes
(that is, 600000 to 1000000 milliseconds) might be required
to perform a node restart.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-startnonodegrouptimeout">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-startnonodegrouptimeout">
<code class="literal">
StartNoNodeGroupTimeout
</code>
</a>
</p>
<a class="indexterm" name="idm46045117807616">
</a>
<div class="informaltable">
<a name="startnonodegrouptimeout-ndbd-table">
</a>
<table frame="box" rules="all" summary="StartNoNodeGroupTimeout data node 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>
milliseconds
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
15000
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
0 - 4294967039 (0xFFFFFEFF)
</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>
When a data node is configured with
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-nodegroup">
<code class="literal">
Nodegroup = 65536
</code>
</a>
,
is regarded as not being assigned to any node group. When
that is done, the cluster waits
<code class="literal">
StartNoNodegroupTimeout
</code>
milliseconds,
then treats such nodes as though they had been added to the
list passed to the
<a class="link" href="mysql-cluster-programs-ndbd.html#option_ndbd_nowait-nodes">
<code class="option">
--nowait-nodes
</code>
</a>
option, and
starts. The default value is
<code class="literal">
15000
</code>
(that
is, the management server waits 15 seconds). Setting this
parameter equal to
<code class="literal">
0
</code>
means that the
cluster waits indefinitely.
</p>
<p>
<code class="literal">
StartNoNodegroupTimeout
</code>
must be the same
for all data nodes in the cluster; for this reason, you
should always set it in the
<code class="literal">
[ndbd
default]
</code>
section of the
<code class="filename">
config.ini
</code>
file, rather than for
individual data nodes.
</p>
<p>
See
<a class="xref" href="mysql-cluster-online-add-node.html" title="25.6.7 Adding NDB Cluster Data Nodes Online">
Section 25.6.7, “Adding NDB Cluster Data Nodes Online”
</a>
, for
more information.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-heartbeatintervaldbdb">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-heartbeatintervaldbdb">
<code class="literal">
HeartbeatIntervalDbDb
</code>
</a>
</p>
<a class="indexterm" name="idm46045117778448">
</a>
<div class="informaltable">
<a name="heartbeatintervaldbdb-ndbd-table">
</a>
<table frame="box" rules="all" summary="HeartbeatIntervalDbDb data node 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>
milliseconds
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
5000
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
10 - 4294967039 (0xFFFFFEFF)
</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>
One of the primary methods of discovering failed nodes is by
the use of heartbeats. This parameter states how often
heartbeat signals are sent and how often to expect to
receive them. Heartbeats cannot be disabled.
</p>
<p>
After missing four heartbeat intervals in a row, the node is
declared dead. Thus, the maximum time for discovering a
failure through the heartbeat mechanism is five times the
heartbeat interval.
</p>
<p>
The default heartbeat interval is 5000 milliseconds (5
seconds). This parameter must not be changed drastically and
should not vary widely between nodes. If one node uses 5000
milliseconds and the node watching it uses 1000
milliseconds, obviously the node is declared dead very
quickly. This parameter can be changed during an online
software upgrade, but only in small increments.
</p>
<p>
See also
<a class="xref" href="mysql-cluster-overview-requirements.html#mysql-cluster-network-latency-issues" title="Network communication and latency">
Network communication and latency
</a>
, as
well as the description of the
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-connectcheckintervaldelay">
<code class="literal">
ConnectCheckIntervalDelay
</code>
</a>
configuration parameter.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-heartbeatintervaldbapi">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-heartbeatintervaldbapi">
<code class="literal">
HeartbeatIntervalDbApi
</code>
</a>
</p>
<a class="indexterm" name="idm46045117753680">
</a>
<div class="informaltable">
<a name="heartbeatintervaldbapi-ndbd-table">
</a>
<table frame="box" rules="all" summary="HeartbeatIntervalDbApi data node 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>
milliseconds
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
1500
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
100 - 4294967039 (0xFFFFFEFF)
</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>
Each data node sends heartbeat signals to each MySQL server
(SQL node) to ensure that it remains in contact. If a MySQL
server fails to send a heartbeat in time it is declared
<span class="quote">
“
<span class="quote">
dead,
</span>
”
</span>
in which case all ongoing transactions
are completed and all resources released. The SQL node
cannot reconnect until all activities initiated by the
previous MySQL instance have been completed. The
three-heartbeat criteria for this determination are the same
as described for
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-heartbeatintervaldbdb">
<code class="literal">
HeartbeatIntervalDbDb
</code>
</a>
.
</p>
<p>
The default interval is 1500 milliseconds (1.5 seconds).
This interval can vary between individual data nodes because
each data node watches the MySQL servers connected to it,
independently of all other data nodes.
</p>
<p>
For more information, see
<a class="xref" href="mysql-cluster-overview-requirements.html#mysql-cluster-network-latency-issues" title="Network communication and latency">
Network communication and latency
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-heartbeatorder">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-heartbeatorder">
<code class="literal">
HeartbeatOrder
</code>
</a>
</p>
<a class="indexterm" name="idm46045117729248">
</a>
<div class="informaltable">
<a name="heartbeatorder-ndbd-table">
</a>
<table frame="box" rules="all" summary="HeartbeatOrder data node 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>
numeric
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
0
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
0 - 65535
</td>
</tr>
<tr>
<th>
Restart Type
</th>
<td>
<p>
<span class="bold">
<strong>
System Restart:
</strong>
</span>
Requires a complete shutdown and restart
of the cluster. (NDB 8.4.0)
</p>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Data nodes send heartbeats to one another in a circular
fashion whereby each data node monitors the previous one. If
a heartbeat is not detected by a given data node, this node
declares the previous data node in the circle
<span class="quote">
“
<span class="quote">
dead
</span>
”
</span>
(that is, no longer accessible by the
cluster). The determination that a data node is dead is done
globally; in other words; once a data node is declared dead,
it is regarded as such by all nodes in the cluster.
</p>
<p>
It is possible for heartbeats between data nodes residing on
different hosts to be too slow compared to heartbeats
between other pairs of nodes (for example, due to a very low
heartbeat interval or temporary connection problem), such
that a data node is declared dead, even though the node can
still function as part of the cluster. .
</p>
<p>
In this type of situation, it may be that the order in which
heartbeats are transmitted between data nodes makes a
difference as to whether or not a particular data node is
declared dead. If this declaration occurs unnecessarily,
this can in turn lead to the unnecessary loss of a node
group and as thus to a failure of the cluster.
</p>
<p>
Consider a setup where there are 4 data nodes A, B, C, and D
running on 2 host computers
<code class="literal">
host1
</code>
and
<code class="literal">
host2
</code>
, and that these data nodes make up
2 node groups, as shown in the following table:
</p>
<div class="table">
<a name="idm46045117707168">
</a>
<p class="title">
<b>
Table 25.9 Four data nodes A, B, C, D running on two host computers
host1, host2; each data node belongs to one of two node
groups.
</b>
</p>
<div class="table-contents">
<table>
<colgroup>
<col style="width: 33%"/>
<col style="width: 34%"/>
<col style="width: 33%"/>
</colgroup>
<thead>
<tr>
<th scope="col">
Node Group
</th>
<th scope="col">
Nodes Running on
<code class="literal">
host1
</code>
</th>
<th scope="col">
Nodes Running on
<code class="literal">
host2
</code>
</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">
Node Group 0:
</th>
<td>
Node A
</td>
<td>
Node B
</td>
</tr>
<tr>
<th scope="row">
Node Group 1:
</th>
<td>
Node C
</td>
<td>
Node D
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br class="table-break"/>
<p>
Suppose the heartbeats are transmitted in the order
A->B->C->D->A. In this case, the loss of the
heartbeat between the hosts causes node B to declare node A
dead and node C to declare node B dead. This results in loss
of Node Group 0, and so the cluster fails. On the other
hand, if the order of transmission is
A->B->D->C->A (and all other conditions remain
as previously stated), the loss of the heartbeat causes
nodes A and D to be declared dead; in this case, each node
group has one surviving node, and the cluster survives.
</p>
<p>
The
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-heartbeatorder">
<code class="literal">
HeartbeatOrder
</code>
</a>
configuration parameter makes the order of heartbeat
transmission user-configurable. The default value for
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-heartbeatorder">
<code class="literal">
HeartbeatOrder
</code>
</a>
is
zero; allowing the default value to be used on all data
nodes causes the order of heartbeat transmission to be
determined by
<code class="literal">
NDB
</code>
. If this parameter is
used, it must be set to a nonzero value (maximum 65535) for
every data node in the cluster, and this value must be
unique for each data node; this causes the heartbeat
transmission to proceed from data node to data node in the
order of their
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-heartbeatorder">
<code class="literal">
HeartbeatOrder
</code>
</a>
values from lowest to highest (and then directly from the
data node having the highest
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-heartbeatorder">
<code class="literal">
HeartbeatOrder
</code>
</a>
to
the data node having the lowest value, to complete the
circle). The values need not be consecutive. For example, to
force the heartbeat transmission order
A->B->D->C->A in the scenario outlined
previously, you could set the
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-heartbeatorder">
<code class="literal">
HeartbeatOrder
</code>
</a>
values as shown here:
</p>
<div class="table">
<a name="idm46045117681664">
</a>
<p class="title">
<b>
Table 25.10 HeartbeatOrder values to force a heartbeat transition order of
A->B->D->C->A.
</b>
</p>
<div class="table-contents">
<table>
<colgroup>
<col style="width: 50%"/>
<col style="width: 50%"/>
</colgroup>
<thead>
<tr>
<th>
Node
</th>
<th>
<code class="literal">
HeartbeatOrder
</code>
Value
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
A
</td>
<td>
10
</td>
</tr>
<tr>
<td>
B
</td>
<td>
20
</td>
</tr>
<tr>
<td>
C
</td>
<td>
30
</td>
</tr>
<tr>
<td>
D
</td>
<td>
25
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br class="table-break"/>
<p>
To use this parameter to change the heartbeat transmission
order in a running NDB Cluster, you must first set
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-heartbeatorder">
<code class="literal">
HeartbeatOrder
</code>
</a>
for
each data node in the cluster in the global configuration
(
<code class="filename">
config.ini
</code>
) file (or files). To cause
the change to take effect, you must perform either of the
following:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
A complete shutdown and restart of the entire cluster.
</p>
</li>
<li class="listitem">
<p>
2 rolling restarts of the cluster in succession.
<span class="emphasis">
<em>
All nodes must be restarted in the same order
in both rolling restarts
</em>
</span>
.
</p>
</li>
</ul>
</div>
<p>
You can use
<a class="ulink" href="/doc/ndb-internals/en/dump-command-908.html" target="_top">
<code class="literal">
DUMP 908
</code>
</a>
to
observe the effect of this parameter in the data node logs.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-connectcheckintervaldelay">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-connectcheckintervaldelay">
<code class="literal">
ConnectCheckIntervalDelay
</code>
</a>
</p>
<a class="indexterm" name="idm46045117657792">
</a>
<div class="informaltable">
<a name="connectcheckintervaldelay-ndbd-table">
</a>
<table frame="box" rules="all" summary="ConnectCheckIntervalDelay data node 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>
milliseconds
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
0
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
0 - 4294967039 (0xFFFFFEFF)
</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 parameter enables connection checking between data
nodes after one of them has failed heartbeat checks for 5
intervals of up to
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-heartbeatintervaldbdb">
<code class="literal">
HeartbeatIntervalDbDb
</code>
</a>
milliseconds.
</p>
<p>
Such a data node that further fails to respond within an
interval of
<code class="literal">
ConnectCheckIntervalDelay
</code>
milliseconds is considered suspect, and is considered dead
after two such intervals. This can be useful in setups with
known latency issues.
</p>
<p>
The default value for this parameter is 0 (disabled).
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-timebetweenlocalcheckpoints">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-timebetweenlocalcheckpoints">
<code class="literal">
TimeBetweenLocalCheckpoints
</code>
</a>
</p>
<a class="indexterm" name="idm46045117633984">
</a>
<div class="informaltable">
<a name="timebetweenlocalcheckpoints-ndbd-table">
</a>
<table frame="box" rules="all" summary="TimeBetweenLocalCheckpoints data node 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>
number of 4-byte words, as base-2 logarithm
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
20
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
0 - 31
</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 parameter is an exception in that it does not specify a
time to wait before starting a new local checkpoint; rather,
it is used to ensure that local checkpoints are not
performed in a cluster where relatively few updates are
taking place. In most clusters with high update rates, it is
likely that a new local checkpoint is started immediately
after the previous one has been completed.
</p>
<p>
The size of all write operations executed since the start of
the previous local checkpoints is added. This parameter is
also exceptional in that it is specified as the base-2
logarithm of the number of 4-byte words, so that the default
value 20 means 4MB (4 ×
2
<sup>
20
</sup>
) of write operations, 21
would mean 8MB, and so on up to a maximum value of 31, which
equates to 8GB of write operations.
</p>
<p>
All the write operations in the cluster are added together.
Setting
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-timebetweenlocalcheckpoints">
<code class="literal">
TimeBetweenLocalCheckpoints
</code>
</a>
to 6 or less means that local checkpoints are executed
continuously without pause, independent of the cluster's
workload.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-timebetweenglobalcheckpoints">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-timebetweenglobalcheckpoints">
<code class="literal">
TimeBetweenGlobalCheckpoints
</code>
</a>
</p>
<a class="indexterm" name="idm46045117609488">
</a>
<div class="informaltable">
<a name="timebetweenglobalcheckpoints-ndbd-table">
</a>
<table frame="box" rules="all" summary="TimeBetweenGlobalCheckpoints data node 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>
milliseconds
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
2000
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
20 - 32000
</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>
When a transaction is committed, it is committed in main
memory in all nodes on which the data is mirrored. However,
transaction log records are not flushed to disk as part of
the commit. The reasoning behind this behavior is that
having the transaction safely committed on at least two
autonomous host machines should meet reasonable standards
for durability.
</p>
<p>
It is also important to ensure that even the worst of
cases—a complete crash of the cluster—is handled
properly. To guarantee that this happens, all transactions
taking place within a given interval are put into a global
checkpoint, which can be thought of as a set of committed
transactions that has been flushed to disk. In other words,
as part of the commit process, a transaction is placed in a
global checkpoint group. Later, this group's log
records are flushed to disk, and then the entire group of
transactions is safely committed to disk on all computers in
the cluster.
</p>
<p>
We recommended when you are using solid-state disks
(especially those employing NVMe) with Disk Data tables that
you reduce this value. In such cases, you should also ensure
that
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxdiskdatalatency">
<code class="literal">
MaxDiskDataLatency
</code>
</a>
is set to a proper level.
</p>
<p>
This parameter defines the interval between global
checkpoints. The default is 2000 milliseconds.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-timebetweenglobalcheckpointstimeout">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-timebetweenglobalcheckpointstimeout">
<code class="literal">
TimeBetweenGlobalCheckpointsTimeout
</code>
</a>
</p>
<a class="indexterm" name="idm46045117584960">
</a>
<div class="informaltable">
<a name="timebetweenglobalcheckpointstimeout-ndbd-table">
</a>
<table frame="box" rules="all" summary="TimeBetweenGlobalCheckpointsTimeout data node 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>
milliseconds
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
120000
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
10 - 4294967039 (0xFFFFFEFF)
</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 parameter defines the minimum timeout between global
checkpoints. The default is 120000 milliseconds.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-timebetweenepochs">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-timebetweenepochs">
<code class="literal">
TimeBetweenEpochs
</code>
</a>
</p>
<a class="indexterm" name="idm46045117564368">
</a>
<div class="informaltable">
<a name="timebetweenepochs-ndbd-table">
</a>
<table frame="box" rules="all" summary="TimeBetweenEpochs data node 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>
milliseconds
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
100
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
0 - 32000
</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 parameter defines the interval between synchronization
epochs for NDB Cluster Replication. The default value is 100
milliseconds.
</p>
<p>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-timebetweenepochs">
<code class="literal">
TimeBetweenEpochs
</code>
</a>
is
part of the implementation of
<span class="quote">
“
<span class="quote">
micro-GCPs
</span>
”
</span>
,
which can be used to improve the performance of NDB Cluster
Replication.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-timebetweenepochstimeout">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-timebetweenepochstimeout">
<code class="literal">
TimeBetweenEpochsTimeout
</code>
</a>
</p>
<a class="indexterm" name="idm46045117541648">
</a>
<div class="informaltable">
<a name="timebetweenepochstimeout-ndbd-table">
</a>
<table frame="box" rules="all" summary="TimeBetweenEpochsTimeout data node 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>
milliseconds
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
0
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
0 - 256000
</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 parameter defines a timeout for synchronization epochs
for NDB Cluster Replication. If a node fails to participate
in a global checkpoint within the time determined by this
parameter, the node is shut down. The default value is 0; in
other words, the timeout is disabled.
</p>
<p>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-timebetweenepochstimeout">
<code class="literal">
TimeBetweenEpochsTimeout
</code>
</a>
is part of the implementation of
<span class="quote">
“
<span class="quote">
micro-GCPs
</span>
”
</span>
,
which can be used to improve the performance of NDB Cluster
Replication.
</p>
<p>
The current value of this parameter and a warning are
written to the cluster log whenever a GCP save takes longer
than 1 minute or a GCP commit takes longer than 10 seconds.
</p>
<p>
Setting this parameter to zero has the effect of disabling
GCP stops caused by save timeouts, commit timeouts, or both.
The maximum possible value for this parameter is 256000
milliseconds.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-maxbufferedepochs">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxbufferedepochs">
<code class="literal">
MaxBufferedEpochs
</code>
</a>
</p>
<a class="indexterm" name="idm46045117517360">
</a>
<div class="informaltable">
<a name="maxbufferedepochs-ndbd-table">
</a>
<table frame="box" rules="all" summary="MaxBufferedEpochs data node 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>
epochs
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
100
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
0 - 100000
</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>
The number of unprocessed epochs by which a subscribing node
can lag behind. Exceeding this number causes a lagging
subscriber to be disconnected.
</p>
<p>
The default value of 100 is sufficient for most normal
operations. If a subscribing node does lag enough to cause
disconnections, it is usually due to network or scheduling
issues with regard to processes or threads. (In rare
circumstances, the problem may be due to a bug in the
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
client.) It may be
desirable to set the value lower than the default when
epochs are longer.
</p>
<p>
Disconnection prevents client issues from affecting the data
node service, running out of memory to buffer data, and
eventually shutting down. Instead, only the client is
affected as a result of the disconnect (by, for example gap
events in the binary log), forcing the client to reconnect
or restart the process.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-maxbufferedepochbytes">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxbufferedepochbytes">
<code class="literal">
MaxBufferedEpochBytes
</code>
</a>
</p>
<a class="indexterm" name="idm46045117493952">
</a>
<div class="informaltable">
<a name="maxbufferedepochbytes-ndbd-table">
</a>
<table frame="box" rules="all" summary="MaxBufferedEpochBytes data node 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>
bytes
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
26214400
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
26214400 (0x01900000) - 4294967039 (0xFFFFFEFF)
</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>
The total number of bytes allocated for buffering epochs by
this node.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-timebetweeninactivetransactionabortcheck">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-timebetweeninactivetransactionabortcheck">
<code class="literal">
TimeBetweenInactiveTransactionAbortCheck
</code>
</a>
</p>
<a class="indexterm" name="idm46045117473440">
</a>
<div class="informaltable">
<a name="timebetweeninactivetransactionabortcheck-ndbd-table">
</a>
<table frame="box" rules="all" summary="TimeBetweenInactiveTransactionAbortCheck data node 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>
milliseconds
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
1000
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
1000 - 4294967039 (0xFFFFFEFF)
</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>
Timeout handling is performed by checking a timer on each
transaction once for every interval specified by this
parameter. Thus, if this parameter is set to 1000
milliseconds, every transaction is checked for timing out
once per second.
</p>
<p>
The default value is 1000 milliseconds (1 second).
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-transactioninactivetimeout">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-transactioninactivetimeout">
<code class="literal">
TransactionInactiveTimeout
</code>
</a>
</p>
<a class="indexterm" name="idm46045117452032">
</a>
<div class="informaltable">
<a name="transactioninactivetimeout-ndbd-table">
</a>
<table frame="box" rules="all" summary="TransactionInactiveTimeout data node 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>
milliseconds
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
4294967039 (0xFFFFFEFF)
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
0 - 4294967039 (0xFFFFFEFF)
</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 parameter states the maximum time that is permitted to
lapse between operations in the same transaction before the
transaction is aborted.
</p>
<p>
The default for this parameter is
<code class="literal">
4G
</code>
(also the maximum). For a real-time database that needs to
ensure that no transaction keeps locks for too long, this
parameter should be set to a relatively small value. Setting
it to 0 means that the application never times out. The unit
is milliseconds.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-transactiondeadlockdetectiontimeout">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-transactiondeadlockdetectiontimeout">
<code class="literal">
TransactionDeadlockDetectionTimeout
</code>
</a>
</p>
<a class="indexterm" name="idm46045117429792">
</a>
<div class="informaltable">
<a name="transactiondeadlockdetectiontimeout-ndbd-table">
</a>
<table frame="box" rules="all" summary="TransactionDeadlockDetectionTimeout data node 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>
milliseconds
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
1200
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
50 - 4294967039 (0xFFFFFEFF)
</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>
When a node executes a query involving a transaction, the
node waits for the other nodes in the cluster to respond
before continuing. This parameter sets the amount of time
that the transaction can spend executing within a data node,
that is, the time that the transaction coordinator waits for
each data node participating in the transaction to execute a
request.
</p>
<p>
A failure to respond can occur for any of the following
reasons:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
The node is
<span class="quote">
“
<span class="quote">
dead
</span>
”
</span>
</p>
</li>
<li class="listitem">
<p>
The operation has entered a lock queue
</p>
</li>
<li class="listitem">
<p>
The node requested to perform the action could be
heavily overloaded.
</p>
</li>
</ul>
</div>
<p>
This timeout parameter states how long the transaction
coordinator waits for query execution by another node before
aborting the transaction, and is important for both node
failure handling and deadlock detection.
</p>
<p>
The default timeout value is 1200 milliseconds (1.2
seconds).
</p>
<p>
The minimum for this parameter is 50 milliseconds.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-disksyncsize">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-disksyncsize">
<code class="literal">
DiskSyncSize
</code>
</a>
</p>
<a class="indexterm" name="idm46045117403376">
</a>
<div class="informaltable">
<a name="disksyncsize-ndbd-table">
</a>
<table frame="box" rules="all" summary="DiskSyncSize data node 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>
bytes
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
4M
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
32K - 4294967039 (0xFFFFFEFF)
</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 maximum number of bytes to store before flushing
data to a local checkpoint file. This is done to prevent
write buffering, which can impede performance significantly.
This parameter is
<span class="emphasis">
<em>
not
</em>
</span>
intended to take
the place of
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-timebetweenlocalcheckpoints">
<code class="literal">
TimeBetweenLocalCheckpoints
</code>
</a>
.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
When
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-odirect">
<code class="literal">
ODirect
</code>
</a>
is
enabled, it is not necessary to set
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-disksyncsize">
<code class="literal">
DiskSyncSize
</code>
</a>
; in
fact, in such cases its value is simply ignored.
</p>
</div>
<p>
The default value is 4M (4 megabytes).
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-maxdiskwritespeed">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxdiskwritespeed">
<code class="literal">
MaxDiskWriteSpeed
</code>
</a>
</p>
<a class="indexterm" name="idm46045117377232">
</a>
<div class="informaltable">
<a name="maxdiskwritespeed-ndbd-table">
</a>
<table frame="box" rules="all" summary="MaxDiskWriteSpeed data node 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>
numeric
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
20M
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
1M - 1024G
</td>
</tr>
<tr>
<th>
Restart Type
</th>
<td>
<p>
<span class="bold">
<strong>
System Restart:
</strong>
</span>
Requires a complete shutdown and restart
of the cluster. (NDB 8.4.0)
</p>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Set the maximum rate for writing to disk, in bytes per
second, by local checkpoints and backup operations when no
restarts (by this data node or any other data node) are
taking place in this NDB Cluster.
</p>
<p>
For setting the maximum rate of disk writes allowed while
this data node is restarting, use
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxdiskwritespeedownrestart">
<code class="literal">
MaxDiskWriteSpeedOwnRestart
</code>
</a>
.
For setting the maximum rate of disk writes allowed while
other data nodes are restarting, use
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxdiskwritespeedothernoderestart">
<code class="literal">
MaxDiskWriteSpeedOtherNodeRestart
</code>
</a>
.
The minimum speed for disk writes by all LCPs and backup
operations can be adjusted by setting
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-mindiskwritespeed">
<code class="literal">
MinDiskWriteSpeed
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-maxdiskwritespeedothernoderestart">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxdiskwritespeedothernoderestart">
<code class="literal">
MaxDiskWriteSpeedOtherNodeRestart
</code>
</a>
</p>
<a class="indexterm" name="idm46045117352736">
</a>
<div class="informaltable">
<a name="maxdiskwritespeedothernoderestart-ndbd-table">
</a>
<table frame="box" rules="all" summary="MaxDiskWriteSpeedOtherNodeRestart data node 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>
numeric
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
50M
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
1M - 1024G
</td>
</tr>
<tr>
<th>
Restart Type
</th>
<td>
<p>
<span class="bold">
<strong>
System Restart:
</strong>
</span>
Requires a complete shutdown and restart
of the cluster. (NDB 8.4.0)
</p>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Set the maximum rate for writing to disk, in bytes per
second, by local checkpoints and backup operations when one
or more data nodes in this NDB Cluster are restarting, other
than this node.
</p>
<p>
For setting the maximum rate of disk writes allowed while
this data node is restarting, use
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxdiskwritespeedownrestart">
<code class="literal">
MaxDiskWriteSpeedOwnRestart
</code>
</a>
.
For setting the maximum rate of disk writes allowed when no
data nodes are restarting anywhere in the cluster, use
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxdiskwritespeed">
<code class="literal">
MaxDiskWriteSpeed
</code>
</a>
.
The minimum speed for disk writes by all LCPs and backup
operations can be adjusted by setting
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-mindiskwritespeed">
<code class="literal">
MinDiskWriteSpeed
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-maxdiskwritespeedownrestart">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxdiskwritespeedownrestart">
<code class="literal">
MaxDiskWriteSpeedOwnRestart
</code>
</a>
</p>
<a class="indexterm" name="idm46045117328080">
</a>
<div class="informaltable">
<a name="maxdiskwritespeedownrestart-ndbd-table">
</a>
<table frame="box" rules="all" summary="MaxDiskWriteSpeedOwnRestart data node 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>
numeric
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
200M
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
1M - 1024G
</td>
</tr>
<tr>
<th>
Restart Type
</th>
<td>
<p>
<span class="bold">
<strong>
System Restart:
</strong>
</span>
Requires a complete shutdown and restart
of the cluster. (NDB 8.4.0)
</p>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Set the maximum rate for writing to disk, in bytes per
second, by local checkpoints and backup operations while
this data node is restarting.
</p>
<p>
For setting the maximum rate of disk writes allowed while
other data nodes are restarting, use
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxdiskwritespeedothernoderestart">
<code class="literal">
MaxDiskWriteSpeedOtherNodeRestart
</code>
</a>
.
For setting the maximum rate of disk writes allowed when no
data nodes are restarting anywhere in the cluster, use
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxdiskwritespeed">
<code class="literal">
MaxDiskWriteSpeed
</code>
</a>
.
The minimum speed for disk writes by all LCPs and backup
operations can be adjusted by setting
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-mindiskwritespeed">
<code class="literal">
MinDiskWriteSpeed
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-mindiskwritespeed">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-mindiskwritespeed">
<code class="literal">
MinDiskWriteSpeed
</code>
</a>
</p>
<a class="indexterm" name="idm46045117303632">
</a>
<div class="informaltable">
<a name="mindiskwritespeed-ndbd-table">
</a>
<table frame="box" rules="all" summary="MinDiskWriteSpeed data node 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>
numeric
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
10M
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
1M - 1024G
</td>
</tr>
<tr>
<th>
Restart Type
</th>
<td>
<p>
<span class="bold">
<strong>
System Restart:
</strong>
</span>
Requires a complete shutdown and restart
of the cluster. (NDB 8.4.0)
</p>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Set the minimum rate for writing to disk, in bytes per
second, by local checkpoints and backup operations.
</p>
<p>
The maximum rates of disk writes allowed for LCPs and
backups under various conditions are adjustable using the
parameters
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxdiskwritespeed">
<code class="literal">
MaxDiskWriteSpeed
</code>
</a>
,
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxdiskwritespeedownrestart">
<code class="literal">
MaxDiskWriteSpeedOwnRestart
</code>
</a>
,
and
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxdiskwritespeedothernoderestart">
<code class="literal">
MaxDiskWriteSpeedOtherNodeRestart
</code>
</a>
.
See the descriptions of these parameters for more
information.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-arbitrationtimeout">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-arbitrationtimeout">
<code class="literal">
ArbitrationTimeout
</code>
</a>
</p>
<a class="indexterm" name="idm46045117279472">
</a>
<div class="informaltable">
<a name="arbitrationtimeout-ndbd-table">
</a>
<table frame="box" rules="all" summary="ArbitrationTimeout data node 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>
milliseconds
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
7500
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
10 - 4294967039 (0xFFFFFEFF)
</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 parameter specifies how long data nodes wait for a
response from the arbitrator to an arbitration message. If
this is exceeded, the network is assumed to have split.
</p>
<p>
The default value is 7500 milliseconds (7.5 seconds).
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-arbitration">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-arbitration">
<code class="literal">
Arbitration
</code>
</a>
</p>
<a class="indexterm" name="idm46045117258368">
</a>
<div class="informaltable">
<a name="arbitration-ndbd-table">
</a>
<table frame="box" rules="all" summary="Arbitration data node 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>
enumeration
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
Default
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
Default, Disabled, WaitExternal
</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>
The
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-arbitration">
<code class="literal">
Arbitration
</code>
</a>
parameter enables a choice of arbitration schemes,
corresponding to one of 3 possible values for this
parameter:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<b>
Default.
</b>
This enables arbitration to proceed normally, as
determined by the
<code class="literal">
ArbitrationRank
</code>
settings for the management and API nodes. This is the
default value.
</p>
</li>
<li class="listitem">
<p>
<b>
Disabled.
</b>
Setting
<code class="literal">
Arbitration = Disabled
</code>
in
the
<code class="literal">
[ndbd default]
</code>
section of the
<code class="filename">
config.ini
</code>
file to accomplishes
the same task as setting
<code class="literal">
ArbitrationRank
</code>
to 0 on all
management and API nodes. When
<code class="literal">
Arbitration
</code>
is set in this way, any
<code class="literal">
ArbitrationRank
</code>
settings are
ignored.
</p>
</li>
<li class="listitem">
<p>
<b>
WaitExternal.
</b>
The
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-arbitration">
<code class="literal">
Arbitration
</code>
</a>
parameter also makes it possible to configure
arbitration in such a way that the cluster waits until
after the time determined by
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-arbitrationtimeout">
<code class="literal">
ArbitrationTimeout
</code>
</a>
has passed for an external cluster manager application
to perform arbitration instead of handling arbitration
internally. This can be done by setting
<code class="literal">
Arbitration = WaitExternal
</code>
in the
<code class="literal">
[ndbd default]
</code>
section of the
<code class="filename">
config.ini
</code>
file. For best results
with the
<code class="literal">
WaitExternal
</code>
setting, it
is recommended that
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-arbitrationtimeout">
<code class="literal">
ArbitrationTimeout
</code>
</a>
be 2 times as long as the interval required by the
external cluster manager to perform arbitration.
</p>
</li>
</ul>
</div>
<div class="important" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Important
</div>
<p>
This parameter should be used only in the
<code class="literal">
[ndbd
default]
</code>
section of the cluster configuration
file. The behavior of the cluster is unspecified when
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-arbitration">
<code class="literal">
Arbitration
</code>
</a>
is set
to different values for individual data nodes.
</p>
</div>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-restartsubscriberconnecttimeout">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-restartsubscriberconnecttimeout">
<code class="literal">
RestartSubscriberConnectTimeout
</code>
</a>
</p>
<a class="indexterm" name="idm46045117215456">
</a>
<div class="informaltable">
<a name="restartsubscriberconnecttimeout-ndbd-table">
</a>
<table frame="box" rules="all" summary="RestartSubscriberConnectTimeout data node 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>
ms
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
12000
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
0 - 4294967039 (0xFFFFFEFF)
</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 parameter determines the time that a data node waits
for subscribing API nodes to connect. Once this timeout
expires, any
<span class="quote">
“
<span class="quote">
missing
</span>
”
</span>
API nodes are
disconnected from the cluster. To disable this timeout, set
<code class="literal">
RestartSubscriberConnectTimeout
</code>
to 0.
</p>
<p>
While this parameter is specified in milliseconds, the
timeout itself is resolved to the next-greatest whole
second.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-keepalivesendinterval">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-keepalivesendinterval">
<code class="literal">
KeepAliveSendInterval
</code>
</a>
</p>
<a class="indexterm" name="idm46045117193056">
</a>
<div class="informaltable">
<a name="keepalivesendinterval-ndbd-table">
</a>
<table frame="box" rules="all" summary="KeepAliveSendInterval data node 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>
integer
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
60000
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
0 - 4294967039 (0xFFFFFEFF)
</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>
You can enable and control the interval between keep-alive
signals sent between data nodes by setting this parameter.
The default for
<code class="literal">
KeepAliveSendInterval
</code>
is
60000 milliseconds (one minute); setting it to 0 disables
keep-alive signals. Values between 1 and 10 inclusive are
treated as 10.
</p>
<p>
This parameter may prove useful in environments which
monitor and disconnect idle TCP connections, possibly
causing unnecessary data node failures when the cluster is
idle.
</p>
</li>
</ul>
</div>
<p>
The heartbeat interval between management nodes and data nodes
is always 100 milliseconds, and is not configurable.
</p>
<p>
<a name="mysql-cluster-buffering-and-logging">
</a>
<b>
Buffering and logging.
</b>
Several
<code class="literal">
[ndbd]
</code>
configuration parameters
enable the advanced user to have more control over the
resources used by node processes and to adjust various buffer
sizes at need.
</p>
<p>
These buffers are used as front ends to the file system when
writing log records to disk. If the node is running in diskless
mode, these parameters can be set to their minimum values
without penalty due to the fact that disk writes are
<span class="quote">
“
<span class="quote">
faked
</span>
”
</span>
by the
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
storage engine's file system abstraction layer.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a name="ndbparam-ndbd-undoindexbuffer">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-undoindexbuffer">
<code class="literal">
UndoIndexBuffer
</code>
</a>
</p>
<a class="indexterm" name="idm46045117165168">
</a>
<div class="informaltable">
<a name="undoindexbuffer-ndbd-table">
</a>
<table frame="box" rules="all" summary="UndoIndexBuffer data node 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>
unsigned
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
2M
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
1M - 4294967039 (0xFFFFFEFF)
</td>
</tr>
<tr>
<th>
Deprecated
</th>
<td>
Yes (in NDB 8.0)
</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 parameter formerly set the size of the undo index
buffer, but has no effect in current versions of NDB
Cluster.
</p>
<p>
Use of this parameter in the cluster configuration file
raises a deprecation warning; you should expect it to be
removed in a future NDB Cluster release.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-undodatabuffer">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-undodatabuffer">
<code class="literal">
UndoDataBuffer
</code>
</a>
</p>
<a class="indexterm" name="idm46045117141872">
</a>
<div class="informaltable">
<a name="undodatabuffer-ndbd-table">
</a>
<table frame="box" rules="all" summary="UndoDataBuffer data node 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>
unsigned
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
16M
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
1M - 4294967039 (0xFFFFFEFF)
</td>
</tr>
<tr>
<th>
Deprecated
</th>
<td>
Yes (in NDB 8.0)
</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 parameter formerly set the size of the undo data
buffer, but has no effect in current versions of NDB
Cluster.
</p>
<p>
Use of this parameter in the cluster configuration file
raises a deprecation warning; you should expect it to be
removed in a future NDB Cluster release.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-redobuffer">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-redobuffer">
<code class="literal">
RedoBuffer
</code>
</a>
</p>
<a class="indexterm" name="idm46045117118560">
</a>
<div class="informaltable">
<a name="redobuffer-ndbd-table">
</a>
<table frame="box" rules="all" summary="RedoBuffer data node 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>
bytes
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
32M
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
1M - 4294967039 (0xFFFFFEFF)
</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>
All update activities also need to be logged. The REDO log
makes it possible to replay these updates whenever the
system is restarted. The NDB recovery algorithm uses a
<span class="quote">
“
<span class="quote">
fuzzy
</span>
”
</span>
checkpoint of the data together with
the UNDO log, and then applies the REDO log to play back all
changes up to the restoration point.
</p>
<p>
<code class="literal">
RedoBuffer
</code>
sets the size of the buffer in
which the REDO log is written. The default value is 32MB;
the minimum value is 1MB.
</p>
<p>
If this buffer is too small, the
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
storage engine issues error
code 1221 (
<span class="errortext">
REDO log buffers
overloaded
</span>
). For this reason, you should
exercise care if you attempt to decrease the value of
<code class="literal">
RedoBuffer
</code>
as part of an online change in
the cluster's configuration.
</p>
<p>
<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
</strong>
</span>
</a>
allocates a separate buffer for
each LDM thread (see
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbmtd-threadconfig">
<code class="literal">
ThreadConfig
</code>
</a>
). For
example, with 4 LDM threads, an
<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
</strong>
</span>
</a>
data node actually has 4 buffers and allocates
<code class="literal">
RedoBuffer
</code>
bytes to each one, for a total
of
<code class="literal">
4 * RedoBuffer
</code>
bytes.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-eventlogbuffersize">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-eventlogbuffersize">
<code class="literal">
EventLogBufferSize
</code>
</a>
</p>
<a class="indexterm" name="idm46045117087440">
</a>
<div class="informaltable">
<a name="eventlogbuffersize-ndbd-table">
</a>
<table frame="box" rules="all" summary="EventLogBufferSize data node 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>
bytes
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
8192
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
0 - 64K
</td>
</tr>
<tr>
<th>
Restart Type
</th>
<td>
<p>
<span class="bold">
<strong>
System Restart:
</strong>
</span>
Requires a complete shutdown and restart
of the cluster. (NDB 8.4.0)
</p>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Controls the size of the circular buffer used for NDB log
events within data nodes.
</p>
</li>
</ul>
</div>
<p>
<a name="mysql-cluster-controlling-log-messages">
</a>
<b>
Controlling log messages.
</b>
In managing the cluster, it is very important to be able to
control the number of log messages sent for various event
types to
<code class="literal">
stdout
</code>
. For each event category,
there are 16 possible event levels (numbered 0 through 15).
Setting event reporting for a given event category to level 15
means all event reports in that category are sent to
<code class="literal">
stdout
</code>
; setting it to 0 means that no event
reports in that category are made.
</p>
<p>
By default, only the startup message is sent to
<code class="literal">
stdout
</code>
, with the remaining event reporting
level defaults being set to 0. The reason for this is that these
messages are also sent to the management server's cluster log.
</p>
<p>
An analogous set of levels can be set for the management client
to determine which event levels to record in the cluster log.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a name="ndbparam-ndbd-loglevelstartup">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-loglevelstartup">
<code class="literal">
LogLevelStartup
</code>
</a>
</p>
<a class="indexterm" name="idm46045117061968">
</a>
<div class="informaltable">
<a name="loglevelstartup-ndbd-table">
</a>
<table frame="box" rules="all" summary="LogLevelStartup data node 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>
integer
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
1
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
0 - 15
</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>
The reporting level for events generated during startup of
the process.
</p>
<p>
The default level is 1.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-loglevelshutdown">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-loglevelshutdown">
<code class="literal">
LogLevelShutdown
</code>
</a>
</p>
<a class="indexterm" name="idm46045117041056">
</a>
<div class="informaltable">
<a name="loglevelshutdown-ndbd-table">
</a>
<table frame="box" rules="all" summary="LogLevelShutdown data node 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>
integer
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
0
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
0 - 15
</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>
The reporting level for events generated as part of graceful
shutdown of a node.
</p>
<p>
The default level is 0.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-loglevelstatistic">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-loglevelstatistic">
<code class="literal">
LogLevelStatistic
</code>
</a>
</p>
<a class="indexterm" name="idm46045117020208">
</a>
<div class="informaltable">
<a name="loglevelstatistic-ndbd-table">
</a>
<table frame="box" rules="all" summary="LogLevelStatistic data node 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>
integer
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
0
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
0 - 15
</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>
The reporting level for statistical events such as number of
primary key reads, number of updates, number of inserts,
information relating to buffer usage, and so on.
</p>
<p>
The default level is 0.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-loglevelcheckpoint">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-loglevelcheckpoint">
<code class="literal">
LogLevelCheckpoint
</code>
</a>
</p>
<a class="indexterm" name="idm46045116999200">
</a>
<div class="informaltable">
<a name="loglevelcheckpoint-ndbd-table">
</a>
<table frame="box" rules="all" summary="LogLevelCheckpoint data node 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>
log level
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
0
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
0 - 15
</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>
The reporting level for events generated by local and global
checkpoints.
</p>
<p>
The default level is 0.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-loglevelnoderestart">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-loglevelnoderestart">
<code class="literal">
LogLevelNodeRestart
</code>
</a>
</p>
<a class="indexterm" name="idm46045116978352">
</a>
<div class="informaltable">
<a name="loglevelnoderestart-ndbd-table">
</a>
<table frame="box" rules="all" summary="LogLevelNodeRestart data node 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>
integer
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
0
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
0 - 15
</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>
The reporting level for events generated during node
restart.
</p>
<p>
The default level is 0.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-loglevelconnection">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-loglevelconnection">
<code class="literal">
LogLevelConnection
</code>
</a>
</p>
<a class="indexterm" name="idm46045116957520">
</a>
<div class="informaltable">
<a name="loglevelconnection-ndbd-table">
</a>
<table frame="box" rules="all" summary="LogLevelConnection data node 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>
integer
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
0
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
0 - 15
</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>
The reporting level for events generated by connections
between cluster nodes.
</p>
<p>
The default level is 0.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-loglevelerror">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-loglevelerror">
<code class="literal">
LogLevelError
</code>
</a>
</p>
<a class="indexterm" name="idm46045116936608">
</a>
<div class="informaltable">
<a name="loglevelerror-ndbd-table">
</a>
<table frame="box" rules="all" summary="LogLevelError data node 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>
integer
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
0
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
0 - 15
</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>
The reporting level for events generated by errors and
warnings by the cluster as a whole. These errors do not
cause any node failure but are still considered worth
reporting.
</p>
<p>
The default level is 0.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-loglevelcongestion">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-loglevelcongestion">
<code class="literal">
LogLevelCongestion
</code>
</a>
</p>
<a class="indexterm" name="idm46045116915504">
</a>
<div class="informaltable">
<a name="loglevelcongestion-ndbd-table">
</a>
<table frame="box" rules="all" summary="LogLevelCongestion data node 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>
level
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
0
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
0 - 15
</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>
The reporting level for events generated by congestion.
These errors do not cause node failure but are still
considered worth reporting.
</p>
<p>
The default level is 0.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-loglevelinfo">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-loglevelinfo">
<code class="literal">
LogLevelInfo
</code>
</a>
</p>
<a class="indexterm" name="idm46045116894512">
</a>
<div class="informaltable">
<a name="loglevelinfo-ndbd-table">
</a>
<table frame="box" rules="all" summary="LogLevelInfo data node 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>
integer
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
0
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
0 - 15
</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>
The reporting level for events generated for information
about the general state of the cluster.
</p>
<p>
The default level is 0.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-memreportfrequency">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-memreportfrequency">
<code class="literal">
MemReportFrequency
</code>
</a>
</p>
<a class="indexterm" name="idm46045116873600">
</a>
<div class="informaltable">
<a name="memreportfrequency-ndbd-table">
</a>
<table frame="box" rules="all" summary="MemReportFrequency data node 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>
unsigned
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
0
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
0 - 4294967039 (0xFFFFFEFF)
</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 parameter controls how often data node memory usage
reports are recorded in the cluster log; it is an integer
value representing the number of seconds between reports.
</p>
<p>
Each data node's data memory and index memory usage is
logged as both a percentage and a number of 32 KB pages of
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-datamemory">
<code class="literal">
DataMemory
</code>
</a>
, as set
in the
<code class="filename">
config.ini
</code>
file. For example, if
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-datamemory">
<code class="literal">
DataMemory
</code>
</a>
is equal
to 100 MB, and a given data node is using 50 MB for data
memory storage, the corresponding line in the cluster log
might look like this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-simple"><div class="docs-select-all right" id="sa30069400"><div class="copy-help left">Press ⌘+C to 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">2006<span class="token operator">-</span>12<span class="token operator">-</span>24 01<span class="token operator">:</span>18<span class="token operator">:</span>16 <span class="token punctuation">[</span>MgmSrvr<span class="token punctuation">]</span> INFO <span class="token operator">--</span> Node 2<span class="token operator">:</span> Data usage is 50<span class="token operator">%</span><span class="token punctuation">(</span>1280 32K pages of total 2560<span class="token punctuation">)</span></code></pre>
</div>
<p>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-memreportfrequency">
<code class="literal">
MemReportFrequency
</code>
</a>
is not a required parameter. If used, it can be set for all
cluster data nodes in the
<code class="literal">
[ndbd default]
</code>
section of
<code class="filename">
config.ini
</code>
, and can also be
set or overridden for individual data nodes in the
corresponding
<code class="literal">
[ndbd]
</code>
sections of the
configuration file. The minimum value—which is also
the default value—is 0, in which case memory reports
are logged only when memory usage reaches certain
percentages (80%, 90%, and 100%), as mentioned in the
discussion of statistics events in
<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>
.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-startupstatusreportfrequency">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-startupstatusreportfrequency">
<code class="literal">
StartupStatusReportFrequency
</code>
</a>
</p>
<a class="indexterm" name="idm46045116842448">
</a>
<div class="informaltable">
<a name="startupstatusreportfrequency-ndbd-table">
</a>
<table frame="box" rules="all" summary="StartupStatusReportFrequency data node 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>
seconds
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
0
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
0 - 4294967039 (0xFFFFFEFF)
</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>
When a data node is started with the
<a class="link" href="mysql-cluster-programs-ndbd.html#option_ndbd_initial">
<code class="option">
--initial
</code>
</a>
, it initializes the
redo log file during Start Phase 4 (see
<a class="xref" href="mysql-cluster-start-phases.html" title="25.6.4 Summary of NDB Cluster Start Phases">
Section 25.6.4, “Summary of NDB Cluster Start Phases”
</a>
). When very
large values are set for
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-nooffragmentlogfiles">
<code class="literal">
NoOfFragmentLogFiles
</code>
</a>
,
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-fragmentlogfilesize">
<code class="literal">
FragmentLogFileSize
</code>
</a>
,
or both, this initialization can take a long time. You can
force reports on the progress of this process to be logged
periodically, by means of the
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-startupstatusreportfrequency">
<code class="literal">
StartupStatusReportFrequency
</code>
</a>
configuration parameter. In this case, progress is reported
in the cluster log, in terms of both the number of files and
the amount of space that have been initialized, as shown
here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-simple"><div class="docs-select-all right" id="sa59796922"><div class="copy-help left">Press ⌘+C to 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">2009<span class="token operator">-</span>06<span class="token operator">-</span>20 16<span class="token operator">:</span>39<span class="token operator">:</span>23 <span class="token punctuation">[</span>MgmSrvr<span class="token punctuation">]</span> INFO <span class="token operator">--</span> Node 1<span class="token operator">:</span> Local redo log file initialization status<span class="token operator">:</span>
<span class="token comment" spellcheck="true">#Total files: 80, Completed: 60</span>
<span class="token comment" spellcheck="true">#Total MBytes: 20480, Completed: 15557</span>
2009<span class="token operator">-</span>06<span class="token operator">-</span>20 16<span class="token operator">:</span>39<span class="token operator">:</span>23 <span class="token punctuation">[</span>MgmSrvr<span class="token punctuation">]</span> INFO <span class="token operator">--</span> Node 2<span class="token operator">:</span> Local redo log file initialization status<span class="token operator">:</span>
<span class="token comment" spellcheck="true">#Total files: 80, Completed: 60</span>
<span class="token comment" spellcheck="true">#Total MBytes: 20480, Completed: 15570</span></code></pre>
</div>
<p>
These reports are logged each
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-startupstatusreportfrequency">
<code class="literal">
StartupStatusReportFrequency
</code>
</a>
seconds during Start Phase 4. If
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-startupstatusreportfrequency">
<code class="literal">
StartupStatusReportFrequency
</code>
</a>
is 0 (the default), then reports are written to the cluster
log only when at the beginning and at the completion of the
redo log file initialization process.
</p>
</li>
</ul>
</div>
<h5>
<a name="mysql-cluster-data-node-debugging-parameters">
</a>
Data Node Debugging Parameters
</h5>
<p>
The following parameters are intended for use during testing or
debugging of data nodes, and not for use in production.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a name="ndbparam-ndbd-dicttrace">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-dicttrace">
<code class="literal">
DictTrace
</code>
</a>
</p>
<a class="indexterm" name="idm46045116809392">
</a>
<div class="informaltable">
<a name="dicttrace-ndbd-table">
</a>
<table frame="box" rules="all" summary="DictTrace data node 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>
bytes
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
undefined
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
0 - 100
</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>
It is possible to cause logging of traces for events
generated by creating and dropping tables using
<code class="literal">
DictTrace
</code>
. This parameter is useful only
in debugging NDB kernel code.
<code class="literal">
DictTrace
</code>
takes an integer value. 0 is the default, and means no
logging is performed; 1 enables trace logging, and 2 enables
logging of additional
<a class="ulink" href="/doc/ndb-internals/en/ndb-internals-kernel-blocks-dbdict.html" target="_top">
<code class="literal">
DBDICT
</code>
</a>
debugging output.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-watchdogimmediatekill">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-watchdogimmediatekill">
<code class="literal">
WatchdogImmediateKill
</code>
</a>
</p>
<a class="indexterm" name="idm46045116785984">
</a>
<div class="informaltable">
<a name="watchdogimmediatekill-ndbd-table">
</a>
<table frame="box" rules="all" summary="WatchDogImmediateKill data node 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>
boolean
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
false
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
true, false
</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>
You can cause threads to be killed immediately whenever
watchdog issues occur by enabling the
<code class="literal">
WatchdogImmediateKill
</code>
data node
configuration parameter. This parameter should be used only
when debugging or troubleshooting, to obtain trace files
reporting exactly what was occurring the instant that
execution ceased.
</p>
</li>
</ul>
</div>
<p>
<a name="mysql-cluster-backup-parameters">
</a>
<b>
Backup parameters.
</b>
The
<code class="literal">
[ndbd]
</code>
parameters discussed in this
section define memory buffers set aside for execution of
online backups.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a name="ndbparam-ndbd-backupdatabuffersize">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-backupdatabuffersize">
<code class="literal">
BackupDataBufferSize
</code>
</a>
</p>
<a class="indexterm" name="idm46045116761616">
</a>
<div class="informaltable">
<a name="backupdatabuffersize-ndbd-table">
</a>
<table frame="box" rules="all" summary="BackupDataBufferSize data node 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>
bytes
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
16M
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
512K - 4294967039 (0xFFFFFEFF)
</td>
</tr>
<tr>
<th>
Deprecated
</th>
<td>
Yes (in NDB 7.6)
</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>
In creating a backup, there are two buffers used for sending
data to the disk. The backup data buffer is used to fill in
data recorded by scanning a node's tables. Once this buffer
has been filled to the level specified as
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-backupwritesize">
<code class="literal">
BackupWriteSize
</code>
</a>
, the
pages are sent to disk. While flushing data to disk, the
backup process can continue filling this buffer until it
runs out of space. When this happens, the backup process
pauses the scan and waits until some disk writes have
completed freeing up memory so that scanning may continue.
</p>
<p>
The default value for this parameter is 16MB. The minimum is
512K.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-backupdiskwritespeedpct">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-backupdiskwritespeedpct">
<code class="literal">
BackupDiskWriteSpeedPct
</code>
</a>
</p>
<a class="indexterm" name="idm46045116736736">
</a>
<div class="informaltable">
<a name="backupdiskwritespeedpct-ndbd-table">
</a>
<table frame="box" rules="all" summary="BackupDiskWriteSpeedPct data node 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>
percent
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
50
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
0 - 90
</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>
<code class="literal">
BackupDiskWriteSpeedPct
</code>
applies only when
a backup is single-threaded; since NDB 8.4
supports multi-threaded backups, it is usually not necessary
to adjust this parameter, which has no effect in the
multi-threaded case. The discussion that follows is specific
to single-threaded backups.
</p>
<p>
During normal operation, data nodes attempt to maximize the
disk write speed used for local checkpoints and backups
while remaining within the bounds set by
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-mindiskwritespeed">
<code class="literal">
MinDiskWriteSpeed
</code>
</a>
and
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxdiskwritespeed">
<code class="literal">
MaxDiskWriteSpeed
</code>
</a>
.
Disk write throttling gives each LDM thread an equal share
of the total budget. This allows parallel LCPs to take place
without exceeding the disk I/O budget. Because a backup is
executed by only one LDM thread, this effectively caused a
budget cut, resulting in longer backup completion times,
and—if the rate of change is sufficiently
high—in failure to complete the backup when the backup
log buffer fill rate is higher than the achievable write
rate.
</p>
<p>
This problem can be addressed by using the
<code class="literal">
BackupDiskWriteSpeedPct
</code>
configuration
parameter, which takes a value in the range 0-90 (inclusive)
which is interpreted as the percentage of the node's
maximum write rate budget that is reserved prior to sharing
out the remainder of the budget among LDM threads for LCPs.
The LDM thread running the backup receives the whole write
rate budget for the backup, plus its (reduced) share of the
write rate budget for local checkpoints.
</p>
<p>
The default value for this parameter is 50 (interpreted as
50%).
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-backuplogbuffersize">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-backuplogbuffersize">
<code class="literal">
BackupLogBufferSize
</code>
</a>
</p>
<a class="indexterm" name="idm46045116708912">
</a>
<div class="informaltable">
<a name="backuplogbuffersize-ndbd-table">
</a>
<table frame="box" rules="all" summary="BackupLogBufferSize data node 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>
bytes
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
16M
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
2M - 4294967039 (0xFFFFFEFF)
</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>
The backup log buffer fulfills a role similar to that played
by the backup data buffer, except that it is used for
generating a log of all table writes made during execution
of the backup. The same principles apply for writing these
pages as with the backup data buffer, except that when there
is no more space in the backup log buffer, the backup fails.
For that reason, the size of the backup log buffer must be
large enough to handle the load caused by write activities
while the backup is being made. See
<a class="xref" href="mysql-cluster-backup-configuration.html" title="25.6.8.3 Configuration for NDB Cluster Backups">
Section 25.6.8.3, “Configuration for NDB Cluster Backups”
</a>
.
</p>
<p>
The default value for this parameter should be sufficient
for most applications. In fact, it is more likely for a
backup failure to be caused by insufficient disk write speed
than it is for the backup log buffer to become full. If the
disk subsystem is not configured for the write load caused
by applications, the cluster is unlikely to be able to
perform the desired operations.
</p>
<p>
It is preferable to configure cluster nodes in such a manner
that the processor becomes the bottleneck rather than the
disks or the network connections.
</p>
<p>
The default value for this parameter is 16MB.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-backupmemory">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-backupmemory">
<code class="literal">
BackupMemory
</code>
</a>
</p>
<a class="indexterm" name="idm46045116685328">
</a>
<div class="informaltable">
<a name="backupmemory-ndbd-table">
</a>
<table frame="box" rules="all" summary="BackupMemory data node 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>
bytes
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
32M
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
0 - 4294967039 (0xFFFFFEFF)
</td>
</tr>
<tr>
<th>
Deprecated
</th>
<td>
Yes (in NDB 7.4)
</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 parameter is deprecated, and subject to removal in a
future version of NDB Cluster. Any setting made for it is
ignored.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-backupreportfrequency">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-backupreportfrequency">
<code class="literal">
BackupReportFrequency
</code>
</a>
</p>
<a class="indexterm" name="idm46045116662640">
</a>
<div class="informaltable">
<a name="backupreportfrequency-ndbd-table">
</a>
<table frame="box" rules="all" summary="BackupReportFrequency data node 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>
seconds
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
0
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
0 - 4294967039 (0xFFFFFEFF)
</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 parameter controls how often backup status reports are
issued in the management client during a backup, as well as
how often such reports are written to the cluster log
(provided cluster event logging is configured to permit
it—see
<a class="xref" href="mysql-cluster-ndbd-definition.html#mysql-cluster-logging-and-checkpointing" title="Logging and checkpointing">
Logging and checkpointing
</a>
).
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-backupreportfrequency">
<code class="literal">
BackupReportFrequency
</code>
</a>
represents the time in seconds between backup status
reports.
</p>
<p>
The default value is 0.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-backupwritesize">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-backupwritesize">
<code class="literal">
BackupWriteSize
</code>
</a>
</p>
<a class="indexterm" name="idm46045116639136">
</a>
<div class="informaltable">
<a name="backupwritesize-ndbd-table">
</a>
<table frame="box" rules="all" summary="BackupWriteSize data node 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>
bytes
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
256K
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
32K - 4294967039 (0xFFFFFEFF)
</td>
</tr>
<tr>
<th>
Deprecated
</th>
<td>
Yes (in NDB 7.6)
</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 parameter specifies the default size of messages
written to disk by the backup log and backup data buffers.
</p>
<p>
The default value for this parameter is 256KB.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-backupmaxwritesize">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-backupmaxwritesize">
<code class="literal">
BackupMaxWriteSize
</code>
</a>
</p>
<a class="indexterm" name="idm46045116615952">
</a>
<div class="informaltable">
<a name="backupmaxwritesize-ndbd-table">
</a>
<table frame="box" rules="all" summary="BackupMaxWriteSize data node 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>
bytes
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
1M
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
256K - 4294967039 (0xFFFFFEFF)
</td>
</tr>
<tr>
<th>
Deprecated
</th>
<td>
Yes (in NDB 7.6)
</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 parameter specifies the maximum size of messages
written to disk by the backup log and backup data buffers.
</p>
<p>
The default value for this parameter is 1MB.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-compressedbackup">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-compressedbackup">
<code class="literal">
CompressedBackup
</code>
</a>
</p>
<a class="indexterm" name="idm46045116592864">
</a>
<div class="informaltable">
<a name="compressedbackup-ndbd-table">
</a>
<table frame="box" rules="all" summary="CompressedBackup data node 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>
boolean
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
false
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
true, false
</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>
Enabling this parameter causes backup files to be
compressed. The compression used is equivalent to
<span class="command">
<strong>
gzip --fast
</strong>
</span>
, and can save 50% or more of
the space required on the data node to store uncompressed
backup files. Compressed backups can be enabled for
individual data nodes, or for all data nodes (by setting
this parameter in the
<code class="literal">
[ndbd default]
</code>
section of the
<code class="filename">
config.ini
</code>
file).
</p>
<div class="important" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Important
</div>
<p>
You cannot restore a compressed backup to a cluster
running a MySQL version that does not support this
feature.
</p>
</div>
<p>
The default value is
<code class="literal">
0
</code>
(disabled).
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-requireencryptedbackup">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-requireencryptedbackup">
<code class="literal">
RequireEncryptedBackup
</code>
</a>
</p>
<a class="indexterm" name="idm46045116567904">
</a>
<div class="informaltable">
<a name="requireencryptedbackup-ndbd-table">
</a>
<table frame="box" rules="all" summary="RequireEncryptedBackup data node 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>
integer
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
0
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
0 - 1
</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>
If set to 1, backups must be encrypted. While it is possible
to set this parameter for each data node individually, it is
recommended that you set it in the
<code class="literal">
[ndbd
default]
</code>
section of the
<code class="filename">
config.ini
</code>
global configuration file.
For more information about performing encrypted backups, see
<a class="xref" href="mysql-cluster-backup-using-management-client.html" title="25.6.8.2 Using The NDB Cluster Management Client to Create a Backup">
Section 25.6.8.2, “Using The NDB Cluster Management Client to Create a Backup”
</a>
.
</p>
</li>
</ul>
</div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
The location of the backup files is determined by the
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-backupdatadir">
<code class="literal">
BackupDataDir
</code>
</a>
data
node configuration parameter.
</p>
</div>
<p>
<b>
Additional requirements.
</b>
When specifying these parameters, the following relationships
must hold true. Otherwise, the data node cannot start.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
BackupDataBufferSize >= BackupWriteSize +
188KB
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
BackupLogBufferSize >= BackupWriteSize +
16KB
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
BackupMaxWriteSize >= BackupWriteSize
</code>
</p>
</li>
</ul>
</div>
<h5>
<a name="mysql-cluster-realtime-performance-parameters">
</a>
NDB Cluster Realtime Performance Parameters
</h5>
<p>
The
<code class="literal">
[ndbd]
</code>
parameters discussed in this
section are used in scheduling and locking of threads to
specific CPUs on multiprocessor data node hosts.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
To make use of these parameters, the data node process must be
run as system root.
</p>
</div>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a name="ndbparam-ndbd-buildindexthreads">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-buildindexthreads">
<code class="literal">
BuildIndexThreads
</code>
</a>
</p>
<a class="indexterm" name="idm46045116532576">
</a>
<div class="informaltable">
<a name="buildindexthreads-ndbd-table">
</a>
<table frame="box" rules="all" summary="BuildIndexThreads data node 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>
numeric
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
128
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
0 - 128
</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 parameter determines the number of threads to create
when rebuilding ordered indexes during a system or node
start, as well as when running
<a class="link" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
<span class="command">
<strong>
ndb_restore
</strong>
</span>
</a>
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_rebuild-indexes">
<code class="option">
--rebuild-indexes
</code>
</a>
. It is
supported only when there is more than one fragment for the
table per data node (for example, when
<code class="literal">
COMMENT="NDB_TABLE=PARTITION_BALANCE=FOR_RA_BY_LDM_X_2"
</code>
is used with
<a class="link" href="create-table.html" title="15.1.20 CREATE TABLE Statement">
<code class="literal">
CREATE TABLE
</code>
</a>
).
</p>
<p>
Setting this parameter to 0 (the default) disables
multithreaded building of ordered indexes.
</p>
<p>
This parameter is supported when using
<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
</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
</strong>
</span>
</a>
.
</p>
<p>
You can enable multithreaded builds during data node initial
restarts by setting the
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-twopassinitialnoderestartcopy">
<code class="literal">
TwoPassInitialNodeRestartCopy
</code>
</a>
data node configuration parameter to
<code class="literal">
TRUE
</code>
.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-lockexecutethreadtocpu">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-lockexecutethreadtocpu">
<code class="literal">
LockExecuteThreadToCPU
</code>
</a>
</p>
<a class="indexterm" name="idm46045116501440">
</a>
<div class="informaltable">
<a name="lockexecutethreadtocpu-ndbd-table">
</a>
<table frame="box" rules="all" summary="LockExecuteThreadToCPU data node 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>
set of CPU IDs
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
0
</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>
When used with
<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
</strong>
</span>
</a>
, this parameter (now
a string) specifies the ID of the CPU assigned to handle the
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDBCLUSTER
</code>
</a>
execution thread.
When used with
<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
</strong>
</span>
</a>
, the value of this
parameter is a comma-separated list of CPU IDs assigned to
handle execution threads. Each CPU ID in the list should be
an integer in the range 0 to 65535 (inclusive).
</p>
<p>
The number of IDs specified should match the number of
execution threads determined by
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbmtd-maxnoofexecutionthreads">
<code class="literal">
MaxNoOfExecutionThreads
</code>
</a>
.
However, there is no guarantee that threads are assigned to
CPUs in any given order when using this parameter. You can
obtain more finely-grained control of this type using
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbmtd-threadconfig">
<code class="literal">
ThreadConfig
</code>
</a>
.
</p>
<p>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-lockexecutethreadtocpu">
<code class="literal">
LockExecuteThreadToCPU
</code>
</a>
has no default value.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-lockmaintthreadstocpu">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-lockmaintthreadstocpu">
<code class="literal">
LockMaintThreadsToCPU
</code>
</a>
</p>
<a class="indexterm" name="idm46045116472032">
</a>
<div class="informaltable">
<a name="lockmaintthreadstocpu-ndbd-table">
</a>
<table frame="box" rules="all" summary="LockMaintThreadsToCPU data node 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>
CPU ID
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
0
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
0 - 64K
</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 parameter specifies the ID of the CPU assigned to
handle
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDBCLUSTER
</code>
</a>
maintenance
threads.
</p>
<p>
The value of this parameter is an integer in the range 0 to
65535 (inclusive).
<span class="emphasis">
<em>
There is no default
value
</em>
</span>
.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-numa">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-numa">
<code class="literal">
Numa
</code>
</a>
</p>
<a class="indexterm" name="idm46045116449472">
</a>
<a class="indexterm" name="idm46045116448400">
</a>
<div class="informaltable">
<a name="numa-ndbd-table">
</a>
<table frame="box" rules="all" summary="Numa data node 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>
numeric
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
1
</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 parameter determines whether Non-Uniform Memory Access
(NUMA) is controlled by the operating system or by the data
node process, whether the data node uses
<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
</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
</strong>
</span>
</a>
. By
default,
<code class="literal">
NDB
</code>
attempts to use an
interleaved NUMA memory allocation policy on any data node
where the host operating system provides NUMA support.
</p>
<p>
Setting
<code class="literal">
Numa = 0
</code>
means that the datanode
process does not itself attempt to set a policy for memory
allocation, and permits this behavior to be determined by
the operating system, which may be further guided by the
separate
<span class="command">
<strong>
numactl
</strong>
</span>
tool. That is,
<code class="literal">
Numa = 0
</code>
yields the system default
behavior, which can be customised by
<span class="command">
<strong>
numactl
</strong>
</span>
. For many Linux systems, the
system default behavior is to allocate socket-local memory
to any given process at allocation time. This can be
problematic when using
<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
</strong>
</span>
</a>
; this is
because
<span class="command">
<strong>
nbdmtd
</strong>
</span>
allocates all memory at
startup, leading to an imbalance, giving different access
speeds for different sockets, especially when locking pages
in main memory.
</p>
<p>
Setting
<code class="literal">
Numa = 1
</code>
means that the data node
process uses
<code class="literal">
libnuma
</code>
to request
interleaved memory allocation. (This can also be
accomplished manually, on the operating system level, using
<span class="command">
<strong>
numactl
</strong>
</span>
.) Using interleaved allocation in
effect tells the data node process to ignore non-uniform
memory access but does not attempt to take any advantage of
fast local memory; instead, the data node process tries to
avoid imbalances due to slow remote memory. If interleaved
allocation is not desired, set
<code class="literal">
Numa
</code>
to 0
so that the desired behavior can be determined on the
operating system level.
</p>
<p>
The
<code class="literal">
Numa
</code>
configuration parameter is
supported only on Linux systems where
<code class="filename">
libnuma.so
</code>
is available.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-realtimescheduler">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-realtimescheduler">
<code class="literal">
RealtimeScheduler
</code>
</a>
</p>
<a class="indexterm" name="idm46045116412240">
</a>
<div class="informaltable">
<a name="realtimescheduler-ndbd-table">
</a>
<table frame="box" rules="all" summary="RealtimeScheduler data node 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>
boolean
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
false
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
true, false
</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>
Setting this parameter to 1 enables real-time scheduling of
data node threads.
</p>
<p>
The default is 0 (scheduling disabled).
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-schedulerexecutiontimer">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-schedulerexecutiontimer">
<code class="literal">
SchedulerExecutionTimer
</code>
</a>
</p>
<a class="indexterm" name="idm46045116391344">
</a>
<div class="informaltable">
<a name="schedulerexecutiontimer-ndbd-table">
</a>
<table frame="box" rules="all" summary="SchedulerExecutionTimer data node 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>
µs
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
50
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
0 - 11000
</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 parameter specifies the time in microseconds for
threads to be executed in the scheduler before being sent.
Setting it to 0 minimizes the response time; to achieve
higher throughput, you can increase the value at the expense
of longer response times.
</p>
<p>
The default is 50 μsec, which our testing shows to
increase throughput slightly in high-load cases without
materially delaying requests.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-schedulerresponsiveness">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-schedulerresponsiveness">
<code class="literal">
SchedulerResponsiveness
</code>
</a>
</p>
<a class="indexterm" name="idm46045116369904">
</a>
<div class="informaltable">
<a name="schedulerresponsiveness-ndbd-table">
</a>
<table frame="box" rules="all" summary="SchedulerResponsiveness data node 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>
integer
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
5
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
0 - 10
</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>
Set the balance in the
<code class="literal">
NDB
</code>
scheduler
between speed and throughput. This parameter takes an
integer whose value is in the range 0-10 inclusive, with 5
as the default. Higher values provide better response times
relative to throughput. Lower values provide increased
throughput at the expense of longer response times.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-schedulerspintimer">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-schedulerspintimer">
<code class="literal">
SchedulerSpinTimer
</code>
</a>
</p>
<a class="indexterm" name="idm46045116348544">
</a>
<div class="informaltable">
<a name="schedulerspintimer-ndbd-table">
</a>
<table frame="box" rules="all" summary="SchedulerSpinTimer data node 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>
µs
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
0
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
0 - 500
</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 parameter specifies the time in microseconds for
threads to be executed in the scheduler before sleeping.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
If
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-spinmethod">
<code class="literal">
SpinMethod
</code>
</a>
is
set, any setting for this parameter is ignored.
</p>
</div>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-spinmethod">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-spinmethod">
<code class="literal">
SpinMethod
</code>
</a>
</p>
<a class="indexterm" name="idm46045116325984">
</a>
<a class="indexterm" name="idm46045116324912">
</a>
<a class="indexterm" name="idm46045116323840">
</a>
<div class="informaltable">
<a name="spinmethod-ndbd-table">
</a>
<table frame="box" rules="all" summary="SpinMethod data node 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>
enumeration
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
StaticSpinning
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
CostBasedSpinning, LatencyOptimisedSpinning, DatabaseMachineSpinning,
StaticSpinning
</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 parameter provides a simple interface to control
adaptive spinning on data nodes, with four possible values
furnishing presets for spin parameter values, as shown in
the following list:
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
<code class="literal">
StaticSpinning
</code>
(default): Sets
<code class="literal">
EnableAdaptiveSpinning
</code>
to
<code class="literal">
false
</code>
and
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-schedulerspintimer">
<code class="literal">
SchedulerSpinTimer
</code>
</a>
to 0. (
<code class="literal">
SetAllowedSpinOverhead
</code>
is not
relevant in this case.)
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
CostBasedSpinning
</code>
: Sets
<code class="literal">
EnableAdaptiveSpinning
</code>
to
<code class="literal">
true
</code>
,
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-schedulerspintimer">
<code class="literal">
SchedulerSpinTimer
</code>
</a>
to 100, and
<code class="literal">
SetAllowedSpinOverhead
</code>
to
200.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
LatencyOptimisedSpinning
</code>
: Sets
<code class="literal">
EnableAdaptiveSpinning
</code>
to
<code class="literal">
true
</code>
,
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-schedulerspintimer">
<code class="literal">
SchedulerSpinTimer
</code>
</a>
to 200, and
<code class="literal">
SetAllowedSpinOverhead
</code>
to
1000.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
DatabaseMachineSpinning
</code>
: Sets
<code class="literal">
EnableAdaptiveSpinning
</code>
to
<code class="literal">
true
</code>
,
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-schedulerspintimer">
<code class="literal">
SchedulerSpinTimer
</code>
</a>
to 500, and
<code class="literal">
SetAllowedSpinOverhead
</code>
to
10000. This is intended for use in cases where threads
own their own CPUs.
</p>
</li>
</ol>
</div>
<p>
The spin parameters modified by
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-spinmethod">
<code class="literal">
SpinMethod
</code>
</a>
are
described in the following list:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-schedulerspintimer">
<code class="literal">
SchedulerSpinTimer
</code>
</a>
:
This is the same as the data node configuration
parameter of that name. The setting applied to this
parameter by
<code class="literal">
SpinMethod
</code>
overrides any
value set in the
<code class="filename">
config.ini
</code>
file.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
EnableAdaptiveSpinning
</code>
: Enables or
disables adaptive spinning. Disabling it causes spinning
to be performed without making any checks for CPU
resources. This parameter cannot be set directly in the
cluster configuration file, and under most circumstances
should not need to be, but can be enabled directly using
<a class="ulink" href="/doc/ndb-internals/en/dump-command-104004.html" target="_top">
<code class="literal">
DUMP 104004 1
</code>
</a>
or
disabled with
<a class="ulink" href="/doc/ndb-internals/en/dump-command-104004.html" target="_top">
<code class="literal">
DUMP 104004
0
</code>
</a>
in 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>
management
client.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
SetAllowedSpinOverhead
</code>
: Sets the
amount of CPU time to allow for gaining latency. This
parameter cannot be set directly in the
<code class="filename">
config.ini
</code>
file. In most cases, the
setting applied by SpinMethod should be satisfactory,
but if it is necessary to change it directly, you can
use
<a class="ulink" href="/doc/ndb-internals/en/dump-command-104002.html" target="_top">
<code class="literal">
DUMP 104002
<em class="replaceable">
<code>
overhead
</code>
</em>
</code>
</a>
to do so,
where
<em class="replaceable">
<code>
overhead
</code>
</em>
is a value
ranging from 0 to 10000, inclusive; see the description
of the indicated
<code class="literal">
DUMP
</code>
command for
details.
</p>
</li>
</ul>
</div>
<p>
On platforms lacking usable spin instructions, such as
PowerPC and some SPARC platforms, spin time is set to 0 in
all situations, and values for
<code class="literal">
SpinMethod
</code>
other than
<code class="literal">
StaticSpinning
</code>
are ignored.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-twopassinitialnoderestartcopy">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-twopassinitialnoderestartcopy">
<code class="literal">
TwoPassInitialNodeRestartCopy
</code>
</a>
</p>
<a class="indexterm" name="idm46045116263440">
</a>
<div class="informaltable">
<a name="twopassinitialnoderestartcopy-ndbd-table">
</a>
<table frame="box" rules="all" summary="TwoPassInitialNodeRestartCopy data node 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>
boolean
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
true
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
true, false
</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>
Multithreaded building of ordered indexes can be enabled for
initial restarts of data nodes by setting this configuration
parameter to
<code class="literal">
true
</code>
(the default value),
which enables two-pass copying of data during initial node
restarts.
</p>
<p>
You must also set
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-buildindexthreads">
<code class="literal">
BuildIndexThreads
</code>
</a>
to
a nonzero value.
</p>
</li>
</ul>
</div>
<p>
<a name="mysql-cluster-ndbd-definition-ndbmtd-parameters">
</a>
<b>
Multi-Threading Configuration Parameters (ndbmtd).
</b>
<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
</strong>
</span>
</a>
runs by default as a single-threaded
process and must be configured to use multiple threads, using
either of two methods, both of which require setting
configuration parameters in the
<code class="filename">
config.ini
</code>
file. The first method is
simply to set an appropriate value for the
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbmtd-maxnoofexecutionthreads">
<code class="literal">
MaxNoOfExecutionThreads
</code>
</a>
configuration parameter. A second method makes it possible to
set up more complex rules for
<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
</strong>
</span>
</a>
multithreading using
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbmtd-threadconfig">
<code class="literal">
ThreadConfig
</code>
</a>
. The
next few paragraphs provide information about these parameters
and their use with multithreaded data nodes.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
A backup using parallelism on the data nodes requires that
multiple LDMs are in use on all data nodes in the cluster
prior to taking the backup. For more information, see
<a class="xref" href="mysql-cluster-backup-parallel-data-nodes.html" title="25.6.8.5 Taking an NDB Backup with Parallel Data Nodes">
Section 25.6.8.5, “Taking an NDB Backup with Parallel Data Nodes”
</a>
, as
well as
<a class="ulink" href="/doc/refman/8.0/en/ndb-restore-parallel-data-node-backup.html" target="_top">
Restoring from a backup taken in parallel
</a>
.
</p>
</div>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a name="ndbparam-ndbmtd-automaticthreadconfig">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbmtd-automaticthreadconfig">
<code class="literal">
AutomaticThreadConfig
</code>
</a>
</p>
<a class="indexterm" name="idm46045116229328">
</a>
<div class="informaltable">
<a name="automaticthreadconfig-ndbmtd-table">
</a>
<table frame="box" rules="all" summary="AutomaticThreadConfig multi-threaded data node 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>
boolean
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
false
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
true, false
</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>
When set to 1, enables automatic thread configuration
employing the number of CPUs available to a data node taking
into account any limits set by
<code class="literal">
taskset
</code>
,
<code class="literal">
numactl
</code>
, virtual machines, Docker, and
other such means of controlling which CPUs are available to
a given application (on Windows platforms, automatic thread
configuration uses all CPUs which are online);
alternatively, you can set
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbmtd-numcpus">
<code class="literal">
NumCPUs
</code>
</a>
to the
desired number of CPUs (up to 1024, the maximum number of
CPUs that can be handled by automatic thread configuration).
Any settings for
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbmtd-threadconfig">
<code class="literal">
ThreadConfig
</code>
</a>
and
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbmtd-maxnoofexecutionthreads">
<code class="literal">
MaxNoOfExecutionThreads
</code>
</a>
are ignored. In addition, enabling this parameter
automatically disables
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbmtd-classicfragmentation">
<code class="literal">
ClassicFragmentation
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbmtd-classicfragmentation">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbmtd-classicfragmentation">
<code class="literal">
ClassicFragmentation
</code>
</a>
</p>
<a class="indexterm" name="idm46045116201552">
</a>
<a class="indexterm" name="idm46045116200064">
</a>
<div class="informaltable">
<a name="classicfragmentation-ndbmtd-table">
</a>
<table frame="box" rules="all" summary="ClassicFragmentation multi-threaded data node 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>
boolean
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
true
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
true, false
</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>
When enabled (set to
<code class="literal">
true
</code>
),
<code class="literal">
NDB
</code>
distributes fragments among LDMs such
that the default number of partitions per node is equal to
the minimum number of local data manager (LDM) threads per
data node.
</p>
<p>
For new clusters, setting
<code class="literal">
ClassicFragmentation
</code>
to
<code class="literal">
false
</code>
when first setting up the cluster
is preferable; doing so causes the number of partitions per
node to be equal to the value of
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbmtd-partitionspernode">
<code class="literal">
PartitionsPerNode
</code>
</a>
,
ensuring that all partitions are spread out evenly between
all LDMs.
</p>
<p>
This parameter and
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbmtd-automaticthreadconfig">
<code class="literal">
AutomaticThreadConfig
</code>
</a>
are mutually exclusive; enabling
<code class="literal">
AutomaticThreadConfig
</code>
automatically
disables
<code class="literal">
ClassicFragmentation
</code>
.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbmtd-enablemultithreadedbackup">
</a>
<code class="literal">
EnableMultithreadedBackup
</code>
</p>
<a class="indexterm" name="idm46045116171424">
</a>
<a class="indexterm" name="idm46045116169920">
</a>
<div class="informaltable">
<a name="enablemultithreadedbackup-ndbmtd-table">
</a>
<table frame="box" rules="all" summary="EnableMultithreadedBackup multi-threaded data node 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>
unsigned
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
1
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
0 - 1
</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>
Enables multi-threaded backup. If each data node has at
least 2 LDMs, all LDM threads participate in the backup,
which is created using one subdirectory per LDM thread, and
each subdirectory containing
<code class="filename">
.ctl
</code>
,
<code class="filename">
.Data
</code>
, and
<code class="filename">
.log
</code>
backup files.
</p>
<p>
This parameter is normally enabled (set to 1) for
<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
</strong>
</span>
</a>
. To force a single-threaded backup
that can be restored easily using older versions of
<a class="link" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
<span class="command">
<strong>
ndb_restore
</strong>
</span>
</a>
, disable multi-threaded
backup by setting this parameter to 0. This must be done for
each data node in the cluster.
</p>
<p>
See
<a class="xref" href="mysql-cluster-backup-parallel-data-nodes.html" title="25.6.8.5 Taking an NDB Backup with Parallel Data Nodes">
Section 25.6.8.5, “Taking an NDB Backup with Parallel Data Nodes”
</a>
,
and
<a class="ulink" href="/doc/refman/8.0/en/ndb-restore-parallel-data-node-backup.html" target="_top">
Restoring from a backup taken in parallel
</a>
,
for more information.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbmtd-maxnoofexecutionthreads">
</a>
<code class="literal">
MaxNoOfExecutionThreads
</code>
</p>
<a class="indexterm" name="idm46045116142000">
</a>
<a class="indexterm" name="idm46045116140960">
</a>
<a class="indexterm" name="idm46045116139472">
</a>
<a class="indexterm" name="idm46045116137984">
</a>
<div class="informaltable">
<a name="maxnoofexecutionthreads-ndbmtd-table">
</a>
<table frame="box" rules="all" summary="MaxNoOfExecutionThreads multi-threaded data node 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>
integer
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
2
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
2 - 72
</td>
</tr>
<tr>
<th>
Restart Type
</th>
<td>
<p>
<span class="bold">
<strong>
System Restart:
</strong>
</span>
Requires a complete shutdown and restart
of the cluster. (NDB 8.4.0)
</p>
</td>
</tr>
</tbody>
</table>
</div>
<p>
This parameter directly controls the number of execution
threads used by
<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
</strong>
</span>
</a>
, up to a maximum
of 72. Although this parameter is set in
<code class="literal">
[ndbd]
</code>
or
<code class="literal">
[ndbd
default]
</code>
sections of the
<code class="filename">
config.ini
</code>
file, it is exclusive to
<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
</strong>
</span>
</a>
and does not apply to
<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
</strong>
</span>
</a>
.
</p>
<p>
Enabling
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbmtd-automaticthreadconfig">
<code class="literal">
AutomaticThreadConfig
</code>
</a>
causes any setting for this parameter to be ignored.
</p>
<p>
Setting
<code class="literal">
MaxNoOfExecutionThreads
</code>
sets the
number of threads for each type as determined by a matrix in
the file
<code class="filename">
storage/ndb/src/common/mt_thr_config.cpp
</code>
.
This table shows these numbers of threads for possible
values of
<code class="literal">
MaxNoOfExecutionThreads
</code>
.
</p>
<div class="table">
<a name="idm46045116109728">
</a>
<p class="title">
<b>
Table 25.11 MaxNoOfExecutionThreads values
and the corresponding number of threads by thread type
(LQH, TC, Send, Receive).
</b>
</p>
<div class="table-contents">
<table>
<colgroup>
<col style="width: 52%"/>
<col style="width: 12%"/>
<col style="width: 12%"/>
<col style="width: 12%"/>
<col style="width: 12%"/>
</colgroup>
<thead>
<tr>
<th scope="col">
<code class="literal">
MaxNoOfExecutionThreads
</code>
Value
</th>
<th scope="col">
LDM Threads
</th>
<th scope="col">
TC Threads
</th>
<th scope="col">
Send Threads
</th>
<th scope="col">
Receive Threads
</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">
0 .. 3
</th>
<td>
1
</td>
<td>
0
</td>
<td>
0
</td>
<td>
1
</td>
</tr>
<tr>
<th scope="row">
4 .. 6
</th>
<td>
2
</td>
<td>
0
</td>
<td>
0
</td>
<td>
1
</td>
</tr>
<tr>
<th scope="row">
7 .. 8
</th>
<td>
4
</td>
<td>
0
</td>
<td>
0
</td>
<td>
1
</td>
</tr>
<tr>
<th scope="row">
9
</th>
<td>
4
</td>
<td>
2
</td>
<td>
0
</td>
<td>
1
</td>
</tr>
<tr>
<th scope="row">
10
</th>
<td>
4
</td>
<td>
2
</td>
<td>
1
</td>
<td>
1
</td>
</tr>
<tr>
<th scope="row">
11
</th>
<td>
4
</td>
<td>
3
</td>
<td>
1
</td>
<td>
1
</td>
</tr>
<tr>
<th scope="row">
12
</th>
<td>
6
</td>
<td>
2
</td>
<td>
1
</td>
<td>
1
</td>
</tr>
<tr>
<th scope="row">
13
</th>
<td>
6
</td>
<td>
3
</td>
<td>
1
</td>
<td>
1
</td>
</tr>
<tr>
<th scope="row">
14
</th>
<td>
6
</td>
<td>
3
</td>
<td>
1
</td>
<td>
2
</td>
</tr>
<tr>
<th scope="row">
15
</th>
<td>
6
</td>
<td>
3
</td>
<td>
2
</td>
<td>
2
</td>
</tr>
<tr>
<th scope="row">
16
</th>
<td>
8
</td>
<td>
3
</td>
<td>
1
</td>
<td>
2
</td>
</tr>
<tr>
<th scope="row">
17
</th>
<td>
8
</td>
<td>
4
</td>
<td>
1
</td>
<td>
2
</td>
</tr>
<tr>
<th scope="row">
18
</th>
<td>
8
</td>
<td>
4
</td>
<td>
2
</td>
<td>
2
</td>
</tr>
<tr>
<th scope="row">
19
</th>
<td>
8
</td>
<td>
5
</td>
<td>
2
</td>
<td>
2
</td>
</tr>
<tr>
<th scope="row">
20
</th>
<td>
10
</td>
<td>
4
</td>
<td>
2
</td>
<td>
2
</td>
</tr>
<tr>
<th scope="row">
21
</th>
<td>
10
</td>
<td>
5
</td>
<td>
2
</td>
<td>
2
</td>
</tr>
<tr>
<th scope="row">
22
</th>
<td>
10
</td>
<td>
5
</td>
<td>
2
</td>
<td>
3
</td>
</tr>
<tr>
<th scope="row">
23
</th>
<td>
10
</td>
<td>
6
</td>
<td>
2
</td>
<td>
3
</td>
</tr>
<tr>
<th scope="row">
24
</th>
<td>
12
</td>
<td>
5
</td>
<td>
2
</td>
<td>
3
</td>
</tr>
<tr>
<th scope="row">
25
</th>
<td>
12
</td>
<td>
6
</td>
<td>
2
</td>
<td>
3
</td>
</tr>
<tr>
<th scope="row">
26
</th>
<td>
12
</td>
<td>
6
</td>
<td>
3
</td>
<td>
3
</td>
</tr>
<tr>
<th scope="row">
27
</th>
<td>
12
</td>
<td>
7
</td>
<td>
3
</td>
<td>
3
</td>
</tr>
<tr>
<th scope="row">
28
</th>
<td>
12
</td>
<td>
7
</td>
<td>
3
</td>
<td>
4
</td>
</tr>
<tr>
<th scope="row">
29
</th>
<td>
12
</td>
<td>
8
</td>
<td>
3
</td>
<td>
4
</td>
</tr>
<tr>
<th scope="row">
30
</th>
<td>
12
</td>
<td>
8
</td>
<td>
4
</td>
<td>
4
</td>
</tr>
<tr>
<th scope="row">
31
</th>
<td>
12
</td>
<td>
9
</td>
<td>
4
</td>
<td>
4
</td>
</tr>
<tr>
<th scope="row">
32
</th>
<td>
16
</td>
<td>
8
</td>
<td>
3
</td>
<td>
3
</td>
</tr>
<tr>
<th scope="row">
33
</th>
<td>
16
</td>
<td>
8
</td>
<td>
3
</td>
<td>
4
</td>
</tr>
<tr>
<th scope="row">
34
</th>
<td>
16
</td>
<td>
8
</td>
<td>
4
</td>
<td>
4
</td>
</tr>
<tr>
<th scope="row">
35
</th>
<td>
16
</td>
<td>
9
</td>
<td>
4
</td>
<td>
4
</td>
</tr>
<tr>
<th scope="row">
36
</th>
<td>
16
</td>
<td>
10
</td>
<td>
4
</td>
<td>
4
</td>
</tr>
<tr>
<th scope="row">
37
</th>
<td>
16
</td>
<td>
10
</td>
<td>
4
</td>
<td>
5
</td>
</tr>
<tr>
<th scope="row">
38
</th>
<td>
16
</td>
<td>
11
</td>
<td>
4
</td>
<td>
5
</td>
</tr>
<tr>
<th scope="row">
39
</th>
<td>
16
</td>
<td>
11
</td>
<td>
5
</td>
<td>
5
</td>
</tr>
<tr>
<th scope="row">
40
</th>
<td>
20
</td>
<td>
10
</td>
<td>
4
</td>
<td>
4
</td>
</tr>
<tr>
<th scope="row">
41
</th>
<td>
20
</td>
<td>
10
</td>
<td>
4
</td>
<td>
5
</td>
</tr>
<tr>
<th scope="row">
42
</th>
<td>
20
</td>
<td>
11
</td>
<td>
4
</td>
<td>
5
</td>
</tr>
<tr>
<th scope="row">
43
</th>
<td>
20
</td>
<td>
11
</td>
<td>
5
</td>
<td>
5
</td>
</tr>
<tr>
<th scope="row">
44
</th>
<td>
20
</td>
<td>
12
</td>
<td>
5
</td>
<td>
5
</td>
</tr>
<tr>
<th scope="row">
45
</th>
<td>
20
</td>
<td>
12
</td>
<td>
5
</td>
<td>
6
</td>
</tr>
<tr>
<th scope="row">
46
</th>
<td>
20
</td>
<td>
13
</td>
<td>
5
</td>
<td>
6
</td>
</tr>
<tr>
<th scope="row">
47
</th>
<td>
20
</td>
<td>
13
</td>
<td>
6
</td>
<td>
6
</td>
</tr>
<tr>
<th scope="row">
48
</th>
<td>
24
</td>
<td>
12
</td>
<td>
5
</td>
<td>
5
</td>
</tr>
<tr>
<th scope="row">
49
</th>
<td>
24
</td>
<td>
12
</td>
<td>
5
</td>
<td>
6
</td>
</tr>
<tr>
<th scope="row">
50
</th>
<td>
24
</td>
<td>
13
</td>
<td>
5
</td>
<td>
6
</td>
</tr>
<tr>
<th scope="row">
51
</th>
<td>
24
</td>
<td>
13
</td>
<td>
6
</td>
<td>
6
</td>
</tr>
<tr>
<th scope="row">
52
</th>
<td>
24
</td>
<td>
14
</td>
<td>
6
</td>
<td>
6
</td>
</tr>
<tr>
<th scope="row">
53
</th>
<td>
24
</td>
<td>
14
</td>
<td>
6
</td>
<td>
7
</td>
</tr>
<tr>
<th scope="row">
54
</th>
<td>
24
</td>
<td>
15
</td>
<td>
6
</td>
<td>
7
</td>
</tr>
<tr>
<th scope="row">
55
</th>
<td>
24
</td>
<td>
15
</td>
<td>
7
</td>
<td>
7
</td>
</tr>
<tr>
<th scope="row">
56
</th>
<td>
24
</td>
<td>
16
</td>
<td>
7
</td>
<td>
7
</td>
</tr>
<tr>
<th scope="row">
57
</th>
<td>
24
</td>
<td>
16
</td>
<td>
7
</td>
<td>
8
</td>
</tr>
<tr>
<th scope="row">
58
</th>
<td>
24
</td>
<td>
17
</td>
<td>
7
</td>
<td>
8
</td>
</tr>
<tr>
<th scope="row">
59
</th>
<td>
24
</td>
<td>
17
</td>
<td>
8
</td>
<td>
8
</td>
</tr>
<tr>
<th scope="row">
60
</th>
<td>
24
</td>
<td>
18
</td>
<td>
8
</td>
<td>
8
</td>
</tr>
<tr>
<th scope="row">
61
</th>
<td>
24
</td>
<td>
18
</td>
<td>
8
</td>
<td>
9
</td>
</tr>
<tr>
<th scope="row">
62
</th>
<td>
24
</td>
<td>
19
</td>
<td>
8
</td>
<td>
9
</td>
</tr>
<tr>
<th scope="row">
63
</th>
<td>
24
</td>
<td>
19
</td>
<td>
9
</td>
<td>
9
</td>
</tr>
<tr>
<th scope="row">
64
</th>
<td>
32
</td>
<td>
16
</td>
<td>
7
</td>
<td>
7
</td>
</tr>
<tr>
<th scope="row">
65
</th>
<td>
32
</td>
<td>
16
</td>
<td>
7
</td>
<td>
8
</td>
</tr>
<tr>
<th scope="row">
66
</th>
<td>
32
</td>
<td>
17
</td>
<td>
7
</td>
<td>
8
</td>
</tr>
<tr>
<th scope="row">
67
</th>
<td>
32
</td>
<td>
17
</td>
<td>
8
</td>
<td>
8
</td>
</tr>
<tr>
<th scope="row">
68
</th>
<td>
32
</td>
<td>
18
</td>
<td>
8
</td>
<td>
8
</td>
</tr>
<tr>
<th scope="row">
69
</th>
<td>
32
</td>
<td>
18
</td>
<td>
8
</td>
<td>
9
</td>
</tr>
<tr>
<th scope="row">
70
</th>
<td>
32
</td>
<td>
19
</td>
<td>
8
</td>
<td>
9
</td>
</tr>
<tr>
<th scope="row">
71
</th>
<td>
32
</td>
<td>
20
</td>
<td>
8
</td>
<td>
9
</td>
</tr>
<tr>
<th scope="row">
72
</th>
<td>
32
</td>
<td>
20
</td>
<td>
8
</td>
<td>
10
</td>
</tr>
</tbody>
</table>
</div>
<div class="table-contents">
<table cellpadding="0" cellspacing="0" style="position: fixed; top: 0px; display: none; left: 431px; width: 709px;">
<thead>
<tr>
<th scope="col" style="width: 368.172px;">
<code class="literal">
MaxNoOfExecutionThreads
</code>
Value
</th>
<th scope="col" style="width: 84.9531px;">
LDM Threads
</th>
<th scope="col" style="width: 84.9531px;">
TC Threads
</th>
<th scope="col" style="width: 84.9531px;">
Send Threads
</th>
<th scope="col" style="width: 84.9688px;">
Receive Threads
</th>
</tr>
</thead>
</table>
</div>
</div>
<br class="table-break"/>
<p>
There is always one SUMA (replication) thread.
</p>
<p>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbmtd-nooffragmentlogparts">
<code class="literal">
NoOfFragmentLogParts
</code>
</a>
should be set equal to the number of LDM threads used by
<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
</strong>
</span>
</a>
, as determined by the setting for
this parameter. This ratio should not be any greater than
4:1; a configuration in which this is the case is
specifically disallowed.
</p>
<p>
The number of LDM threads also determines the number of
partitions used by an
<code class="literal">
NDB
</code>
table that is
not explicitly partitioned; this is the number of LDM
threads times the number of data nodes in the cluster. (If
<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
</strong>
</span>
</a>
is used on the data nodes rather
than
<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
</strong>
</span>
</a>
, then there is always a
single LDM thread; in this case, the number of partitions
created automatically is simply equal to the number of data
nodes. See
<a class="xref" href="mysql-cluster-nodes-groups.html" title="25.2.2 NDB Cluster Nodes, Node Groups, Fragment Replicas, and Partitions">
Section 25.2.2, “NDB Cluster Nodes, Node Groups, Fragment Replicas, and Partitions”
</a>
, for
more information.
</p>
<p>
Adding large tablespaces for Disk Data tables when using
more than the default number of LDM threads may cause issues
with resource and CPU usage if the disk page buffer is
insufficiently large; see the description of the
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-diskpagebuffermemory">
<code class="literal">
DiskPageBufferMemory
</code>
</a>
configuration parameter, for more information.
</p>
<p>
The thread types are described later in this section (see
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbmtd-threadconfig">
<code class="literal">
ThreadConfig
</code>
</a>
).
</p>
<p>
Setting this parameter outside the permitted range of values
causes the management server to abort on startup with the
error
<span class="errortext">
Error line
<em class="replaceable">
<code>
number
</code>
</em>
: Illegal value
<em class="replaceable">
<code>
value
</code>
</em>
for parameter
MaxNoOfExecutionThreads
</span>
.
</p>
<p>
For
<code class="literal">
MaxNoOfExecutionThreads
</code>
, a value of 0
or 1 is rounded up internally by
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
to 2, so that 2 is
considered this parameter's default and minimum value.
</p>
<p>
<code class="literal">
MaxNoOfExecutionThreads
</code>
is generally
intended to be set equal to the number of CPU threads
available, and to allocate a number of threads of each type
suitable to typical workloads. It does not assign particular
threads to specified CPUs. For cases where it is desirable
to vary from the settings provided, or to bind threads to
CPUs, you should use
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbmtd-threadconfig">
<code class="literal">
ThreadConfig
</code>
</a>
instead, which allows you to allocate each thread directly
to a desired type, CPU, or both.
</p>
<p>
The multithreaded data node process always spawns, at a
minimum, the threads listed here:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
1 local query handler (LDM) thread
</p>
</li>
<li class="listitem">
<p>
1 receive thread
</p>
</li>
<li class="listitem">
<p>
1 subscription manager (SUMA or replication) thread
</p>
</li>
</ul>
</div>
<p>
For a
<code class="literal">
MaxNoOfExecutionThreads
</code>
value of 8
or less, no TC threads are created, and TC handling is
instead performed by the main thread.
</p>
<p>
Changing the number of LDM threads normally requires a
system restart, whether it is changed using this parameter
or
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbmtd-threadconfig">
<code class="literal">
ThreadConfig
</code>
</a>
,
but it is possible to effect the change using a node initial
restart (
<span class="emphasis">
<em>
NI
</em>
</span>
) provided the following two
conditions are met:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
Each LDM thread handles a maximum of 8 fragments, and
</p>
</li>
<li class="listitem">
<p>
The total number of table fragments is an integer
multiple of the number of LDM threads.
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbmtd-maxsenddelay">
</a>
<code class="literal">
MaxSendDelay
</code>
</p>
<a class="indexterm" name="idm46045115734512">
</a>
<a class="indexterm" name="idm46045115733440">
</a>
<div class="informaltable">
<a name="maxsenddelay-ndbmtd-table">
</a>
<table frame="box" rules="all" summary="MaxSendDelay multi-threaded data node 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>
microseconds
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
0
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
0 - 11000
</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 parameter can be used to cause data nodes to wait
momentarily before sending data to API nodes; in some
circumstances, described in the following paragraphs, this
can result in more efficient sending of larger volumes of
data and higher overall throughput.
</p>
<p>
<code class="literal">
MaxSendDelay
</code>
can be useful when there are
a great many API nodes at saturation point or close to it,
which can result in waves of increasing and decreasing
performance. This occurs when the data nodes are able to
send results back to the API nodes relatively quickly, with
many small packets to process, which can take longer to
process per byte compared to large packets, thus slowing
down the API nodes; later, the data nodes start sending
larger packets again.
</p>
<p>
To handle this type of scenario, you can set
<code class="literal">
MaxSendDelay
</code>
to a nonzero value, which
helps to ensure that responses are not sent back to the API
nodes so quickly. When this is done, responses are sent
immediately when there is no other competing traffic, but
when there is, setting
<code class="literal">
MaxSendDelay
</code>
causes the data nodes to wait long enough to ensure that
they send larger packets. In effect, this introduces an
artificial bottleneck into the send process, which can
actually improve throughput significantly.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbmtd-nooffragmentlogparts">
</a>
<code class="literal">
NoOfFragmentLogParts
</code>
</p>
<a class="indexterm" name="idm46045115708864">
</a>
<a class="indexterm" name="idm46045115707792">
</a>
<div class="informaltable">
<a name="nooffragmentlogparts-ndbmtd-table">
</a>
<table frame="box" rules="all" summary="NoOfFragmentLogParts multi-threaded data node 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>
numeric
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
4
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
4, 6, 8, 10, 12, 16, 20, 24, 32
</td>
</tr>
<tr>
<th>
Restart Type
</th>
<td>
<p>
<span class="bold">
<strong>
Initial 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; each data node must
be restarted with
<a class="link" href="mysql-cluster-programs-ndbd.html#option_ndbd_initial">
<code class="option">
--initial
</code>
</a>
. (NDB 8.4.0)
</p>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Set the number of log file groups for redo logs belonging to
this
<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
</strong>
</span>
</a>
. The value of this parameter
should be set equal to the number of LDM threads used by
<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
</strong>
</span>
</a>
as determined by the setting for
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbmtd-maxnoofexecutionthreads">
<code class="literal">
MaxNoOfExecutionThreads
</code>
</a>
.
A configuration using more than 4 redo log parts per LDM is
disallowed.
</p>
<p>
See the description of
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbmtd-maxnoofexecutionthreads">
<code class="literal">
MaxNoOfExecutionThreads
</code>
</a>
for more information.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbmtd-numcpus">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbmtd-numcpus">
<code class="literal">
NumCPUs
</code>
</a>
</p>
<a class="indexterm" name="idm46045115680272">
</a>
<div class="informaltable">
<a name="numcpus-ndbmtd-table">
</a>
<table frame="box" rules="all" summary="NumCPUs multi-threaded data node 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>
integer
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
0
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
0 - 1024
</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>
Cause automatic thread configuration to use only this many
CPUs. Has no effect if
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbmtd-automaticthreadconfig">
<code class="literal">
AutomaticThreadConfig
</code>
</a>
is not enabled.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbmtd-partitionspernode">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbmtd-partitionspernode">
<code class="literal">
PartitionsPerNode
</code>
</a>
</p>
<a class="indexterm" name="idm46045115658448">
</a>
<div class="informaltable">
<a name="partitionspernode-ndbmtd-table">
</a>
<table frame="box" rules="all" summary="PartitionsPerNode multi-threaded data node 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>
integer
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
2
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
1 - 32
</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>
Sets the number of partitions used on each node when
creating a new
<code class="literal">
NDB
</code>
table. This makes it
possible to avoid splitting up tables into an excessive
number of partitions when the number of local data managers
(LDMs) grows high.
</p>
<p>
While it is possible to set this parameter to different
values on different data nodes and there are no known issues
with doing so, this is also not likely to be of any
advantage; for this reason, it is recommended simply to set
it once, for all data nodes, in the
<code class="literal">
[ndbd
default]
</code>
section of the global
<code class="filename">
config.ini
</code>
file.
</p>
<p>
If
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbmtd-classicfragmentation">
<code class="literal">
ClassicFragmentation
</code>
</a>
is enabled, any setting for this parameter is ignored.
(Remember that enabling
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbmtd-automaticthreadconfig">
<code class="literal">
AutomaticThreadConfig
</code>
</a>
disables
<code class="literal">
ClassicFragmentation
</code>
.)
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbmtd-threadconfig">
</a>
<code class="literal">
ThreadConfig
</code>
</p>
<a class="indexterm" name="idm46045115631744">
</a>
<a class="indexterm" name="idm46045115630672">
</a>
<div class="informaltable">
<a name="threadconfig-ndbmtd-table">
</a>
<table frame="box" rules="all" summary="ThreadConfig multi-threaded data node 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>
System Restart:
</strong>
</span>
Requires a complete shutdown and restart
of the cluster. (NDB 8.4.0)
</p>
</td>
</tr>
</tbody>
</table>
</div>
<p>
This parameter is used with
<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
</strong>
</span>
</a>
to
assign threads of different types to different CPUs. Its
value is a string whose format has the following syntax:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-simple"><div class="docs-select-all right" id="sa17826188"><div class="copy-help left">Press ⌘+C to 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">ThreadConfig <span class="token operator">:</span><span class="token operator">=</span> <em class="replaceable">entry</em><span class="token punctuation">[</span><span class="token punctuation">,</span><em class="replaceable">entry</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>
<em class="replaceable">entry</em> <span class="token operator">:</span><span class="token operator">=</span> <em class="replaceable">type</em><span class="token operator">=</span><span class="token punctuation">{</span><em class="replaceable">param</em><span class="token punctuation">[</span><span class="token punctuation">,</span><em class="replaceable">param</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>
<em class="replaceable">type</em> <span class="token operator">:</span><span class="token operator">=</span> ldm <span class="token operator">|</span> query <span class="token operator">|</span> recover <span class="token operator">|</span> main <span class="token operator">|</span> recv <span class="token operator">|</span> send <span class="token operator">|</span> rep <span class="token operator">|</span> io <span class="token operator">|</span> tc <span class="token operator">|</span> watchdog <span class="token operator">|</span> idxbld
<em class="replaceable">param</em> <span class="token operator">:</span><span class="token operator">=</span> count<span class="token operator">=</span><em class="replaceable">number</em>
<span class="token operator">|</span> cpubind<span class="token operator">=</span><em class="replaceable">cpu_list</em>
<span class="token operator">|</span> cpuset<span class="token operator">=</span><em class="replaceable">cpu_list</em>
<span class="token operator">|</span> spintime<span class="token operator">=</span><em class="replaceable">number</em>
<span class="token operator">|</span> realtime<span class="token operator">=</span><span class="token punctuation">{</span>0<span class="token operator">|</span>1<span class="token punctuation">}</span>
<span class="token operator">|</span> nosend<span class="token operator">=</span><span class="token punctuation">{</span>0<span class="token operator">|</span>1<span class="token punctuation">}</span>
<span class="token operator">|</span> thread_prio<span class="token operator">=</span><span class="token punctuation">{</span>0<span class="token punctuation">.</span><span class="token punctuation">.</span>10<span class="token punctuation">}</span>
<span class="token operator">|</span> cpubind_exclusive<span class="token operator">=</span><em class="replaceable">cpu_list</em>
<span class="token operator">|</span> cpuset_exclusive<span class="token operator">=</span><em class="replaceable">cpu_list</em></code></pre>
</div>
<p>
The curly braces
(
<code class="literal">
{
</code>
...
<code class="literal">
}
</code>
) surrounding
the list of parameters are required, even if there is only
one parameter in the list.
</p>
<p>
A
<em class="replaceable">
<code>
param
</code>
</em>
(parameter) specifies any
or all of the following information:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
The number of threads of the given type
(
<code class="literal">
count
</code>
).
</p>
</li>
<li class="listitem">
<p>
The set of CPUs to which the threads of the given type
are to be nonexclusively bound. This is determined by
either one of
<code class="literal">
cpubind
</code>
or
<code class="literal">
cpuset
</code>
).
<code class="literal">
cpubind
</code>
causes each thread to be bound (nonexclusively) to a CPU
in the set;
<code class="literal">
cpuset
</code>
means that each
thread is bound (nonexclusively) to the set of CPUs
specified.
</p>
<p>
On Solaris, you can instead specify a set of CPUs to
which the threads of the given type are to be bound
exclusively.
<code class="literal">
cpubind_exclusive
</code>
causes
each thread to be bound exclusively to a CPU in the set;
<code class="literal">
cpuset_exclsuive
</code>
means that each
thread is bound exclusively to the set of CPUs
specified.
</p>
<p>
Only one of
<code class="literal">
cpubind
</code>
,
<code class="literal">
cpuset
</code>
,
<code class="literal">
cpubind_exclusive
</code>
, or
<code class="literal">
cpuset_exclusive
</code>
can be provided in a
single configuration.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
spintime
</code>
determines the wait time in
microseconds the thread spins before going to sleep.
</p>
<p>
The default value for
<code class="literal">
spintime
</code>
is the
value of the
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-schedulerspintimer">
<code class="literal">
SchedulerSpinTimer
</code>
</a>
data node configuration parameter.
</p>
<p>
<code class="literal">
spintime
</code>
does not apply to I/O
threads, watchdog, or offline index build threads, and
so cannot be set for these thread types.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
realtime
</code>
can be set to 0 or 1. If it
is set to 1, the threads run with real-time priority.
This also means that
<code class="literal">
thread_prio
</code>
cannot be set.
</p>
<p>
The
<code class="literal">
realtime
</code>
parameter is set by
default to the value of the
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-realtimescheduler">
<code class="literal">
RealtimeScheduler
</code>
</a>
data node configuration parameter.
</p>
<p>
<code class="literal">
realtime
</code>
cannot be set for offline
index build threads.
</p>
</li>
<li class="listitem">
<p>
By setting
<code class="literal">
nosend
</code>
to 1, you can
prevent a
<code class="literal">
main
</code>
,
<code class="literal">
ldm
</code>
,
<code class="literal">
rep
</code>
, or
<code class="literal">
tc
</code>
thread from assisting the send
threads. This parameter is 0 by default, and cannot be
used with other types of threads.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
thread_prio
</code>
is a thread priority
level that can be set from 0 to 10, with 10 representing
the greatest priority. The default is 5. The precise
effects of this parameter are platform-specific, and are
described later in this section.
</p>
<p>
The thread priority level cannot be set for offline
index build threads.
</p>
</li>
</ul>
</div>
<p>
<b>
thread_prio settings and effects by platform.
</b>
The implementation of
<code class="literal">
thread_prio
</code>
differs between Linux/FreeBSD, Solaris, and Windows. In
the following list, we discuss its effects on each of
these platforms in turn:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<span class="emphasis">
<em>
Linux and FreeBSD
</em>
</span>
: We map
<code class="literal">
thread_prio
</code>
to a value to be supplied
to the
<code class="literal">
nice
</code>
system call. Since a
lower niceness value for a process indicates a higher
process priority, increasing
<code class="literal">
thread_prio
</code>
has the effect of
lowering the
<code class="literal">
nice
</code>
value.
</p>
<div class="table">
<a name="idm46045115564368">
</a>
<p class="title">
<b>
Table 25.12 Mapping of thread_prio to nice values on Linux
and FreeBSD
</b>
</p>
<div class="table-contents">
<table>
<colgroup>
<col style="width: 50%"/>
<col style="width: 50%"/>
</colgroup>
<thead>
<tr>
<th>
<code class="literal">
thread_prio
</code>
value
</th>
<th>
<code class="literal">
nice
</code>
value
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
0
</td>
<td>
19
</td>
</tr>
<tr>
<td>
1
</td>
<td>
16
</td>
</tr>
<tr>
<td>
2
</td>
<td>
12
</td>
</tr>
<tr>
<td>
3
</td>
<td>
8
</td>
</tr>
<tr>
<td>
4
</td>
<td>
4
</td>
</tr>
<tr>
<td>
5
</td>
<td>
0
</td>
</tr>
<tr>
<td>
6
</td>
<td>
-4
</td>
</tr>
<tr>
<td>
7
</td>
<td>
-8
</td>
</tr>
<tr>
<td>
8
</td>
<td>
-12
</td>
</tr>
<tr>
<td>
9
</td>
<td>
-16
</td>
</tr>
<tr>
<td>
10
</td>
<td>
-20
</td>
</tr>
</tbody>
</table>
</div>
<div class="table-contents">
<table cellpadding="0" cellspacing="0" style="position: fixed; top: 0px; display: none; left: 461px; width: 279px;">
<thead>
<tr>
<th style="width: 138.953px;">
<code class="literal">
thread_prio
</code>
value
</th>
<th style="width: 138.953px;">
<code class="literal">
nice
</code>
value
</th>
</tr>
</thead>
</table>
</div>
</div>
<br class="table-break"/>
<p>
Some operating systems may provide for a maximum process
niceness level of 20, but this is not supported by all
targeted versions; for this reason, we choose 19 as the
maximum
<code class="literal">
nice
</code>
value that can be set.
</p>
</li>
<li class="listitem">
<p>
<span class="emphasis">
<em>
Solaris
</em>
</span>
: Setting
<code class="literal">
thread_prio
</code>
on Solaris sets the
Solaris FX priority, with mappings as shown in the
following table:
</p>
<div class="table">
<a name="idm46045115531040">
</a>
<p class="title">
<b>
Table 25.13 Mapping of thread_prio to FX priority on
Solaris
</b>
</p>
<div class="table-contents">
<table>
<colgroup>
<col style="width: 50%"/>
<col style="width: 50%"/>
</colgroup>
<thead>
<tr>
<th>
<code class="literal">
thread_prio
</code>
value
</th>
<th>
Solaris
<code class="literal">
FX
</code>
priority
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
0
</td>
<td>
15
</td>
</tr>
<tr>
<td>
1
</td>
<td>
20
</td>
</tr>
<tr>
<td>
2
</td>
<td>
25
</td>
</tr>
<tr>
<td>
3
</td>
<td>
30
</td>
</tr>
<tr>
<td>
4
</td>
<td>
35
</td>
</tr>
<tr>
<td>
5
</td>
<td>
40
</td>
</tr>
<tr>
<td>
6
</td>
<td>
45
</td>
</tr>
<tr>
<td>
7
</td>
<td>
50
</td>
</tr>
<tr>
<td>
8
</td>
<td>
55
</td>
</tr>
<tr>
<td>
9
</td>
<td>
59
</td>
</tr>
<tr>
<td>
10
</td>
<td>
60
</td>
</tr>
</tbody>
</table>
</div>
<div class="table-contents">
<table cellpadding="0" cellspacing="0" style="position: fixed; top: 0px; display: none; left: 461px; width: 279px;">
<thead>
<tr>
<th style="width: 138.953px;">
<code class="literal">
thread_prio
</code>
value
</th>
<th style="width: 138.953px;">
Solaris
<code class="literal">
FX
</code>
priority
</th>
</tr>
</thead>
</table>
</div>
</div>
<br class="table-break"/>
<p>
A
<code class="literal">
thread_prio
</code>
setting of 9 is mapped
on Solaris to the special FX priority value 59, which
means that the operating system also attempts to force
the thread to run alone on its own CPU core.
</p>
</li>
<li class="listitem">
<p>
<span class="emphasis">
<em>
Windows
</em>
</span>
: We map
<code class="literal">
thread_prio
</code>
to a Windows thread
priority value passed to the Windows API
<code class="literal">
SetThreadPriority()
</code>
function. This
mapping is shown in the following table:
</p>
<div class="table">
<a name="idm46045115497008">
</a>
<p class="title">
<b>
Table 25.14 Mapping of thread_prio to Windows thread
priority
</b>
</p>
<div class="table-contents">
<table>
<colgroup>
<col style="width: 50%"/>
<col style="width: 50%"/>
</colgroup>
<thead>
<tr>
<th>
<code class="literal">
thread_prio
</code>
value
</th>
<th>
Windows thread priority
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
0 - 1
</td>
<td>
<code class="literal">
THREAD_PRIORITY_LOWEST
</code>
</td>
</tr>
<tr>
<td>
2 - 3
</td>
<td>
<code class="literal">
THREAD_PRIORITY_BELOW_NORMAL
</code>
</td>
</tr>
<tr>
<td>
4 - 5
</td>
<td>
<code class="literal">
THREAD_PRIORITY_NORMAL
</code>
</td>
</tr>
<tr>
<td>
6 - 7
</td>
<td>
<code class="literal">
THREAD_PRIORITY_ABOVE_NORMAL
</code>
</td>
</tr>
<tr>
<td>
8 - 10
</td>
<td>
<code class="literal">
THREAD_PRIORITY_HIGHEST
</code>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br class="table-break"/>
</li>
</ul>
</div>
<p>
The
<em class="replaceable">
<code>
type
</code>
</em>
attribute represents an
NDB thread type. The thread types supported, and the range
of permitted
<code class="literal">
count
</code>
values for each, are
provided in the following list:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<code class="literal">
ldm
</code>
: Local query handler
(
<a class="ulink" href="/doc/ndb-internals/en/ndb-internals-kernel-blocks-dblqh.html" target="_top">
<code class="literal">
DBLQH
</code>
</a>
kernel block)
that handles data. The more LDM threads that are used,
the more highly partitioned the data becomes.
</p>
<p>
When
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbmtd-classicfragmentation">
<code class="literal">
ClassicFragmentation
</code>
</a>
is set to 0, the number of partitions is independent of
the number of LDM threads, and depends on the value of
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbmtd-partitionspernode">
<code class="literal">
PartitionsPerNode
</code>
</a>
instead.) Each LDM thread maintains its own sets of data
and index partitions, as well as its own redo log.
<code class="literal">
ldm
</code>
can be set to any value in the
range 0 to 332 inclusive. When setting it to 0,
<code class="literal">
main
</code>
,
<code class="literal">
rep
</code>
, and
<code class="literal">
tc
</code>
must also be 0, and
<code class="literal">
recv
</code>
must also be set to 1; doing
this causes
<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
</strong>
</span>
</a>
to emulate
<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
</strong>
</span>
</a>
.
</p>
<p>
Each LDM thread is normally grouped with 1 query thread
to form an LDM group. A set of 4 to 8 LDM groups is
grouped into a round robin groups. Each LDM thread can
be assisted in execution by any query or threads in the
same round robin group.
<code class="literal">
NDB
</code>
attempts
to form round robin groups such that all threads in each
round robin group are locked to CPUs that are attached
to the same L3 cache, within the limits of the range
stated for a round robin group's size.
</p>
<p>
Changing the number of LDM threads normally requires a
system restart to be effective and safe for cluster
operations; this requirement is relaxed in certain
cases, as explained later in this section. This is also
true when this is done using
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbmtd-maxnoofexecutionthreads">
<code class="literal">
MaxNoOfExecutionThreads
</code>
</a>
.
</p>
<p>
Adding large tablespaces (hundreds of gigabytes or more)
for Disk Data tables when using more than the default
number of LDMs may cause issues with resource and CPU
usage if
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-diskpagebuffermemory">
<code class="literal">
DiskPageBufferMemory
</code>
</a>
is not sufficiently large.
</p>
<p>
If
<code class="literal">
ldm
</code>
is not included in the
<code class="literal">
ThreadConfig
</code>
value string, one
<code class="literal">
ldm
</code>
thread is created.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
query
</code>
: A query thread is tied to an
LDM and together with it forms an LDM group; acts only
on
<a class="link" href="innodb-transaction-isolation-levels.html#isolevel_read-committed">
<code class="literal">
READ COMMITTED
</code>
</a>
queries. The number of query threads must be set to 0,
1, 2, or 3 times the number of LDM threads. Query
threads are not used, unless this is overridden by
setting
<code class="literal">
query
</code>
to a nonzero value, or
by enabling the
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbmtd-automaticthreadconfig">
<code class="literal">
AutomaticThreadConfig
</code>
</a>
parameter.
</p>
<p>
A query thread also acts as a recovery thread (see next
item), although the reverse is not true.
</p>
<p>
Changing the number of query threads requires a node
restart.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
recover
</code>
: A recovery thread restores
data from a fragment as part of an LCP.
</p>
<p>
Changing the number of recovery threads requires a node
restart.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
tc
</code>
: Transaction coordinator thread
(
<a class="ulink" href="/doc/ndb-internals/en/ndb-internals-kernel-blocks-dbtc.html" target="_top">
<code class="literal">
DBTC
</code>
</a>
kernel block)
containing the state of an ongoing transaction. The
maximum number of TC threads is 128.
</p>
<p>
Optimally, every new transaction can be assigned to a
new TC thread. In most cases 1 TC thread per 2 LDM
threads is sufficient to guarantee that this can happen.
In cases where the number of writes is relatively small
when compared to the number of reads, it is possible
that only 1 TC thread per 4 LQH threads is required to
maintain transaction states. Conversely, in applications
that perform a great many updates, it may be necessary
for the ratio of TC threads to LDM threads to approach 1
(for example, 3 TC threads to 4 LDM threads).
</p>
<p>
Setting
<code class="literal">
tc
</code>
to 0 causes TC handling to
be done by the main thread. In most cases, this is
effectively the same as setting it to 1.
</p>
<p>
Range: 0-64
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
main
</code>
: Data dictionary and transaction
coordinator (
<a class="ulink" href="/doc/ndb-internals/en/ndb-internals-kernel-blocks-dbdih.html" target="_top">
<code class="literal">
DBDIH
</code>
</a>
and
<a class="ulink" href="/doc/ndb-internals/en/ndb-internals-kernel-blocks-dbtc.html" target="_top">
<code class="literal">
DBTC
</code>
</a>
kernel
blocks), providing schema management. It is also
possible to specify zero or two main threads.
</p>
<p>
Range: 0-2.
</p>
<p>
Setting
<code class="literal">
main
</code>
to 0 and
<code class="literal">
rep
</code>
to 1 causes the
<code class="literal">
main
</code>
blocks to be placed into the
<code class="literal">
rep
</code>
thread; the combined thread is
shown in the
<a class="link" href="mysql-cluster-ndbinfo-threads.html" title="25.6.17.63 The ndbinfo threads Table">
<code class="literal">
ndbinfo.threads
</code>
</a>
table
as
<code class="literal">
main_rep
</code>
. This is effectively the
same as setting
<code class="literal">
rep
</code>
equal to 1 and
<code class="literal">
main
</code>
equal to 0.
</p>
<p>
It is also possible to set both
<code class="literal">
main
</code>
and
<code class="literal">
rep
</code>
to 0, in which case both
threads are placed in the first
<code class="literal">
recv
</code>
thread; the resulting combined thread is named
<code class="literal">
main_rep_recv
</code>
in the
<a class="link" href="mysql-cluster-ndbinfo-threads.html" title="25.6.17.63 The ndbinfo threads Table">
<code class="literal">
threads
</code>
</a>
table.
</p>
<p>
If
<code class="literal">
main
</code>
is omitted from the
<code class="literal">
ThreadConfig
</code>
value stringthis, one
<code class="literal">
main
</code>
thread is created.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
recv
</code>
: Receive thread
(
<a class="ulink" href="/doc/ndb-internals/en/ndb-internals-kernel-blocks-cmvmi.html" target="_top">
<code class="literal">
CMVMI
</code>
</a>
kernel
block). Each receive thread handles one or more sockets
for communicating with other nodes in an NDB Cluster,
with one socket per node. NDB Cluster supports multiple
receive threads; the maximum is 16 such threads.
</p>
<p>
Range: 1 - 64.
</p>
<p>
If
<code class="literal">
recv
</code>
is omitted from the
<code class="literal">
ThreadConfig
</code>
value string, one
<code class="literal">
recv
</code>
thread is created.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
send
</code>
: Send thread
(
<a class="ulink" href="/doc/ndb-internals/en/ndb-internals-kernel-blocks-cmvmi.html" target="_top">
<code class="literal">
CMVMI
</code>
</a>
kernel
block). To increase throughput, it is possible to
perform sends from one or more separate, dedicated
threads (maximum 8).
</p>
<p>
Using an excessive number of send threads can have an
adverse effect on scalability.
</p>
<p>
Previously, all threads handled their own sending
directly; this can still be made to happen by setting
the number of send threads to 0 (this also happens when
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbmtd-maxnoofexecutionthreads">
<code class="literal">
MaxNoOfExecutionThreads
</code>
</a>
is set less than 10). While doing so can have an adverse
impact on throughput, it can also in some cases provide
decreased latency.
</p>
<p>
Range:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: square; ">
<li class="listitem">
<p>
0 - 64
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
<code class="literal">
rep
</code>
: Replication thread
(
<a class="ulink" href="/doc/ndb-internals/en/ndb-internals-kernel-blocks-suma.html" target="_top">
<code class="literal">
SUMA
</code>
</a>
kernel block).
This thread can also be combined with the main thread
(see range information).
</p>
<p>
Range: 0-1.
</p>
<p>
Setting
<code class="literal">
rep
</code>
to 0 and
<code class="literal">
main
</code>
to 1 causes the
<code class="literal">
rep
</code>
blocks to be placed into the
<code class="literal">
main
</code>
thread; the combined thread is
shown in the
<a class="link" href="mysql-cluster-ndbinfo-threads.html" title="25.6.17.63 The ndbinfo threads Table">
<code class="literal">
ndbinfo.threads
</code>
</a>
table
as
<code class="literal">
main_rep
</code>
. This is effectively the
same as setting
<code class="literal">
main
</code>
equal to 1 and
<code class="literal">
rep
</code>
equal to 0.
</p>
<p>
It is also possible to set both
<code class="literal">
main
</code>
and
<code class="literal">
rep
</code>
to 0, in which case both
threads are placed in the first
<code class="literal">
recv
</code>
thread; the resulting combined thread is named
<code class="literal">
main_rep_recv
</code>
in the
<a class="link" href="mysql-cluster-ndbinfo-threads.html" title="25.6.17.63 The ndbinfo threads Table">
<code class="literal">
threads
</code>
</a>
table.
</p>
<p>
If
<code class="literal">
rep
</code>
is omitted from the
<code class="literal">
ThreadConfig
</code>
value string, one
<code class="literal">
rep
</code>
thread is created.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
io
</code>
: File system and other
miscellaneous operations. These are not demanding tasks,
and are always handled as a group by a single, dedicated
I/O thread.
</p>
<p>
Range: 1 only.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
watchdog
</code>
: Parameters settings
associated with this type are actually applied to
several threads, each having a specific use. These
threads include the
<code class="literal">
SocketServer
</code>
thread, which receives connection setups from other
nodes; the
<code class="literal">
SocketClient
</code>
thread, which
attempts to set up connections to other nodes; and the
thread watchdog thread that checks that threads are
progressing.
</p>
<p>
Range: 1 only.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
idxbld
</code>
: Offline index build threads.
Unlike the other thread types listed previously, which
are permanent, these are temporary threads which are
created and used only during node or system restarts, or
when running
<a class="link" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
<span class="command">
<strong>
ndb_restore
</strong>
</span>
</a>
<a class="link" href="mysql-cluster-programs-ndb-restore.html#option_ndb_restore_rebuild-indexes">
<code class="option">
--rebuild-indexes
</code>
</a>
.
They may be bound to CPU sets which overlap with CPU
sets bound to permanent thread types.
</p>
<p>
<code class="literal">
thread_prio
</code>
,
<code class="literal">
realtime
</code>
, and
<code class="literal">
spintime
</code>
values cannot be set for
offline index build threads. In addition,
<code class="literal">
count
</code>
is ignored for this type of
thread.
</p>
<p>
If
<code class="literal">
idxbld
</code>
is not specified, the
default behavior is as follows:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: square; ">
<li class="listitem">
<p>
Offline index build threads are not bound if the I/O
thread is also not bound, and these threads use any
available cores.
</p>
</li>
<li class="listitem">
<p>
If the I/O thread is bound, then the offline index
build threads are bound to the entire set of bound
threads, due to the fact that there should be no
other tasks for these threads to perform.
</p>
</li>
</ul>
</div>
<p>
Range: 0 - 1.
</p>
</li>
</ul>
</div>
<p>
Changing
<code class="literal">
ThreadCOnfig
</code>
normally requires a
system initial restart, but this requirement can be relaxed
under certain circumstances:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
If, following the change, the number of LDM threads
remains the same as before, nothing more than a simple
node restart (rolling restart, or
<span class="emphasis">
<em>
N
</em>
</span>
) is required to implement the
change.
</p>
</li>
<li class="listitem">
<p>
Otherwise (that is, if the number of LDM threads
changes), it is still possible to effect the change
using a node initial restart (
<span class="emphasis">
<em>
NI
</em>
</span>
)
provided the following two conditions are met:
</p>
<div class="orderedlist">
<ol class="orderedlist" type="a">
<li class="listitem">
<p>
Each LDM thread handles a maximum of 8 fragments,
and
</p>
</li>
<li class="listitem">
<p>
The total number of table fragments is an integer
multiple of the number of LDM threads.
</p>
</li>
</ol>
</div>
</li>
</ul>
</div>
<p>
In any other case, a system initial restart is needed to
change this parameter.
</p>
<p>
<code class="literal">
NDB
</code>
can distinguish between thread types
by both of the following criteria:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
Whether the thread is an execution thread. Threads of
type
<code class="literal">
main
</code>
,
<code class="literal">
ldm
</code>
,
<code class="literal">
query
</code>
,
<code class="literal">
recv
</code>
,
<code class="literal">
rep
</code>
,
<code class="literal">
tc
</code>
, and
<code class="literal">
send
</code>
are execution threads;
<code class="literal">
io
</code>
,
<code class="literal">
recover
</code>
,
<code class="literal">
watchdog
</code>
, and
<code class="literal">
idxbld
</code>
threads are not considered
execution threads.
</p>
</li>
<li class="listitem">
<p>
Whether the allocation of threads to a given task is
permanent or temporary. Currently all thread types
except
<code class="literal">
idxbld
</code>
are considered
permanent;
<code class="literal">
idxbld
</code>
threads are
regarded as temporary threads.
</p>
</li>
</ul>
</div>
<p>
Simple examples:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-ini"><div class="docs-select-all right" id="sa52710965"><div class="copy-help left">Press ⌘+C to 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 comment" spellcheck="true"># Example 1.</span>
<span class="token constant">ThreadConfig</span><span class="token attr-value"><span class="token punctuation">=</span>ldm={count=2,cpubind=1,2},main={cpubind=12},rep={cpubind=11}</span>
<span class="token comment" spellcheck="true"># Example 2.</span>
<span class="token constant">Threadconfig</span><span class="token attr-value"><span class="token punctuation">=</span>main={cpubind=0},ldm={count=4,cpubind=1,2,5,6},io={cpubind=3}</span></code></pre>
</div>
<p>
It is usually desirable when configuring thread usage for a
data node host to reserve one or more number of CPUs for
operating system and other tasks. Thus, for a host machine
with 24 CPUs, you might want to use 20 CPU threads (leaving
4 for other uses), with 8 LDM threads, 4 TC threads (half
the number of LDM threads), 3 send threads, 3 receive
threads, and 1 thread each for schema management,
asynchronous replication, and I/O operations. (This is
almost the same distribution of threads used when
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbmtd-maxnoofexecutionthreads">
<code class="literal">
MaxNoOfExecutionThreads
</code>
</a>
is set equal to 20.) The following
<code class="literal">
ThreadConfig
</code>
setting performs these
assignments, additionally binding all of these threads to
specific CPUs:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-ini"><div class="docs-select-all right" id="sa84238333"><div class="copy-help left">Press ⌘+C to 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">ThreadConfig</span><span class="token attr-value"><span class="token punctuation">=</span>ldm{count=8,cpubind=1,2,3,4,5,6,7,8},main={cpubind=9},io={cpubind=9}, \</span>
<span class="token constant">rep</span><span class="token attr-value"><span class="token punctuation">=</span>{cpubind=10},tc{count=4,cpubind=11,12,13,14},recv={count=3,cpubind=15,16,17}, \</span>
<span class="token constant">send{count</span><span class="token attr-value"><span class="token punctuation">=</span>3,cpubind=18,19,20}</span></code></pre>
</div>
<p>
It should be possible in most cases to bind the main (schema
management) thread and the I/O thread to the same CPU, as we
have done in the example just shown.
</p>
<p>
The following example incorporates groups of CPUs defined
using both
<code class="literal">
cpuset
</code>
and
<code class="literal">
cpubind
</code>
, as well as use of thread
prioritization.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-ini"><div class="docs-select-all right" id="sa3663640"><div class="copy-help left">Press ⌘+C to 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">ThreadConfig</span><span class="token attr-value"><span class="token punctuation">=</span>ldm={count=4,cpuset=0-3,thread_prio=8,spintime=200}, \</span>
<span class="token constant">ldm</span><span class="token attr-value"><span class="token punctuation">=</span>{count=4,cpubind=4-7,thread_prio=8,spintime=200}, \</span>
<span class="token constant">tc</span><span class="token attr-value"><span class="token punctuation">=</span>{count=4,cpuset=8-9,thread_prio=6},send={count=2,thread_prio=10,cpubind=10-11}, \</span>
<span class="token constant">main</span><span class="token attr-value"><span class="token punctuation">=</span>{count=1,cpubind=10},rep={count=1,cpubind=11}</span></code></pre>
</div>
<p>
In this case we create two LDM groups; the first uses
<code class="literal">
cpubind
</code>
and the second uses
<code class="literal">
cpuset
</code>
.
<code class="literal">
thread_prio
</code>
and
<code class="literal">
spintime
</code>
are set to the same values
for each group. This means there are eight LDM threads in
total. (You should ensure that
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbmtd-nooffragmentlogparts">
<code class="literal">
NoOfFragmentLogParts
</code>
</a>
is also set to 8.) The four TC threads use only two CPUs; it
is possible when using
<code class="literal">
cpuset
</code>
to specify
fewer CPUs than threads in the group. (This is not true for
<code class="literal">
cpubind
</code>
.) The send threads use two
threads using
<code class="literal">
cpubind
</code>
to bind these
threads to CPUs 10 and 11. The main and rep threads can
reuse these CPUs.
</p>
<p>
This example shows how
<code class="literal">
ThreadConfig
</code>
and
<code class="literal">
NoOfFragmentLogParts
</code>
might be set up for
a 24-CPU host with hyperthreading, leaving CPUs 10, 11, 22,
and 23 available for operating system functions and
interrupts:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-ini"><div class="docs-select-all right" id="sa38083312"><div class="copy-help left">Press ⌘+C to 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">NoOfFragmentLogParts</span><span class="token attr-value"><span class="token punctuation">=</span>10</span>
<span class="token constant">ThreadConfig</span><span class="token attr-value"><span class="token punctuation">=</span>ldm={count=10,cpubind=0-4,12-16,thread_prio=9,spintime=200}, \</span>
<span class="token constant">tc</span><span class="token attr-value"><span class="token punctuation">=</span>{count=4,cpuset=6-7,18-19,thread_prio=8},send={count=1,cpuset=8}, \</span>
<span class="token constant">recv</span><span class="token attr-value"><span class="token punctuation">=</span>{count=1,cpuset=20},main={count=1,cpuset=9,21},rep={count=1,cpuset=9,21}, \</span>
<span class="token constant">io</span><span class="token attr-value"><span class="token punctuation">=</span>{count=1,cpuset=9,21,thread_prio=8},watchdog={count=1,cpuset=9,21,thread_prio=9}</span></code></pre>
</div>
<p>
The next few examples include settings for
<code class="literal">
idxbld
</code>
. The first two of these
demonstrate how a CPU set defined for
<code class="literal">
idxbld
</code>
can overlap those specified for
other (permanent) thread types, the first using
<code class="literal">
cpuset
</code>
and the second using
<code class="literal">
cpubind
</code>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-ini"><div class="docs-select-all right" id="sa61982572"><div class="copy-help left">Press ⌘+C to 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">ThreadConfig</span><span class="token attr-value"><span class="token punctuation">=</span>main,ldm={count=4,cpuset=1-4},tc={count=4,cpuset=5,6,7}, \</span>
<span class="token constant">io</span><span class="token attr-value"><span class="token punctuation">=</span>{cpubind=8},idxbld={cpuset=1-8}</span>
<span class="token constant">ThreadConfig</span><span class="token attr-value"><span class="token punctuation">=</span>main,ldm={count=1,cpubind=1},idxbld={count=1,cpubind=1}</span></code></pre>
</div>
<p>
The next example specifies a CPU for the I/O thread, but not
for the index build threads:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-ini"><div class="docs-select-all right" id="sa64139597"><div class="copy-help left">Press ⌘+C to 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">ThreadConfig</span><span class="token attr-value"><span class="token punctuation">=</span>main,ldm={count=4,cpuset=1-4},tc={count=4,cpuset=5,6,7}, \</span>
<span class="token constant">io</span><span class="token attr-value"><span class="token punctuation">=</span>{cpubind=8}</span></code></pre>
</div>
<p>
Since the
<code class="literal">
ThreadConfig
</code>
setting just shown
locks threads to eight cores numbered 1 through 8, it is
equivalent to the setting shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-ini"><div class="docs-select-all right" id="sa19694019"><div class="copy-help left">Press ⌘+C to 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">ThreadConfig</span><span class="token attr-value"><span class="token punctuation">=</span>main,ldm={count=4,cpuset=1-4},tc={count=4,cpuset=5,6,7}, \</span>
<span class="token constant">io</span><span class="token attr-value"><span class="token punctuation">=</span>{cpubind=8},idxbld={cpuset=1,2,3,4,5,6,7,8}</span></code></pre>
</div>
<p>
In order to take advantage of the enhanced stability that
the use of
<code class="literal">
ThreadConfig
</code>
offers, it is
necessary to insure that CPUs are isolated, and that they
not subject to interrupts, or to being scheduled for other
tasks by the operating system. On many Linux systems, you
can do this by setting
<code class="literal">
IRQBALANCE_BANNED_CPUS
</code>
in
<code class="filename">
/etc/sysconfig/irqbalance
</code>
to
<code class="literal">
0xFFFFF0
</code>
, and by using the
<code class="literal">
isolcpus
</code>
boot option in
<code class="filename">
grub.conf
</code>
. For specific information,
see your operating system or platform documentation.
</p>
</li>
</ul>
</div>
<p>
<a name="mysql-cluster-ndbd-definition-disk-data-parameters">
</a>
<b>
Disk Data Configuration Parameters.
</b>
Configuration parameters affecting Disk Data behavior include
the following:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a name="ndbparam-ndbd-diskpagebufferentries">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-diskpagebufferentries">
<code class="literal">
DiskPageBufferEntries
</code>
</a>
</p>
<a class="indexterm" name="idm46045115314800">
</a>
<div class="informaltable">
<a name="diskpagebufferentries-ndbd-table">
</a>
<table frame="box" rules="all" summary="DiskPageBufferEntries data node 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>
bytes
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
64MB
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
4MB - 16TB
</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 number of page entries (page references) to
allocate. It is specified as a number of 32K pages in
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-diskpagebuffermemory">
<code class="literal">
DiskPageBufferMemory
</code>
</a>
.
The default is sufficient for most cases but you may need to
increase the value of this parameter if you encounter
problems with very large transactions on Disk Data tables.
Each page entry requires approximately 100 bytes.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-diskpagebuffermemory">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-diskpagebuffermemory">
<code class="literal">
DiskPageBufferMemory
</code>
</a>
</p>
<a class="indexterm" name="idm46045115292736">
</a>
<div class="informaltable">
<a name="diskpagebuffermemory-ndbd-table">
</a>
<table frame="box" rules="all" summary="DiskPageBufferMemory data node 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>
bytes
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
64M
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
4M - 16T
</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 determines the amount of space, in bytes, used for
caching pages on disk, and is set in the
<code class="literal">
[ndbd]
</code>
or
<code class="literal">
[ndbd
default]
</code>
section of the
<code class="filename">
config.ini
</code>
file.
</p>
<p>
If the value for
<code class="literal">
DiskPageBufferMemory
</code>
is
set too low in conjunction with using more than the default
number of LDM threads in
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbmtd-threadconfig">
<code class="literal">
ThreadConfig
</code>
</a>
(for
example
<code class="literal">
{ldm=6...}
</code>
), problems can arise
when trying to add a large (for example 500G) data file to a
disk-based
<code class="literal">
NDB
</code>
table, wherein the process
takes indefinitely long while occupying one of the CPU
cores.
</p>
<p>
This is due to the fact that, as part of adding a data file
to a tablespace, extent pages are locked into memory in an
extra PGMAN worker thread, for quick metadata access. When
adding a large file, this worker has insufficient memory for
all of the data file metadata. In such cases, you should
either increase
<code class="literal">
DiskPageBufferMemory
</code>
, or
add smaller tablespace files. You may also need to adjust
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-diskpagebufferentries">
<code class="literal">
DiskPageBufferEntries
</code>
</a>
.
</p>
<p>
You can query the
<a class="link" href="mysql-cluster-ndbinfo-diskpagebuffer.html" title="25.6.17.31 The ndbinfo diskpagebuffer Table">
<code class="literal">
ndbinfo.diskpagebuffer
</code>
</a>
table to help determine whether the value for this parameter
should be increased to minimize unnecessary disk seeks. See
<a class="xref" href="mysql-cluster-ndbinfo-diskpagebuffer.html" title="25.6.17.31 The ndbinfo diskpagebuffer Table">
Section 25.6.17.31, “The ndbinfo diskpagebuffer Table”
</a>
, for
more information.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-sharedglobalmemory">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-sharedglobalmemory">
<code class="literal">
SharedGlobalMemory
</code>
</a>
</p>
<a class="indexterm" name="idm46045115260304">
</a>
<div class="informaltable">
<a name="sharedglobalmemory-ndbd-table">
</a>
<table frame="box" rules="all" summary="SharedGlobalMemory data node 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>
bytes
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
128M
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
0 - 64T
</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 parameter determines the amount of memory that is used
for log buffers, disk operations (such as page requests and
wait queues), and metadata for tablespaces, log file groups,
<code class="literal">
UNDO
</code>
files, and data files. The shared
global memory pool also provides memory used for satisfying
the memory requirements of the
<code class="literal">
UNDO_BUFFER_SIZE
</code>
option used with
<a class="link" href="create-logfile-group.html" title="15.1.16 CREATE LOGFILE GROUP Statement">
<code class="literal">
CREATE LOGFILE GROUP
</code>
</a>
and
<a class="link" href="alter-logfile-group.html" title="15.1.6 ALTER LOGFILE GROUP Statement">
<code class="literal">
ALTER LOGFILE GROUP
</code>
</a>
statements, including any default value implied for this
options by the setting of the
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-initiallogfilegroup">
<code class="literal">
InitialLogFileGroup
</code>
</a>
data node configuration parameter.
<code class="literal">
SharedGlobalMemory
</code>
can be set in the
<code class="literal">
[ndbd]
</code>
or
<code class="literal">
[ndbd
default]
</code>
section of the
<code class="filename">
config.ini
</code>
configuration file, and is
measured in bytes.
</p>
<p>
The default value is
<code class="literal">
128M
</code>
.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-diskiothreadpool">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-diskiothreadpool">
<code class="literal">
DiskIOThreadPool
</code>
</a>
</p>
<a class="indexterm" name="idm46045115230016">
</a>
<a class="indexterm" name="idm46045115228944">
</a>
<div class="informaltable">
<a name="diskiothreadpool-ndbd-table">
</a>
<table frame="box" rules="all" summary="DiskIOThreadPool data node 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>
threads
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
2
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
0 - 4294967039 (0xFFFFFEFF)
</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 parameter determines the number of unbound threads used
for Disk Data file access. Before
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-diskiothreadpool">
<code class="literal">
DiskIOThreadPool
</code>
</a>
was
introduced, exactly one thread was spawned for each Disk
Data file, which could lead to performance issues,
particularly when using very large data files. With
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-diskiothreadpool">
<code class="literal">
DiskIOThreadPool
</code>
</a>
,
you can—for example—access a single large data
file using several threads working in parallel.
</p>
<p>
This parameter applies to Disk Data I/O threads only.
</p>
<p>
The optimum value for this parameter depends on your
hardware and configuration, and includes these factors:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<b>
Physical distribution of Disk Data files.
</b>
You can obtain better performance by placing data
files, undo log files, and the data node file system
on separate physical disks. If you do this with some
or all of these sets of files, then you can (and
should) set
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-diskiothreadpool">
<code class="literal">
DiskIOThreadPool
</code>
</a>
higher to enable separate threads to handle the files
on each disk.
</p>
<p>
You should also disable
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-diskdatausingsamedisk">
<code class="literal">
DiskDataUsingSameDisk
</code>
</a>
when using a separate disk or disks for Disk Data files;
this increases the rate at which checkpoints of Disk
Data tablespaces can be performed.
</p>
</li>
<li class="listitem">
<p>
<b>
Disk performance and types.
</b>
The number of threads that can be accommodated for
Disk Data file handling is also dependent on the speed
and throughput of the disks. Faster disks and higher
throughput allow for more disk I/O threads. Our test
results indicate that solid-state disk drives can
handle many more disk I/O threads than conventional
disks, and thus higher values for
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-diskiothreadpool">
<code class="literal">
DiskIOThreadPool
</code>
</a>
.
</p>
<p>
Decreasing
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-timebetweenglobalcheckpoints">
<code class="literal">
TimeBetweenGlobalCheckpoints
</code>
</a>
is also recommended when using solid-state disk drives,
in particular those using NVMe. See also
<a class="xref" href="mysql-cluster-ndbd-definition.html#mysql-cluster-ndbd-definition-disk-data-latency-parameters" title="Disk Data latency parameters">
Disk Data latency parameters
</a>
.
</p>
</li>
</ul>
</div>
<p>
The default value for this parameter is 2.
</p>
</li>
<li class="listitem">
<p>
<a name="mysql-cluster-ndbd-disk-data-filesystem-parameters">
</a>
<b>
Disk Data file system parameters.
</b>
The parameters in the following list make it possible to
place NDB Cluster Disk Data files in specific directories
without the need for using symbolic links.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<a name="ndbparam-ndbd-filesystempathdd">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-filesystempathdd">
<code class="literal">
FileSystemPathDD
</code>
</a>
</p>
<a class="indexterm" name="idm46045115189408">
</a>
<div class="informaltable">
<a name="filesystempathdd-ndbd-table">
</a>
<table frame="box" rules="all" summary="FileSystemPathDD data node 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>
filename
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
FileSystemPath
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
...
</td>
</tr>
<tr>
<th>
Restart Type
</th>
<td>
<p>
<span class="bold">
<strong>
Initial 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; each data node
must be restarted with
<a class="link" href="mysql-cluster-programs-ndbd.html#option_ndbd_initial">
<code class="option">
--initial
</code>
</a>
. (NDB
8.4.0)
</p>
</td>
</tr>
</tbody>
</table>
</div>
<p>
If this parameter is specified, then NDB Cluster Disk
Data data files and undo log files are placed in the
indicated directory. This can be overridden for data
files, undo log files, or both, by specifying values for
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-filesystempathdatafiles">
<code class="literal">
FileSystemPathDataFiles
</code>
</a>
,
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-filesystempathundofiles">
<code class="literal">
FileSystemPathUndoFiles
</code>
</a>
,
or both, as explained for these parameters. It can also
be overridden for data files by specifying a path in the
<code class="literal">
ADD DATAFILE
</code>
clause of a
<a class="link" href="create-tablespace.html" title="15.1.21 CREATE TABLESPACE Statement">
<code class="literal">
CREATE TABLESPACE
</code>
</a>
or
<a class="link" href="alter-tablespace.html" title="15.1.10 ALTER TABLESPACE Statement">
<code class="literal">
ALTER TABLESPACE
</code>
</a>
statement, and for undo log files by specifying a path
in the
<code class="literal">
ADD UNDOFILE
</code>
clause of a
<a class="link" href="create-logfile-group.html" title="15.1.16 CREATE LOGFILE GROUP Statement">
<code class="literal">
CREATE LOGFILE GROUP
</code>
</a>
or
<a class="link" href="alter-logfile-group.html" title="15.1.6 ALTER LOGFILE GROUP Statement">
<code class="literal">
ALTER LOGFILE GROUP
</code>
</a>
statement. If
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-filesystempathdd">
<code class="literal">
FileSystemPathDD
</code>
</a>
is not specified, then
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-filesystempath">
<code class="literal">
FileSystemPath
</code>
</a>
is used.
</p>
<p>
If a
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-filesystempathdd">
<code class="literal">
FileSystemPathDD
</code>
</a>
directory is specified for a given data node (including
the case where the parameter is specified in the
<code class="literal">
[ndbd default]
</code>
section of the
<code class="filename">
config.ini
</code>
file), then starting
that data node with
<code class="option">
--initial
</code>
causes
all files in the directory to be deleted.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-filesystempathdatafiles">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-filesystempathdatafiles">
<code class="literal">
FileSystemPathDataFiles
</code>
</a>
</p>
<a class="indexterm" name="idm46045115152032">
</a>
<div class="informaltable">
<a name="filesystempathdatafiles-ndbd-table">
</a>
<table frame="box" rules="all" summary="FileSystemPathDataFiles data node 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>
filename
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
FileSystemPathDD
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
...
</td>
</tr>
<tr>
<th>
Restart Type
</th>
<td>
<p>
<span class="bold">
<strong>
Initial 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; each data node
must be restarted with
<a class="link" href="mysql-cluster-programs-ndbd.html#option_ndbd_initial">
<code class="option">
--initial
</code>
</a>
. (NDB
8.4.0)
</p>
</td>
</tr>
</tbody>
</table>
</div>
<p>
If this parameter is specified, then NDB Cluster Disk
Data data files are placed in the indicated directory.
This overrides any value set for
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-filesystempathdd">
<code class="literal">
FileSystemPathDD
</code>
</a>
.
This parameter can be overridden for a given data file
by specifying a path in the
<code class="literal">
ADD
DATAFILE
</code>
clause of a
<a class="link" href="create-tablespace.html" title="15.1.21 CREATE TABLESPACE Statement">
<code class="literal">
CREATE TABLESPACE
</code>
</a>
or
<a class="link" href="alter-tablespace.html" title="15.1.10 ALTER TABLESPACE Statement">
<code class="literal">
ALTER TABLESPACE
</code>
</a>
statement used to create that data file. If
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-filesystempathdatafiles">
<code class="literal">
FileSystemPathDataFiles
</code>
</a>
is not specified, then
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-filesystempathdd">
<code class="literal">
FileSystemPathDD
</code>
</a>
is used (or
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-filesystempath">
<code class="literal">
FileSystemPath
</code>
</a>
,
if
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-filesystempathdd">
<code class="literal">
FileSystemPathDD
</code>
</a>
has also not been set).
</p>
<p>
If a
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-filesystempathdatafiles">
<code class="literal">
FileSystemPathDataFiles
</code>
</a>
directory is specified for a given data node (including
the case where the parameter is specified in the
<code class="literal">
[ndbd default]
</code>
section of the
<code class="filename">
config.ini
</code>
file), then starting
that data node with
<code class="option">
--initial
</code>
causes
all files in the directory to be deleted.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-filesystempathundofiles">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-filesystempathundofiles">
<code class="literal">
FileSystemPathUndoFiles
</code>
</a>
</p>
<a class="indexterm" name="idm46045115116720">
</a>
<div class="informaltable">
<a name="filesystempathundofiles-ndbd-table">
</a>
<table frame="box" rules="all" summary="FileSystemPathUndoFiles data node 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>
filename
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
FileSystemPathDD
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
...
</td>
</tr>
<tr>
<th>
Restart Type
</th>
<td>
<p>
<span class="bold">
<strong>
Initial 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; each data node
must be restarted with
<a class="link" href="mysql-cluster-programs-ndbd.html#option_ndbd_initial">
<code class="option">
--initial
</code>
</a>
. (NDB
8.4.0)
</p>
</td>
</tr>
</tbody>
</table>
</div>
<p>
If this parameter is specified, then NDB Cluster Disk
Data undo log files are placed in the indicated
directory. This overrides any value set for
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-filesystempathdd">
<code class="literal">
FileSystemPathDD
</code>
</a>
.
This parameter can be overridden for a given data file
by specifying a path in the
<code class="literal">
ADD UNDO
</code>
clause of a
<a class="link" href="create-logfile-group.html" title="15.1.16 CREATE LOGFILE GROUP Statement">
<code class="literal">
CREATE LOGFILE
GROUP
</code>
</a>
or
<a class="link" href="alter-logfile-group.html" title="15.1.6 ALTER LOGFILE GROUP Statement">
<code class="literal">
ALTER LOGFILE
GROUP
</code>
</a>
statement used to create that data file.
If
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-filesystempathundofiles">
<code class="literal">
FileSystemPathUndoFiles
</code>
</a>
is not specified, then
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-filesystempathdd">
<code class="literal">
FileSystemPathDD
</code>
</a>
is used (or
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-filesystempath">
<code class="literal">
FileSystemPath
</code>
</a>
,
if
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-filesystempathdd">
<code class="literal">
FileSystemPathDD
</code>
</a>
has also not been set).
</p>
<p>
If a
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-filesystempathundofiles">
<code class="literal">
FileSystemPathUndoFiles
</code>
</a>
directory is specified for a given data node (including
the case where the parameter is specified in the
<code class="literal">
[ndbd default]
</code>
section of the
<code class="filename">
config.ini
</code>
file), then starting
that data node with
<code class="option">
--initial
</code>
causes
all files in the directory to be deleted.
</p>
</li>
</ul>
</div>
<p>
For more information, see
<a class="xref" href="mysql-cluster-disk-data-objects.html" title="25.6.11.1 NDB Cluster Disk Data Objects">
Section 25.6.11.1, “NDB Cluster Disk Data Objects”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<a name="mysql-cluster-ndbd-disk-data-object-creation-parameters">
</a>
<b>
Disk Data object creation parameters.
</b>
The next two parameters enable you—when starting the
cluster for the first time—to cause a Disk Data log
file group, tablespace, or both, to be created without the
use of SQL statements.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<a name="ndbparam-ndbd-initiallogfilegroup">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-initiallogfilegroup">
<code class="literal">
InitialLogFileGroup
</code>
</a>
</p>
<a class="indexterm" name="idm46045115077360">
</a>
<div class="informaltable">
<a name="initiallogfilegroup-ndbd-table">
</a>
<table frame="box" rules="all" summary="InitialLogFileGroup data node 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>
[see documentation]
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
...
</td>
</tr>
<tr>
<th>
Restart Type
</th>
<td>
<p>
<span class="bold">
<strong>
System Restart:
</strong>
</span>
Requires a complete shutdown and
restart of the cluster. (NDB 8.4.0)
</p>
</td>
</tr>
</tbody>
</table>
</div>
<p>
This parameter can be used to specify a log file group
that is created when performing an initial start of the
cluster.
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-initiallogfilegroup">
<code class="literal">
InitialLogFileGroup
</code>
</a>
is specified as shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-simple"><div class="docs-select-all right" id="sa65378740"><div class="copy-help left">Press ⌘+C to 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">InitialLogFileGroup <span class="token operator">=</span> <span class="token punctuation">[</span>name<span class="token operator">=</span><em class="replaceable">name</em><span class="token punctuation">;</span><span class="token punctuation">]</span> <span class="token punctuation">[</span>undo_buffer_size<span class="token operator">=</span><em class="replaceable">size</em><span class="token punctuation">;</span><span class="token punctuation">]</span> <em class="replaceable">file<span class="token operator">-</span>specification<span class="token operator">-</span>list</em>
<em class="replaceable">file<span class="token operator">-</span>specification<span class="token operator">-</span>list</em><span class="token operator">:</span>
<em class="replaceable">file<span class="token operator">-</span>specification</em><span class="token punctuation">[</span><span class="token punctuation">;</span> <em class="replaceable">file<span class="token operator">-</span>specification</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>
<em class="replaceable">file<span class="token operator">-</span>specification</em><span class="token operator">:</span>
<em class="replaceable">filename</em><span class="token operator">:</span><em class="replaceable">size</em></code></pre>
</div>
<p>
The
<code class="literal">
name
</code>
of the log file group is
optional and defaults to
<code class="literal">
DEFAULT-LG
</code>
.
The
<code class="literal">
undo_buffer_size
</code>
is also
optional; if omitted, it defaults to
<code class="literal">
64M
</code>
. Each
<em class="replaceable">
<code>
file-specification
</code>
</em>
corresponds to an undo log file, and at least one must
be specified in the
<em class="replaceable">
<code>
file-specification-list
</code>
</em>
. Undo
log files are placed according to any values that have
been set for
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-filesystempath">
<code class="literal">
FileSystemPath
</code>
</a>
,
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-filesystempathdd">
<code class="literal">
FileSystemPathDD
</code>
</a>
,
and
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-filesystempathundofiles">
<code class="literal">
FileSystemPathUndoFiles
</code>
</a>
,
just as if they had been created as the result of a
<a class="link" href="create-logfile-group.html" title="15.1.16 CREATE LOGFILE GROUP Statement">
<code class="literal">
CREATE LOGFILE GROUP
</code>
</a>
or
<a class="link" href="alter-logfile-group.html" title="15.1.6 ALTER LOGFILE GROUP Statement">
<code class="literal">
ALTER LOGFILE GROUP
</code>
</a>
statement.
</p>
<p>
Consider the following:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-ini"><div class="docs-select-all right" id="sa83681432"><div class="copy-help left">Press ⌘+C to 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">InitialLogFileGroup</span> <span class="token attr-value"><span class="token punctuation">=</span> name=LG1; undo_buffer_size=128M; undo1.log:250M; undo2.log:150M</span></code></pre>
</div>
<p>
This is equivalent to the following SQL statements:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa25892640"><div class="copy-help left">Press ⌘+C to 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">LOGFILE</span> <span class="token keyword">GROUP</span> LG1
<span class="token keyword">ADD</span> <span class="token keyword">UNDOFILE</span> <span class="token string">'undo1.log'</span>
<span class="token keyword">INITIAL_SIZE</span> 250M
<span class="token keyword">UNDO_BUFFER_SIZE</span> 128M
<span class="token keyword">ENGINE</span> <span class="token keyword">NDBCLUSTER</span><span class="token punctuation">;</span>
<span class="token keyword">ALTER</span> <span class="token keyword">LOGFILE</span> <span class="token keyword">GROUP</span> LG1
<span class="token keyword">ADD</span> <span class="token keyword">UNDOFILE</span> <span class="token string">'undo2.log'</span>
<span class="token keyword">INITIAL_SIZE</span> 150M
<span class="token keyword">ENGINE</span> <span class="token keyword">NDBCLUSTER</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
This logfile group is created when the data nodes are
started with
<code class="option">
--initial
</code>
.
</p>
<p>
Resources for the initial log file group are added to
the global memory pool along with those indicated by the
value of
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-sharedglobalmemory">
<code class="literal">
SharedGlobalMemory
</code>
</a>
.
</p>
<p>
This parameter, if used, should always be set in the
<code class="literal">
[ndbd default]
</code>
section of the
<code class="filename">
config.ini
</code>
file. The behavior of an
NDB Cluster when different values are set on different
data nodes is not defined.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-initialtablespace">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-initialtablespace">
<code class="literal">
InitialTablespace
</code>
</a>
</p>
<a class="indexterm" name="idm46045115032576">
</a>
<div class="informaltable">
<a name="initialtablespace-ndbd-table">
</a>
<table frame="box" rules="all" summary="InitialTablespace data node 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>
[see documentation]
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
...
</td>
</tr>
<tr>
<th>
Restart Type
</th>
<td>
<p>
<span class="bold">
<strong>
System Restart:
</strong>
</span>
Requires a complete shutdown and
restart of the cluster. (NDB 8.4.0)
</p>
</td>
</tr>
</tbody>
</table>
</div>
<p>
This parameter can be used to specify an NDB Cluster
Disk Data tablespace that is created when performing an
initial start of the cluster.
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-initialtablespace">
<code class="literal">
InitialTablespace
</code>
</a>
is specified as shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-ini"><div class="docs-select-all right" id="sa17517106"><div class="copy-help left">Press ⌘+C to 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">InitialTablespace</span> <span class="token attr-value"><span class="token punctuation">=</span> [name=<em class="replaceable">name</em>;] [extent_size=<em class="replaceable">size</em>;] <em class="replaceable">file-specification-list</em></span></code></pre>
</div>
<p>
The
<code class="literal">
name
</code>
of the tablespace is
optional and defaults to
<code class="literal">
DEFAULT-TS
</code>
.
The
<code class="literal">
extent_size
</code>
is also optional; it
defaults to
<code class="literal">
1M
</code>
. The
<em class="replaceable">
<code>
file-specification-list
</code>
</em>
uses
the same syntax as shown with the
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-initiallogfilegroup">
<code class="literal">
InitialLogfileGroup
</code>
</a>
parameter, the only difference being that each
<em class="replaceable">
<code>
file-specification
</code>
</em>
used with
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-initialtablespace">
<code class="literal">
InitialTablespace
</code>
</a>
corresponds to a data file. At least one must be
specified in the
<em class="replaceable">
<code>
file-specification-list
</code>
</em>
. Data
files are placed according to any values that have been
set for
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-filesystempath">
<code class="literal">
FileSystemPath
</code>
</a>
,
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-filesystempathdd">
<code class="literal">
FileSystemPathDD
</code>
</a>
,
and
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-filesystempathdatafiles">
<code class="literal">
FileSystemPathDataFiles
</code>
</a>
,
just as if they had been created as the result of a
<a class="link" href="create-tablespace.html" title="15.1.21 CREATE TABLESPACE Statement">
<code class="literal">
CREATE TABLESPACE
</code>
</a>
or
<a class="link" href="alter-tablespace.html" title="15.1.10 ALTER TABLESPACE Statement">
<code class="literal">
ALTER TABLESPACE
</code>
</a>
statement.
</p>
<p>
For example, consider the following line specifying
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-initialtablespace">
<code class="literal">
InitialTablespace
</code>
</a>
in the
<code class="literal">
[ndbd default]
</code>
section of the
<code class="filename">
config.ini
</code>
file (as with
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-initiallogfilegroup">
<code class="literal">
InitialLogfileGroup
</code>
</a>
,
this parameter should always be set in the
<code class="literal">
[ndbd default]
</code>
section, as the
behavior of an NDB Cluster when different values are set
on different data nodes is not defined):
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-ini"><div class="docs-select-all right" id="sa45045008"><div class="copy-help left">Press ⌘+C to 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">InitialTablespace</span> <span class="token attr-value"><span class="token punctuation">=</span> name=TS1; extent_size=8M; data1.dat:2G; data2.dat:4G</span></code></pre>
</div>
<p>
This is equivalent to the following SQL statements:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa79755290"><div class="copy-help left">Press ⌘+C to 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">TABLESPACE</span> TS1
<span class="token keyword">ADD</span> <span class="token keyword">DATAFILE</span> <span class="token string">'data1.dat'</span>
<span class="token keyword">EXTENT_SIZE</span> 8M
<span class="token keyword">INITIAL_SIZE</span> 2G
<span class="token keyword">ENGINE</span> <span class="token keyword">NDBCLUSTER</span><span class="token punctuation">;</span>
<span class="token keyword">ALTER</span> <span class="token keyword">TABLESPACE</span> TS1
<span class="token keyword">ADD</span> <span class="token keyword">DATAFILE</span> <span class="token string">'data2.dat'</span>
<span class="token keyword">INITIAL_SIZE</span> 4G
<span class="token keyword">ENGINE</span> <span class="token keyword">NDBCLUSTER</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
This tablespace is created when the data nodes are
started with
<code class="option">
--initial
</code>
, and can be used
whenever creating NDB Cluster Disk Data tables
thereafter.
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
<a name="mysql-cluster-ndbd-definition-disk-data-latency-parameters">
</a>
<b>
Disk Data latency parameters.
</b>
The two parameters listed here can be used to improve
handling of latency issues with NDB Cluster Disk Data
tables.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<a name="ndbparam-ndbd-maxdiskdatalatency">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxdiskdatalatency">
<code class="literal">
MaxDiskDataLatency
</code>
</a>
</p>
<a class="indexterm" name="idm46045114983600">
</a>
<div class="informaltable">
<a name="maxdiskdatalatency-ndbd-table">
</a>
<table frame="box" rules="all" summary="MaxDiskDataLatency data node 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>
ms
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
0
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
0 - 8000
</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 parameter controls the maximum allowed mean latency
for disk access (maximum 8000 milliseconds). When this
limit is reached,
<code class="literal">
NDB
</code>
begins to abort
transactions in order to decrease pressure on the Disk
Data I/O subsystem. Use
<code class="literal">
0
</code>
to disable
the latency check.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-diskdatausingsamedisk">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-diskdatausingsamedisk">
<code class="literal">
DiskDataUsingSameDisk
</code>
</a>
</p>
<a class="indexterm" name="idm46045114961648">
</a>
<div class="informaltable">
<a name="diskdatausingsamedisk-ndbd-table">
</a>
<table frame="box" rules="all" summary="DiskDataUsingSameDisk data node 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>
boolean
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
true
</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>
Set this parameter to
<code class="literal">
false
</code>
if your
Disk Data tablespaces use one or more separate disks.
Doing so allows checkpoints to tablespaces to be
executed at a higher rate than normally used for when
disks are shared.
</p>
<p>
When
<code class="literal">
DiskDataUsingSameDisk
</code>
is
<code class="literal">
true
</code>
,
<code class="literal">
NDB
</code>
decreases the rate of Disk Data checkpointing whenever
an in-memory checkpoint is in progress to help ensure
that disk load remains constant.
</p>
</li>
</ul>
</div>
</li>
</ul>
</div>
<p>
<a name="mysql-cluster-ndbd-definition-gcp-stop-errors">
</a>
<b>
Disk Data and GCP Stop errors.
</b>
<a class="indexterm" name="idm46045114938048">
</a>
<a class="indexterm" name="idm46045114936560">
</a>
Errors encountered when using Disk Data tables such as
<span class="errortext">
Node
<em class="replaceable">
<code>
nodeid
</code>
</em>
killed this
node because GCP stop was detected
</span>
(error 2303)
are often referred to as
<span class="quote">
“
<span class="quote">
GCP stop errors
</span>
”
</span>
. Such
errors occur when the redo log is not flushed to disk quickly
enough; this is usually due to slow disks and insufficient
disk throughput.
</p>
<p>
You can help prevent these errors from occurring by using faster
disks, and by placing Disk Data files on a separate disk from
the data node file system. Reducing the value of
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-timebetweenglobalcheckpoints">
<code class="literal">
TimeBetweenGlobalCheckpoints
</code>
</a>
tends to decrease the amount of data to be written for each
global checkpoint, and so may provide some protection against
redo log buffer overflows when trying to write a global
checkpoint; however, reducing this value also permits less time
in which to write the GCP, so this must be done with caution.
</p>
<a class="indexterm" name="idm46045114931280">
</a>
<a class="indexterm" name="idm46045114930208">
</a>
<a class="indexterm" name="idm46045114929136">
</a>
<p>
In addition to the considerations given for
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-diskpagebuffermemory">
<code class="literal">
DiskPageBufferMemory
</code>
</a>
as
explained previously, it is also very important that the
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-diskiothreadpool">
<code class="literal">
DiskIOThreadPool
</code>
</a>
configuration parameter be set correctly; having
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-diskiothreadpool">
<code class="literal">
DiskIOThreadPool
</code>
</a>
set too
high is very likely to cause GCP stop errors (Bug #37227).
</p>
<p>
GCP stops can be caused by save or commit timeouts; the
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-timebetweenepochstimeout">
<code class="literal">
TimeBetweenEpochsTimeout
</code>
</a>
data node configuration parameter determines the timeout for
commits. However, it is possible to disable both types of
timeouts by setting this parameter to 0.
</p>
<p>
<b>
Parameters for configuring send buffer memory allocation.
</b>
Send buffer memory is allocated dynamically from a memory pool
shared between all transporters, which means that the size of
the send buffer can be adjusted as necessary. (Previously, the
NDB kernel used a fixed-size send buffer for every node in the
cluster, which was allocated when the node started and could
not be changed while the node was running.) The
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-totalsendbuffermemory">
<code class="literal">
TotalSendBufferMemory
</code>
</a>
and
<a class="link" href="mysql-cluster-tcp-definition.html#ndbparam-tcp-overloadlimit">
<code class="literal">
OverLoadLimit
</code>
</a>
data
node configuration parameters permit the setting of limits on
this memory allocation. For more information about the use of
these parameters (as well as
<a class="link" href="mysql-cluster-tcp-definition.html#ndbparam-tcp-sendbuffermemory">
<code class="literal">
SendBufferMemory
</code>
</a>
), see
<a class="xref" href="mysql-cluster-config-send-buffers.html" title="25.4.3.14 Configuring NDB Cluster Send Buffer Parameters">
Section 25.4.3.14, “Configuring NDB Cluster Send Buffer Parameters”
</a>
.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a name="ndbparam-ndbd-extrasendbuffermemory">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-extrasendbuffermemory">
<code class="literal">
ExtraSendBufferMemory
</code>
</a>
</p>
<a class="indexterm" name="idm46045114912752">
</a>
<p>
This parameter specifies the amount of transporter send
buffer memory to allocate in addition to any set using
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-totalsendbuffermemory">
<code class="literal">
TotalSendBufferMemory
</code>
</a>
,
<a class="link" href="mysql-cluster-tcp-definition.html#ndbparam-tcp-sendbuffermemory">
<code class="literal">
SendBufferMemory
</code>
</a>
, or
both.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-totalsendbuffermemory">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-totalsendbuffermemory">
<code class="literal">
TotalSendBufferMemory
</code>
</a>
</p>
<a class="indexterm" name="idm46045114905776">
</a>
<p>
This parameter is used to determine the total amount of
memory to allocate on this node for shared send buffer
memory among all configured transporters.
</p>
<p>
If this parameter is set, its minimum permitted value is
256KB; 0 indicates that the parameter has not been set. For
more detailed information, see
<a class="xref" href="mysql-cluster-config-send-buffers.html" title="25.4.3.14 Configuring NDB Cluster Send Buffer Parameters">
Section 25.4.3.14, “Configuring NDB Cluster Send Buffer Parameters”
</a>
.
</p>
</li>
</ul>
</div>
<p>
See also
<a class="xref" href="mysql-cluster-online-add-node.html" title="25.6.7 Adding NDB Cluster Data Nodes Online">
Section 25.6.7, “Adding NDB Cluster Data Nodes Online”
</a>
.
</p>
<p>
<a name="mysql-cluster-redo-over-commit-handling">
</a>
<b>
Redo log over-commit handling.
</b>
It is possible to control a data node's handling of
operations when too much time is taken flushing redo logs to
disk. This occurs when a given redo log flush takes longer
than
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-redoovercommitlimit">
<code class="literal">
RedoOverCommitLimit
</code>
</a>
seconds, more than
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-redoovercommitcounter">
<code class="literal">
RedoOverCommitCounter
</code>
</a>
times, causing any pending transactions to be aborted. When
this happens, the API node that sent the transaction can
handle the operations that should have been committed either
by queuing the operations and re-trying them, or by aborting
them, as determined by
<a class="link" href="mysql-cluster-api-definition.html#ndbparam-api-defaultoperationredoproblemaction">
<code class="literal">
DefaultOperationRedoProblemAction
</code>
</a>
.
The data node configuration parameters for setting the timeout
and number of times it may be exceeded before the API node
takes this action are described in the following list:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a name="ndbparam-ndbd-redoovercommitcounter">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-redoovercommitcounter">
<code class="literal">
RedoOverCommitCounter
</code>
</a>
</p>
<a class="indexterm" name="idm46045114892144">
</a>
<div class="informaltable">
<a name="redoovercommitcounter-ndbd-table">
</a>
<table frame="box" rules="all" summary="RedoOverCommitCounter data node 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>
numeric
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
3
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
1 - 4294967039 (0xFFFFFEFF)
</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>
When
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-redoovercommitlimit">
<code class="literal">
RedoOverCommitLimit
</code>
</a>
is exceeded when trying to write a given redo log to disk
this many times or more, any transactions that were not
committed as a result are aborted, and an API node where any
of these transactions originated handles the operations
making up those transactions according to its value for
<a class="link" href="mysql-cluster-api-definition.html#ndbparam-api-defaultoperationredoproblemaction">
<code class="literal">
DefaultOperationRedoProblemAction
</code>
</a>
(by either queuing the operations to be re-tried, or
aborting them).
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-redoovercommitlimit">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-redoovercommitlimit">
<code class="literal">
RedoOverCommitLimit
</code>
</a>
</p>
<a class="indexterm" name="idm46045114868368">
</a>
<div class="informaltable">
<a name="redoovercommitlimit-ndbd-table">
</a>
<table frame="box" rules="all" summary="RedoOverCommitLimit data node 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>
seconds
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
20
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
1 - 4294967039 (0xFFFFFEFF)
</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 parameter sets an upper limit in seconds for trying to
write a given redo log to disk before timing out. The number
of times the data node tries to flush this redo log, but
takes longer than
<code class="literal">
RedoOverCommitLimit
</code>
, is
kept and compared with
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-redoovercommitcounter">
<code class="literal">
RedoOverCommitCounter
</code>
</a>
,
and when flushing takes too long more times than the value
of that parameter, any transactions that were not committed
as a result of the flush timeout are aborted. When this
occurs, the API node where any of these transactions
originated handles the operations making up those
transactions according to its
<a class="link" href="mysql-cluster-api-definition.html#ndbparam-api-defaultoperationredoproblemaction">
<code class="literal">
DefaultOperationRedoProblemAction
</code>
</a>
setting (it either queues the operations to be re-tried, or
aborts them).
</p>
</li>
</ul>
</div>
<p>
<b>
Controlling restart attempts.
</b>
It is possible to exercise finely-grained control over restart
attempts by data nodes when they fail to start using the
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxstartfailretries">
<code class="literal">
MaxStartFailRetries
</code>
</a>
and
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-startfailretrydelay">
<code class="literal">
StartFailRetryDelay
</code>
</a>
data node configuration parameters.
</p>
<p>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxstartfailretries">
<code class="literal">
MaxStartFailRetries
</code>
</a>
limits the total number of retries made before giving up on
starting the data node,
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-startfailretrydelay">
<code class="literal">
StartFailRetryDelay
</code>
</a>
sets
the number of seconds between retry attempts. These parameters
are listed here:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a name="ndbparam-ndbd-startfailretrydelay">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-startfailretrydelay">
<code class="literal">
StartFailRetryDelay
</code>
</a>
</p>
<a class="indexterm" name="idm46045114836176">
</a>
<div class="informaltable">
<a name="startfailretrydelay-ndbd-table">
</a>
<table frame="box" rules="all" summary="StartFailRetryDelay data node 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>
unsigned
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
0
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
0 - 4294967039 (0xFFFFFEFF)
</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>
Use this parameter to set the number of seconds between
restart attempts by the data node in the event on failure on
startup. The default is 0 (no delay).
</p>
<p>
Both this parameter and
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxstartfailretries">
<code class="literal">
MaxStartFailRetries
</code>
</a>
are ignored unless
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-stoponerror">
<code class="literal">
StopOnError
</code>
</a>
is equal
to 0.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-maxstartfailretries">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxstartfailretries">
<code class="literal">
MaxStartFailRetries
</code>
</a>
</p>
<a class="indexterm" name="idm46045114812576">
</a>
<div class="informaltable">
<a name="maxstartfailretries-ndbd-table">
</a>
<table frame="box" rules="all" summary="MaxStartFailRetries data node 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>
unsigned
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
3
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
0 - 4294967039 (0xFFFFFEFF)
</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>
Use this parameter to limit the number restart attempts made
by the data node in the event that it fails on startup. The
default is 3 attempts.
</p>
<p>
Both this parameter and
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-startfailretrydelay">
<code class="literal">
StartFailRetryDelay
</code>
</a>
are ignored unless
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-stoponerror">
<code class="literal">
StopOnError
</code>
</a>
is equal
to 0.
</p>
</li>
</ul>
</div>
<p>
<a name="mysql-cluster-ndbd-definition-index-statistics-parameters">
</a>
<b>
NDB index statistics parameters.
</b>
<a class="indexterm" name="idm46045114789648">
</a>
The parameters in the following list relate to NDB index
statistics generation.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a name="ndbparam-ndbd-indexstatautocreate">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-indexstatautocreate">
<code class="literal">
IndexStatAutoCreate
</code>
</a>
</p>
<a class="indexterm" name="idm46045114785232">
</a>
<div class="informaltable">
<a name="indexstatautocreate-ndbd-table">
</a>
<table frame="box" rules="all" summary="IndexStatAutoCreate data node 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>
integer
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
1
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
0, 1
</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>
Enable (set equal to 1) or disable (set equal to 0)
automatic statistics collection when indexes are created.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-indexstatautoupdate">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-indexstatautoupdate">
<code class="literal">
IndexStatAutoUpdate
</code>
</a>
</p>
<a class="indexterm" name="idm46045114764256">
</a>
<div class="informaltable">
<a name="indexstatautoupdate-ndbd-table">
</a>
<table frame="box" rules="all" summary="IndexStatAutoUpdate data node 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>
integer
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
1
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
0, 1
</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>
Enable (set equal to 1) or disable (set equal to 0)
monitoring of indexes for changes, and trigger automatic
statistics updates when these are detected. The degree of
change needed to trigger the updates are determined by the
settings for the
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-indexstattriggerpct">
<code class="literal">
IndexStatTriggerPct
</code>
</a>
and
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-indexstattriggerscale">
<code class="literal">
IndexStatTriggerScale
</code>
</a>
options.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-indexstatsavesize">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-indexstatsavesize">
<code class="literal">
IndexStatSaveSize
</code>
</a>
</p>
<a class="indexterm" name="idm46045114740544">
</a>
<div class="informaltable">
<a name="indexstatsavesize-ndbd-table">
</a>
<table frame="box" rules="all" summary="IndexStatSaveSize data node 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>
bytes
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
32768
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
0 - 4294967039 (0xFFFFFEFF)
</td>
</tr>
<tr>
<th>
Restart Type
</th>
<td>
<p>
<span class="bold">
<strong>
Initial 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; each data node must
be restarted with
<a class="link" href="mysql-cluster-programs-ndbd.html#option_ndbd_initial">
<code class="option">
--initial
</code>
</a>
. (NDB 8.4.0)
</p>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Maximum space in bytes allowed for the saved statistics of
any given index in the
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
system tables and in the
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
memory
cache.
</p>
<p>
At least one sample is always produced, regardless of any
size limit. This size is scaled by
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-indexstatsavescale">
<code class="literal">
IndexStatSaveScale
</code>
</a>
.
</p>
<p>
The size specified by
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-indexstatsavesize">
<code class="literal">
IndexStatSaveSize
</code>
</a>
is
scaled by the value of
<code class="literal">
IndexStatTriggerPct
</code>
for a large index,
times 0.01. This is further multiplied by the logarithm to
the base 2 of the index size. Setting
<code class="literal">
IndexStatTriggerPct
</code>
equal to 0 disables
the scaling effect.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-indexstatsavescale">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-indexstatsavescale">
<code class="literal">
IndexStatSaveScale
</code>
</a>
</p>
<a class="indexterm" name="idm46045114711088">
</a>
<div class="informaltable">
<a name="indexstatsavescale-ndbd-table">
</a>
<table frame="box" rules="all" summary="IndexStatSaveScale data node 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>
percentage
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
100
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
0 - 4294967039 (0xFFFFFEFF)
</td>
</tr>
<tr>
<th>
Restart Type
</th>
<td>
<p>
<span class="bold">
<strong>
Initial 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; each data node must
be restarted with
<a class="link" href="mysql-cluster-programs-ndbd.html#option_ndbd_initial">
<code class="option">
--initial
</code>
</a>
. (NDB 8.4.0)
</p>
</td>
</tr>
</tbody>
</table>
</div>
<p>
The size specified by
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-indexstatsavesize">
<code class="literal">
IndexStatSaveSize
</code>
</a>
is
scaled by the value of
<code class="literal">
IndexStatTriggerPct
</code>
for a large index,
times 0.01. This is further multiplied by the logarithm to
the base 2 of the index size. Setting
<code class="literal">
IndexStatTriggerPct
</code>
equal to 0 disables
the scaling effect.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-indexstattriggerpct">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-indexstattriggerpct">
<code class="literal">
IndexStatTriggerPct
</code>
</a>
</p>
<a class="indexterm" name="idm46045114686352">
</a>
<div class="informaltable">
<a name="indexstattriggerpct-ndbd-table">
</a>
<table frame="box" rules="all" summary="IndexStatTriggerPct data node 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>
percentage
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
100
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
0 - 4294967039 (0xFFFFFEFF)
</td>
</tr>
<tr>
<th>
Restart Type
</th>
<td>
<p>
<span class="bold">
<strong>
Initial 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; each data node must
be restarted with
<a class="link" href="mysql-cluster-programs-ndbd.html#option_ndbd_initial">
<code class="option">
--initial
</code>
</a>
. (NDB 8.4.0)
</p>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Percentage change in updates that triggers an index
statistics update. The value is scaled by
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-indexstattriggerscale">
<code class="literal">
IndexStatTriggerScale
</code>
</a>
.
You can disable this trigger altogether by setting
<code class="literal">
IndexStatTriggerPct
</code>
to 0.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-indexstattriggerscale">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-indexstattriggerscale">
<code class="literal">
IndexStatTriggerScale
</code>
</a>
</p>
<a class="indexterm" name="idm46045114662352">
</a>
<div class="informaltable">
<a name="indexstattriggerscale-ndbd-table">
</a>
<table frame="box" rules="all" summary="IndexStatTriggerScale data node 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>
percentage
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
100
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
0 - 4294967039 (0xFFFFFEFF)
</td>
</tr>
<tr>
<th>
Restart Type
</th>
<td>
<p>
<span class="bold">
<strong>
Initial 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; each data node must
be restarted with
<a class="link" href="mysql-cluster-programs-ndbd.html#option_ndbd_initial">
<code class="option">
--initial
</code>
</a>
. (NDB 8.4.0)
</p>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Scale
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-indexstattriggerpct">
<code class="literal">
IndexStatTriggerPct
</code>
</a>
by this amount times 0.01 for a large index. A value of 0
disables scaling.
</p>
</li>
<li class="listitem">
<p>
<a name="ndbparam-ndbd-indexstatupdatedelay">
</a>
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-indexstatupdatedelay">
<code class="literal">
IndexStatUpdateDelay
</code>
</a>
</p>
<a class="indexterm" name="idm46045114639136">
</a>
<div class="informaltable">
<a name="indexstatupdatedelay-ndbd-table">
</a>
<table frame="box" rules="all" summary="IndexStatUpdateDelay data node 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>
seconds
</td>
</tr>
<tr>
<th>
Default
</th>
<td>
60
</td>
</tr>
<tr>
<th>
Range
</th>
<td>
0 - 4294967039 (0xFFFFFEFF)
</td>
</tr>
<tr>
<th>
Restart Type
</th>
<td>
<p>
<span class="bold">
<strong>
Initial 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; each data node must
be restarted with
<a class="link" href="mysql-cluster-programs-ndbd.html#option_ndbd_initial">
<code class="option">
--initial
</code>
</a>
. (NDB 8.4.0)
</p>
</td>
</tr>
</tbody>
</table>
</div>
<p>
Minimum delay in seconds between automatic index statistics
updates for a given index. Setting this variable to 0
disables any delay. The default is 60 seconds.
</p>
</li>
</ul>
</div>
<p>
<a name="mysql-cluster-ndbd-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="idm46045114617472">
</a>
<p class="title">
<b>
Table 25.15 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/sha256-pluggable-authentication.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="sha256-pluggable-authentication">
</a>
8.4.1.3 SHA-256 Pluggable Authentication
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045246106400">
</a>
<a class="indexterm" name="idm46045246105312">
</a>
<p>
MySQL provides two authentication plugins that implement SHA-256
hashing for user account passwords:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
caching_sha2_password
</code>
: Implements SHA-256
authentication (like
<code class="literal">
sha256_password
</code>
),
but uses caching on the server side for better performance
and has additional features for wider applicability.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
sha256_password
</code>
(deprecated): Implements
basic SHA-256 authentication.
</p>
</li>
</ul>
</div>
<p>
This section describes the original noncaching SHA-2
authentication plugin. For information about the caching 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>
<div class="important" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Important
</div>
<p>
In MySQL 8.4,
<code class="literal">
caching_sha2_password
</code>
is the default
authentication plugin rather than
<code class="literal">
mysql_native_password
</code>
(deprecated). For
information about the implications of this change for server
operation and compatibility of the server with clients and
connectors, see
<a class="ulink" href="/doc/refman/8.0/en/upgrading-from-previous-series.html#upgrade-caching-sha2-password" target="_top">
caching_sha2_password as the Preferred Authentication Plugin
</a>
.
</p>
<p>
Because
<code class="literal">
caching_sha2_password
</code>
is the
default authentication plugin in MySQL 8.4 and
provides a superset of the capabilities of the
<code class="literal">
sha256_password
</code>
authentication plugin,
<code class="literal">
sha256_password
</code>
is deprecated; expect it to
be removed in a future version of MySQL. MySQL accounts that
authenticate using
<code class="literal">
sha256_password
</code>
should
be migrated to use
<code class="literal">
caching_sha2_password
</code>
instead.
</p>
</div>
<div class="important" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Important
</div>
<p>
To connect to the server using an account that authenticates
with the
<code class="literal">
sha256_password
</code>
plugin, you must
use either a TLS connection or an unencrypted connection that
supports password exchange using an RSA key pair, as described
later in this section. Either way, the
<code class="literal">
sha256_password
</code>
plugin uses MySQL's
encryption capabilities. See
<a class="xref" href="encrypted-connections.html" title="8.3 Using Encrypted Connections">
Section 8.3, “Using Encrypted Connections”
</a>
.
</p>
</div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
In the name
<code class="literal">
sha256_password
</code>
,
<span class="quote">
“
<span class="quote">
sha256
</span>
”
</span>
refers to the 256-bit digest length the
plugin uses for encryption. In the name
<code class="literal">
caching_sha2_password
</code>
,
<span class="quote">
“
<span class="quote">
sha2
</span>
”
</span>
refers more generally to the SHA-2 class of encryption
algorithms, of which 256-bit encryption is one instance. The
latter name choice leaves room for future expansion of
possible digest lengths without changing the plugin name.
</p>
</div>
<p>
The following table shows the plugin names on the server and
client sides.
</p>
<div class="table">
<a name="idm46045246082928">
</a>
<p class="title">
<b>
Table 8.16 Plugin and Library Names for SHA-256 Authentication
</b>
</p>
<div class="table-contents">
<table summary="Names for the plugins and library file used for SHA-256 password authentication.">
<colgroup>
<col style="width: 30%"/>
<col style="width: 70%"/>
</colgroup>
<thead>
<tr>
<th>
Plugin or File
</th>
<th>
Plugin or File Name
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
Server-side plugin
</td>
<td>
<code class="literal">
sha256_password
</code>
</td>
</tr>
<tr>
<td>
Client-side plugin
</td>
<td>
<code class="literal">
sha256_password
</code>
</td>
</tr>
<tr>
<td>
Library file
</td>
<td>
None (plugins are built in)
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br class="table-break"/>
<p>
The following sections provide installation and usage
information specific to SHA-256 pluggable authentication:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="xref" href="sha256-pluggable-authentication.html#sha256-pluggable-authentication-installation" title="Installing SHA-256 Pluggable Authentication">
Installing SHA-256 Pluggable Authentication
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="sha256-pluggable-authentication.html#sha256-pluggable-authentication-usage" title="Using SHA-256 Pluggable Authentication">
Using SHA-256 Pluggable Authentication
</a>
</p>
</li>
</ul>
</div>
<p>
For general information about pluggable authentication in MySQL,
see
<a class="xref" href="pluggable-authentication.html" title="8.2.17 Pluggable Authentication">
Section 8.2.17, “Pluggable Authentication”
</a>
.
</p>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="sha256-pluggable-authentication-installation">
</a>
Installing SHA-256 Pluggable Authentication
</h5>
</div>
</div>
</div>
<p>
The
<code class="literal">
sha256_password
</code>
(deprecated) plugin
exists in server and client forms:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
The server-side plugin is built into the server, need not
be loaded explicitly, and cannot be disabled by unloading
it.
</p>
</li>
<li class="listitem">
<p>
The client-side plugin is built into the
<code class="literal">
libmysqlclient
</code>
client library and is
available to any program linked against
<code class="literal">
libmysqlclient
</code>
.
</p>
</li>
</ul>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="sha256-pluggable-authentication-usage">
</a>
Using SHA-256 Pluggable Authentication
</h5>
</div>
</div>
</div>
<p>
To set up an account that uses the deprecated
<code class="literal">
sha256_password
</code>
plugin for SHA-256 password
hashing, use the following statement, where
<em class="replaceable">
<code>
password
</code>
</em>
is the desired account
password:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa78068234"><div class="copy-help left">Press ⌘+C to 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> <span class="token string">'sha256user'</span>@<span class="token string">'localhost'</span>
<span class="token keyword">IDENTIFIED</span> <span class="token keyword">WITH</span> sha256_password <span class="token keyword">BY</span> <span class="token string">'<em class="replaceable">password</em>'</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
The server assigns the
<code class="literal">
sha256_password
</code>
plugin to the account and uses it to encrypt the password
using SHA-256, storing those values in the
<code class="literal">
plugin
</code>
and
<code class="literal">
authentication_string
</code>
columns of the
<code class="literal">
mysql.user
</code>
system table.
</p>
<p>
(The
<code class="literal">
IDENTIFIED WITH
</code>
clause is not needed
if
<code class="literal">
sha256_password
</code>
is the default plugin;
this can be specified using
<a class="link" href="server-system-variables.html#sysvar_authentication_policy">
<code class="literal">
authentication_policy
</code>
</a>
.)
</p>
<p>
<code class="literal">
sha256_password
</code>
supports connections over
secure transport.
<code class="literal">
sha256_password
</code>
also
supports encrypted password exchange using RSA over
unencrypted connections if MySQL is compiled using OpenSSL,
and the MySQL server to which you wish to connect is
configured to support RSA (using the RSA configuration
procedure given later in this section).
</p>
<p>
RSA support has these characteristics:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
On the server side, two system variables name the RSA
private and public key-pair files:
<a class="link" href="server-system-variables.html#sysvar_sha256_password_private_key_path">
<code class="literal">
sha256_password_private_key_path
</code>
</a>
and
<a class="link" href="server-system-variables.html#sysvar_sha256_password_public_key_path">
<code class="literal">
sha256_password_public_key_path
</code>
</a>
.
The database administrator must set these variables at
server startup if the key files to use have names that
differ from the system variable default values.
</p>
</li>
<li class="listitem">
<p>
The server uses the
<a class="link" href="server-system-variables.html#sysvar_sha256_password_auto_generate_rsa_keys">
<code class="literal">
sha256_password_auto_generate_rsa_keys
</code>
</a>
system variable to determine whether to automatically
generate the RSA key-pair files. See
<a class="xref" href="creating-ssl-rsa-files.html" title="8.3.3 Creating SSL and RSA Certificates and Keys">
Section 8.3.3, “Creating SSL and RSA Certificates and Keys”
</a>
.
</p>
</li>
<li class="listitem">
<p>
The
<a class="link" href="server-status-variables.html#statvar_Rsa_public_key">
<code class="literal">
Rsa_public_key
</code>
</a>
status variable displays the RSA public key value used by
the
<code class="literal">
sha256_password
</code>
authentication
plugin.
</p>
</li>
<li class="listitem">
<p>
Clients that are in possession of the RSA public key can
perform RSA key pair-based password exchange with the
server during the connection process, as described later.
</p>
</li>
<li class="listitem">
<p>
For connections by accounts that authenticate with
<code class="literal">
sha256_password
</code>
and RSA public key
pair-based password exchange, the server sends the RSA
public key to the client as needed. However, if a copy of
the public key is available on the client host, the client
can use it to save a round trip in the client/server
protocol:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
For these command-line clients, use the
<a class="link" href="mysql-command-options.html#option_mysql_server-public-key-path">
<code class="option">
--server-public-key-path
</code>
</a>
option to specify the RSA public key file:
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
,
<a class="link" href="mysqladmin.html" title="6.5.2 mysqladmin — A MySQL Server Administration Program">
<span class="command">
<strong>
mysqladmin
</strong>
</span>
</a>
,
<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>
,
<a class="link" href="mysqlcheck.html" title="6.5.3 mysqlcheck — A Table Maintenance Program">
<span class="command">
<strong>
mysqlcheck
</strong>
</span>
</a>
,
<a class="link" href="mysqldump.html" title="6.5.4 mysqldump — A Database Backup Program">
<span class="command">
<strong>
mysqldump
</strong>
</span>
</a>
,
<a class="link" href="mysqlimport.html" title="6.5.5 mysqlimport — A Data Import Program">
<span class="command">
<strong>
mysqlimport
</strong>
</span>
</a>
,
<a class="link" href="mysqlshow.html" title="6.5.6 mysqlshow — Display Database, Table, and Column Information">
<span class="command">
<strong>
mysqlshow
</strong>
</span>
</a>
,
<a class="link" href="mysqlslap.html" title="6.5.7 mysqlslap — A Load Emulation Client">
<span class="command">
<strong>
mysqlslap
</strong>
</span>
</a>
,
<span class="command">
<strong>
mysqltest
</strong>
</span>
.
</p>
</li>
<li class="listitem">
<p>
For programs that use the C API, call
<a class="ulink" href="/doc/c-api/8.4/en/mysql-options.html" target="_top">
<code class="literal">
mysql_options()
</code>
</a>
to
specify the RSA public key file by passing the
<code class="literal">
MYSQL_SERVER_PUBLIC_KEY
</code>
option and
the name of the file.
</p>
</li>
<li class="listitem">
<p>
For replicas, use 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 with the
<code class="literal">
SOURCE_PUBLIC_KEY_PATH
</code>
option to
specify the RSA public key file. For Group
Replication, the
<a class="link" href="group-replication-system-variables.html#sysvar_group_replication_recovery_get_public_key">
<code class="literal">
group_replication_recovery_get_public_key
</code>
</a>
system variable serves the same purpose.
</p>
</li>
</ul>
</div>
</li>
</ul>
</div>
<p>
For clients that use the
<code class="literal">
sha256_password
</code>
plugin, passwords are never exposed as cleartext when
connecting to the server. How password transmission occurs
depends on whether a secure connection or RSA encryption is
used:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
If the connection is secure, an RSA key pair is
unnecessary and is not used. This applies to connections
encrypted using TLS. The password is sent as cleartext but
cannot be snooped because the connection is secure.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
Unlike
<code class="literal">
caching_sha2_password
</code>
, the
deprecated
<code class="literal">
sha256_password
</code>
plugin
does not treat shared-memory connections as secure, even
though share-memory transport is secure by default.
</p>
</div>
</li>
<li class="listitem">
<p>
If the connection is not secure, and an RSA key pair is
available, the connection remains unencrypted. This
applies to connections not encrypted using TLS. RSA is
used only for password exchange between client and server,
to prevent password snooping. When the server receives the
encrypted password, it decrypts it. A scramble is used in
the encryption to prevent repeat attacks.
</p>
</li>
<li class="listitem">
<p>
If a secure connection is not used and RSA encryption is
not available, the connection attempt fails because the
password cannot be sent without being exposed as
cleartext.
</p>
</li>
</ul>
</div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
To use RSA password encryption with the deprecated
<code class="literal">
sha256_password
</code>
plugin, the client and
server both must be compiled using OpenSSL, not just one of
them.
</p>
</div>
<p>
Assuming that MySQL has been compiled using OpenSSL, use the
following procedure to enable use of an RSA key pair for
password exchange during the client connection process:
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
Create the RSA private and public key-pair files using the
instructions in
<a class="xref" href="creating-ssl-rsa-files.html" title="8.3.3 Creating SSL and RSA Certificates and Keys">
Section 8.3.3, “Creating SSL and RSA Certificates and Keys”
</a>
.
</p>
</li>
<li class="listitem">
<p>
If the private and public key files are located in the
data directory and are named
<code class="filename">
private_key.pem
</code>
and
<code class="filename">
public_key.pem
</code>
(the default values of
the
<a class="link" href="server-system-variables.html#sysvar_sha256_password_private_key_path">
<code class="literal">
sha256_password_private_key_path
</code>
</a>
and
<a class="link" href="server-system-variables.html#sysvar_sha256_password_public_key_path">
<code class="literal">
sha256_password_public_key_path
</code>
</a>
system variables), the server uses them automatically at
startup.
</p>
<p>
Otherwise, to name the key files explicitly, set the
system variables to the key file names in the server
option file. If the files are located in the server data
directory, you need not specify their full path names:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-ini"><div class="docs-select-all right" id="sa35561967"><div class="copy-help left">Press ⌘+C to 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">sha256_password_private_key_path</span><span class="token attr-value"><span class="token punctuation">=</span>myprivkey.pem</span>
<span class="token constant">sha256_password_public_key_path</span><span class="token attr-value"><span class="token punctuation">=</span>mypubkey.pem</span></code></pre>
</div>
<p>
If the key files are not located in the data directory, or
to make their locations explicit in the system variable
values, use full path names:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-ini"><div class="docs-select-all right" id="sa79683714"><div class="copy-help left">Press ⌘+C to 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">sha256_password_private_key_path</span><span class="token attr-value"><span class="token punctuation">=</span>/usr/local/mysql/myprivkey.pem</span>
<span class="token constant">sha256_password_public_key_path</span><span class="token attr-value"><span class="token punctuation">=</span>/usr/local/mysql/mypubkey.pem</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
Restart the server, then connect to it and check the
<a class="link" href="server-status-variables.html#statvar_Rsa_public_key">
<code class="literal">
Rsa_public_key
</code>
</a>
status
variable value. The value actually displayed differs from
that shown here, but should be nonempty:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa76691024"><div class="copy-help left">Press ⌘+C to 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">STATUS</span> <span class="token operator">LIKE</span> <span class="token string">'Rsa_public_key'</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>
Variable_name<span class="token punctuation">:</span> Rsa_public_key
Value<span class="token punctuation">:</span> -----BEGIN PUBLIC KEY-----
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDO9nRUDd+KvSZgY7cNBZMNpwX6
MvE1PbJFXO7u18nJ9lwc99Du/E7lw6CVXw7VKrXPeHbVQUzGyUNkf45Nz/ckaaJa
aLgJOBCIDmNVnyU54OT/1lcs2xiyfaDMe8fCJ64ZwTnKbY2gkt1IMjUAB5Ogd5kJ
g8aV7EtKwyhHb0c30QIDAQAB
-----END PUBLIC KEY-----</span></code></pre>
</div>
<p>
If the value is empty, the server found some problem with
the key files. Check the error log for diagnostic
information.
</p>
</li>
</ol>
</div>
<p>
After the server has been configured with the RSA key files,
accounts that authenticate with the deprecated
<code class="literal">
sha256_password
</code>
plugin have the option of
using those key files to connect to the server. As mentioned
previously, such accounts can use either a secure connection
(in which case RSA is not used) or an unencrypted connection
that performs password exchange using RSA. Suppose that an
unencrypted connection is used. For example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa33790152"><div class="copy-help left">Press ⌘+C to 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">--ssl-mode</span><span class="token attr-value"><span class="token punctuation">=</span>DISABLED</span> <span class="token property">-u</span> sha256user <span class="token property">-p</span>
Enter password<span class="token punctuation">:</span> <em class="replaceable">password</em></code></pre>
</div>
<p>
For this connection attempt by
<code class="literal">
sha256user
</code>
,
the server determines that
<code class="literal">
sha256_password
</code>
is the appropriate authentication plugin and invokes it
(because that was the plugin specified at
<a class="link" href="create-user.html" title="15.7.1.3 CREATE USER Statement">
<code class="literal">
CREATE USER
</code>
</a>
time). The plugin
finds that the connection is not encrypted and thus requires
the password to be transmitted using RSA encryption. In this
case, the plugin sends the RSA public key to the client, which
uses it to encrypt the password and returns the result to the
server. The plugin uses the RSA private key on the server side
to decrypt the password and accepts or rejects the connection
based on whether the password is correct.
</p>
<p>
The server sends the RSA public key to the client as needed.
However, if the client has a file containing a local copy of
the RSA public key required by the server, it can specify the
file using the
<a class="link" href="mysql-command-options.html#option_mysql_server-public-key-path">
<code class="option">
--server-public-key-path
</code>
</a>
option:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa36750553"><div class="copy-help left">Press ⌘+C to 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">--ssl-mode</span><span class="token attr-value"><span class="token punctuation">=</span>DISABLED</span> <span class="token property">-u</span> sha256user <span class="token property">-p</span> <span class="token constant">--server-public-key-path</span><span class="token attr-value"><span class="token punctuation">=</span><em class="replaceable">file_name</em></span>
Enter password<span class="token punctuation">:</span> <em class="replaceable">password</em></code></pre>
</div>
<p>
The public key value in the file named by the
<a class="link" href="mysql-command-options.html#option_mysql_server-public-key-path">
<code class="option">
--server-public-key-path
</code>
</a>
option
should be the same as the key value in the server-side file
named by the
<a class="link" href="server-system-variables.html#sysvar_sha256_password_public_key_path">
<code class="literal">
sha256_password_public_key_path
</code>
</a>
system variable. If the key file contains a valid public key
value but the value is incorrect, an access-denied error
occurs. If the key file does not contain a valid public key,
the client program cannot use it. In this case, the deprecated
<code class="literal">
sha256_password
</code>
plugin sends the public key
to the client as if no
<a class="link" href="mysql-command-options.html#option_mysql_server-public-key-path">
<code class="option">
--server-public-key-path
</code>
</a>
option
had been specified.
</p>
<p>
Client users can obtain the RSA public key two ways:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
The database administrator can provide a copy of the
public key file.
</p>
</li>
<li class="listitem">
<p>
A client user who can connect to the server some other way
can use a
<code class="literal">
SHOW STATUS LIKE
'Rsa_public_key'
</code>
statement and save the returned
key value in a file.
</p>
</li>
</ul>
</div>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/insert-optimization.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="insert-optimization">
</a>
10.2.5.1 Optimizing INSERT Statements
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045227662080">
</a>
<a class="indexterm" name="idm46045227661040">
</a>
<a class="indexterm" name="idm46045227659552">
</a>
<a class="indexterm" name="idm46045227658064">
</a>
<p>
To optimize insert speed, combine many small operations into a
single large operation. Ideally, you make a single connection,
send the data for many new rows at once, and delay all index
updates and consistency checking until the very end.
</p>
<p>
The time required for inserting a row is determined by the
following factors, where the numbers indicate approximate
proportions:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Connecting: (3)
</p>
</li>
<li class="listitem">
<p>
Sending query to server: (2)
</p>
</li>
<li class="listitem">
<p>
Parsing query: (2)
</p>
</li>
<li class="listitem">
<p>
Inserting row: (1 × size of row)
</p>
</li>
<li class="listitem">
<p>
Inserting indexes: (1 × number of indexes)
</p>
</li>
<li class="listitem">
<p>
Closing: (1)
</p>
</li>
</ul>
</div>
<p>
This does not take into consideration the initial overhead to
open tables, which is done once for each concurrently running
query.
</p>
<p>
The size of the table slows down the insertion of indexes by
log
<em class="replaceable">
<code>
N
</code>
</em>
, assuming B-tree indexes.
</p>
<p>
You can use the following methods to speed up inserts:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
If you are inserting many rows from the same client at the
same time, use
<a class="link" href="insert.html" title="15.2.7 INSERT Statement">
<code class="literal">
INSERT
</code>
</a>
statements with multiple
<code class="literal">
VALUES
</code>
lists
to insert several rows at a time. This is considerably
faster (many times faster in some cases) than using
separate single-row
<a class="link" href="insert.html" title="15.2.7 INSERT Statement">
<code class="literal">
INSERT
</code>
</a>
statements. If you are adding data to a nonempty table,
you can tune the
<a class="link" href="server-system-variables.html#sysvar_bulk_insert_buffer_size">
<code class="literal">
bulk_insert_buffer_size
</code>
</a>
variable to make data insertion even faster. 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>
</li>
<li class="listitem">
<p>
When loading a table from a text file, use
<a class="link" href="load-data.html" title="15.2.9 LOAD DATA Statement">
<code class="literal">
LOAD DATA
</code>
</a>
. This is usually
20 times faster than using
<a class="link" href="insert.html" title="15.2.7 INSERT Statement">
<code class="literal">
INSERT
</code>
</a>
statements. See
<a class="xref" href="load-data.html" title="15.2.9 LOAD DATA Statement">
Section 15.2.9, “LOAD DATA Statement”
</a>
.
</p>
</li>
<li class="listitem">
<p>
Take advantage of the fact that columns have default
values. Insert values explicitly only when the value to be
inserted differs from the default. This reduces the
parsing that MySQL must do and improves the insert speed.
</p>
</li>
<li class="listitem">
<p>
See
<a class="xref" href="optimizing-innodb-bulk-data-loading.html" title="10.5.5 Bulk Data Loading for InnoDB Tables">
Section 10.5.5, “Bulk Data Loading for InnoDB Tables”
</a>
for tips specific to
<code class="literal">
InnoDB
</code>
tables.
</p>
</li>
<li class="listitem">
<p>
See
<a class="xref" href="optimizing-myisam-bulk-data-loading.html" title="10.6.2 Bulk Data Loading for MyISAM Tables">
Section 10.6.2, “Bulk Data Loading for MyISAM Tables”
</a>
for tips specific to
<code class="literal">
MyISAM
</code>
tables.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/connection-access.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="connection-access">
</a>
8.2.6 Access Control, Stage 1: Connection Verification
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045249868544">
</a>
<a class="indexterm" name="idm46045249867504">
</a>
<a class="indexterm" name="idm46045249866016">
</a>
<p>
When you attempt to connect to a MySQL server, the server accepts
or rejects the connection based on these conditions:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Your identity and whether you can verify it by supplying the
proper credentials.
</p>
</li>
<li class="listitem">
<p>
Whether your account is locked or unlocked.
</p>
</li>
</ul>
</div>
<p>
The server checks credentials first, then account locking state. A
failure at either step causes the server to deny access to you
completely. Otherwise, the server accepts the connection, and then
enters Stage 2 and waits for requests.
</p>
<p>
The server performs identity and credentials checking using
columns in the
<code class="literal">
user
</code>
table, accepting the
connection only if these conditions are satisfied:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
The client host name and user name match the
<code class="literal">
Host
</code>
and
<code class="literal">
User
</code>
columns in
some
<code class="literal">
user
</code>
table row. For the rules
governing permissible
<code class="literal">
Host
</code>
and
<code class="literal">
User
</code>
values, see
<a class="xref" href="account-names.html" title="8.2.4 Specifying Account Names">
Section 8.2.4, “Specifying Account Names”
</a>
.
</p>
</li>
<li class="listitem">
<p>
The client supplies the credentials specified in the row (for
example, a password), as indicated by the
<code class="literal">
authentication_string
</code>
column. Credentials
are interpreted using the authentication plugin named in the
<code class="literal">
plugin
</code>
column.
</p>
</li>
<li class="listitem">
<p>
The row indicates that the account is unlocked. Locking state
is recorded in the
<code class="literal">
account_locked
</code>
column,
which must have a value of
<code class="literal">
'N'
</code>
. Account
locking can be set or changed with the
<a class="link" href="create-user.html" title="15.7.1.3 CREATE USER Statement">
<code class="literal">
CREATE USER
</code>
</a>
or
<a class="link" href="alter-user.html" title="15.7.1.1 ALTER USER Statement">
<code class="literal">
ALTER USER
</code>
</a>
statement.
</p>
</li>
</ul>
</div>
<p>
Your identity is based on two pieces of information:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Your MySQL user name.
</p>
</li>
<li class="listitem">
<p>
The client host from which you connect.
</p>
</li>
</ul>
</div>
<a class="indexterm" name="idm46045249844528">
</a>
<p>
If the
<code class="literal">
User
</code>
column value is nonblank, the user
name in an incoming connection must match exactly. If the
<code class="literal">
User
</code>
value is blank, it matches any user name.
If the
<code class="literal">
user
</code>
table row that matches an incoming
connection has a blank user name, the user is considered to be an
anonymous user with no name, not a user with the name that the
client actually specified. This means that a blank user name is
used for all further access checking for the duration of the
connection (that is, during Stage 2).
</p>
<p>
The
<code class="literal">
authentication_string
</code>
column can be blank.
This is not a wildcard and does not mean that any password
matches. It means that the user must connect without specifying a
password. The authentication method implemented by the plugin that
authenticates the client may or may not use the password in the
<code class="literal">
authentication_string
</code>
column. In this case, it
is possible that an external password is also used to authenticate
to the MySQL server.
</p>
<p>
Nonblank password values stored in the
<code class="literal">
authentication_string
</code>
column of the
<code class="literal">
user
</code>
table are encrypted. MySQL does not store
passwords as cleartext for anyone to see. Rather, the password
supplied by a user who is attempting to connect is encrypted
(using the password hashing method implemented by the account
authentication plugin). The encrypted password then is used during
the connection process when checking whether the password is
correct. This is done without the encrypted password ever
traveling over the connection. See
<a class="xref" href="user-names.html" title="8.2.1 Account User Names and Passwords">
Section 8.2.1, “Account User Names and Passwords”
</a>
.
</p>
<p>
From the MySQL server's point of view, the encrypted password
is the
<span class="emphasis">
<em>
real
</em>
</span>
password, so you should never
give anyone access to it. In particular,
<span class="emphasis">
<em>
do not give
nonadministrative users read access to tables in the
<code class="literal">
mysql
</code>
system database
</em>
</span>
.
</p>
<p>
The following table shows how various combinations of
<code class="literal">
User
</code>
and
<code class="literal">
Host
</code>
values in the
<code class="literal">
user
</code>
table apply to incoming connections.
</p>
<div class="informaltable">
<table summary="How various combinations of User and Host values in the user table apply to incoming connections to a MySQL server.">
<colgroup>
<col style="width: 15%"/>
<col style="width: 35%"/>
<col style="width: 50%"/>
</colgroup>
<thead>
<tr>
<th scope="col">
<code class="literal">
User
</code>
Value
</th>
<th scope="col">
<code class="literal">
Host
</code>
Value
</th>
<th scope="col">
Permissible Connections
</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">
<code class="literal">
'fred'
</code>
</th>
<td>
<code class="literal">
'h1.example.net'
</code>
</td>
<td>
<code class="literal">
fred
</code>
, connecting from
<code class="literal">
h1.example.net
</code>
</td>
</tr>
<tr>
<th scope="row">
<code class="literal">
''
</code>
</th>
<td>
<code class="literal">
'h1.example.net'
</code>
</td>
<td>
Any user, connecting from
<code class="literal">
h1.example.net
</code>
</td>
</tr>
<tr>
<th scope="row">
<code class="literal">
'fred'
</code>
</th>
<td>
<code class="literal">
'%'
</code>
</td>
<td>
<code class="literal">
fred
</code>
, connecting from any host
</td>
</tr>
<tr>
<th scope="row">
<code class="literal">
''
</code>
</th>
<td>
<code class="literal">
'%'
</code>
</td>
<td>
Any user, connecting from any host
</td>
</tr>
<tr>
<th scope="row">
<code class="literal">
'fred'
</code>
</th>
<td>
<code class="literal">
'%.example.net'
</code>
</td>
<td>
<code class="literal">
fred
</code>
, connecting from any host in the
<code class="literal">
example.net
</code>
domain
</td>
</tr>
<tr>
<th scope="row">
<code class="literal">
'fred'
</code>
</th>
<td>
<code class="literal">
'x.example.%'
</code>
</td>
<td>
<code class="literal">
fred
</code>
, connecting from
<code class="literal">
x.example.net
</code>
,
<code class="literal">
x.example.com
</code>
,
<code class="literal">
x.example.edu
</code>
, and so on; this is
probably not useful
</td>
</tr>
<tr>
<th scope="row">
<code class="literal">
'fred'
</code>
</th>
<td>
<code class="literal">
'198.51.100.177'
</code>
</td>
<td>
<code class="literal">
fred
</code>
, connecting from the host with IP address
<code class="literal">
198.51.100.177
</code>
</td>
</tr>
<tr>
<th scope="row">
<code class="literal">
'fred'
</code>
</th>
<td>
<code class="literal">
'198.51.100.%'
</code>
</td>
<td>
<code class="literal">
fred
</code>
, connecting from any host in the
<code class="literal">
198.51.100
</code>
class C subnet
</td>
</tr>
<tr>
<th scope="row">
<code class="literal">
'fred'
</code>
</th>
<td>
<code class="literal">
'198.51.100.0/255.255.255.0'
</code>
</td>
<td>
Same as previous example
</td>
</tr>
</tbody>
</table>
</div>
<p>
It is possible for the client host name and user name of an
incoming connection to match more than one row in the
<code class="literal">
user
</code>
table. The preceding set of examples
demonstrates this: Several of the entries shown match a connection
from
<code class="literal">
h1.example.net
</code>
by
<code class="literal">
fred
</code>
.
</p>
<p>
When multiple matches are possible, the server must determine
which of them to use. It resolves this issue as follows:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Whenever the server reads the
<code class="literal">
user
</code>
table
into memory, it sorts the rows.
</p>
</li>
<li class="listitem">
<p>
When a client attempts to connect, the server looks through
the rows in sorted order.
</p>
</li>
<li class="listitem">
<p>
The server uses the first row that matches the client host
name and user name.
</p>
</li>
</ul>
</div>
<p>
The server uses sorting rules that order rows with the
most-specific
<code class="literal">
Host
</code>
values first:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Literal IP addresses and host names are the most specific.
</p>
</li>
<li class="listitem">
<p>
Accounts with an IP address in the host part have this order
of specificity:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
Accounts that have the host part given as an IP address:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa94323672"><div class="copy-help left">Press ⌘+C to 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> <span class="token string">'<em class="replaceable">user_name</em>'</span>@<span class="token string">'127.0.0.1'</span><span class="token punctuation">;</span>
<span class="token keyword">CREATE</span> <span class="token keyword">USER</span> <span class="token string">'<em class="replaceable">user_name</em>'</span>@<span class="token string">'198.51.100.44'</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
Accounts that have the host part given as an IP address
using CIDR notation:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa45900276"><div class="copy-help left">Press ⌘+C to 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> <span class="token string">'<em class="replaceable">user_name</em>'</span>@<span class="token string">'192.0.2.21/8'</span><span class="token punctuation">;</span>
<span class="token keyword">CREATE</span> <span class="token keyword">USER</span> <span class="token string">'<em class="replaceable">user_name</em>'</span>@<span class="token string">'198.51.100.44/16'</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
Accounts that have the host part given as an IP address
with a subnet mask:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa93305307"><div class="copy-help left">Press ⌘+C to 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> <span class="token string">'<em class="replaceable">user_name</em>'</span>@<span class="token string">'192.0.2.0/255.255.255.0'</span><span class="token punctuation">;</span>
<span class="token keyword">CREATE</span> <span class="token keyword">USER</span> <span class="token string">'<em class="replaceable">user_name</em>'</span>@<span class="token string">'198.51.0.0/255.255.0.0'</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
The pattern
<code class="literal">
'%'
</code>
means
<span class="quote">
“
<span class="quote">
any
host
</span>
”
</span>
and is least specific.
</p>
</li>
<li class="listitem">
<p>
The empty string
<code class="literal">
''
</code>
also means
<span class="quote">
“
<span class="quote">
any
host
</span>
”
</span>
but sorts after
<code class="literal">
'%'
</code>
.
</p>
</li>
</ul>
</div>
<p>
Non-TCP (socket file, named pipe, and shared memory) connections
are treated as local connections and match a host part of
<code class="literal">
localhost
</code>
if there are any such accounts, or
host parts with wildcards that match
<code class="literal">
localhost
</code>
otherwise (for example,
<code class="literal">
local%
</code>
,
<code class="literal">
l%
</code>
,
<code class="literal">
%
</code>
).
</p>
<p>
The treatment of
<code class="literal">
'%'
</code>
as equivalent to
<code class="literal">
localhost
</code>
is deprecated; you should expect this
behavior to removed from a future version of MySQL.
</p>
<p>
Rows with the same
<code class="literal">
Host
</code>
value are ordered with
the most-specific
<code class="literal">
User
</code>
values first. A blank
<code class="literal">
User
</code>
value means
<span class="quote">
“
<span class="quote">
any user
</span>
”
</span>
and is
least specific, so for rows with the same
<code class="literal">
Host
</code>
value, nonanonymous users sort before anonymous users.
</p>
<p>
For rows with equally-specific
<code class="literal">
Host
</code>
and
<code class="literal">
User
</code>
values, the order is nondeterministic.
</p>
<p>
To see how this works, suppose that the
<code class="literal">
user
</code>
table looks like this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-none"><div class="docs-select-all right" id="sa39612687"><div class="copy-help left">Press ⌘+C to 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">+-----------+----------+-
| Host | User | ...
+-----------+----------+-
| % | root | ...
| % | jeffrey | ...
| localhost | root | ...
| localhost | | ...
+-----------+----------+-</code></pre>
</div>
<p>
When the server reads the table into memory, it sorts the rows
using the rules just described. The result after sorting looks
like this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-none"><div class="docs-select-all right" id="sa60137583"><div class="copy-help left">Press ⌘+C to 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">+-----------+----------+-
| Host | User | ...
+-----------+----------+-
| localhost | root | ...
| localhost | | ...
| % | jeffrey | ...
| % | root | ...
+-----------+----------+-</code></pre>
</div>
<a class="indexterm" name="idm46045249735936">
</a>
<a class="indexterm" name="idm46045249734448">
</a>
<a class="indexterm" name="idm46045249732960">
</a>
<p>
When a client attempts to connect, the server looks through the
sorted rows and uses the first match found. For a connection from
<code class="literal">
localhost
</code>
by
<code class="literal">
jeffrey
</code>
, two of
the rows from the table match: the one with
<code class="literal">
Host
</code>
and
<code class="literal">
User
</code>
values of
<code class="literal">
'localhost'
</code>
and
<code class="literal">
''
</code>
, and the
one with values of
<code class="literal">
'%'
</code>
and
<code class="literal">
'jeffrey'
</code>
. The
<code class="literal">
'localhost'
</code>
row appears first in sorted order, so that is the one the server
uses.
</p>
<p>
Here is another example. Suppose that the
<code class="literal">
user
</code>
table looks like this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-none"><div class="docs-select-all right" id="sa10167360"><div class="copy-help left">Press ⌘+C to 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">+----------------+----------+-
| Host | User | ...
+----------------+----------+-
| % | jeffrey | ...
| h1.example.net | | ...
+----------------+----------+-</code></pre>
</div>
<p>
The sorted table looks like this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-none"><div class="docs-select-all right" id="sa2957553"><div class="copy-help left">Press ⌘+C to 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">+----------------+----------+-
| Host | User | ...
+----------------+----------+-
| h1.example.net | | ...
| % | jeffrey | ...
+----------------+----------+-</code></pre>
</div>
<p>
The first row matches a connection by any user from
<code class="literal">
h1.example.net
</code>
, whereas the second row matches
a connection by
<code class="literal">
jeffrey
</code>
from any host.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
It is a common misconception to think that, for a given user
name, all rows that explicitly name that user are used first
when the server attempts to find a match for the connection.
This is not true. The preceding example illustrates this, where
a connection from
<code class="literal">
h1.example.net
</code>
by
<code class="literal">
jeffrey
</code>
is first matched not by the row
containing
<code class="literal">
'jeffrey'
</code>
as the
<code class="literal">
User
</code>
column value, but by the row with no
user name. As a result,
<code class="literal">
jeffrey
</code>
is
authenticated as an anonymous user, even though he specified a
user name when connecting.
</p>
</div>
<p>
If you are able to connect to the server, but your privileges are
not what you expect, you probably are being authenticated as some
other account. To find out what account the server used to
authenticate you, use the
<a class="link" href="information-functions.html#function_current-user">
<code class="literal">
CURRENT_USER()
</code>
</a>
function. (See
<a class="xref" href="information-functions.html" title="14.15 Information Functions">
Section 14.15, “Information Functions”
</a>
.) It returns a value in
<code class="literal">
<em class="replaceable">
<code>
user_name
</code>
</em>
@
<em class="replaceable">
<code>
host_name
</code>
</em>
</code>
format that indicates the
<code class="literal">
User
</code>
and
<code class="literal">
Host
</code>
values from the matching
<code class="literal">
user
</code>
table row. Suppose that
<code class="literal">
jeffrey
</code>
connects and issues the following
query:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa28536110"><div class="copy-help left">Press ⌘+C to 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">CURRENT_USER</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>
<span class="token output"><span class="token punctuation">|</span> CURRENT_USER() <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> @localhost <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></code></pre>
</div>
<p>
The result shown here indicates that the matching
<code class="literal">
user
</code>
table row had a blank
<code class="literal">
User
</code>
column value. In other words, the server
is treating
<code class="literal">
jeffrey
</code>
as an anonymous user.
</p>
<p>
Another way to diagnose authentication problems is to print out
the
<code class="literal">
user
</code>
table and sort it by hand to see where
the first match is being made.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/gis-geometrycollection-property-functions.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="gis-geometrycollection-property-functions">
</a>
14.16.7.5 GeometryCollection Property Functions
</h4>
</div>
</div>
</div>
<p>
These functions return properties of
<code class="literal">
GeometryCollection
</code>
values.
</p>
<p>
Unless otherwise specified, functions in this section handle
their geometry arguments as follows:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
If any argument is
<code class="literal">
NULL
</code>
or any geometry
argument is an empty geometry, the return value is
<code class="literal">
NULL
</code>
.
</p>
</li>
<li class="listitem">
<p>
If any geometry argument is not a syntactically well-formed
geometry, an
<a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_gis_invalid_data" target="_top">
<code class="literal">
ER_GIS_INVALID_DATA
</code>
</a>
error
occurs.
</p>
</li>
<li class="listitem">
<p>
If any geometry argument is a syntactically well-formed
geometry in an undefined spatial reference system (SRS), an
<a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_srs_not_found" target="_top">
<code class="literal">
ER_SRS_NOT_FOUND
</code>
</a>
error
occurs.
</p>
</li>
<li class="listitem">
<p>
Otherwise, the return value is non-
<code class="literal">
NULL
</code>
.
</p>
</li>
</ul>
</div>
<p>
These functions are available for obtaining geometry collection
properties:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<a name="function_st-geometryn">
</a>
<p>
<a class="link" href="gis-geometrycollection-property-functions.html#function_st-geometryn">
<code class="literal">
ST_GeometryN(
<em class="replaceable">
<code>
gc
</code>
</em>
,
<em class="replaceable">
<code>
N
</code>
</em>
)
</code>
</a>
</p>
<a class="indexterm" name="idm46045197021200">
</a>
<p>
Returns the
<em class="replaceable">
<code>
N
</code>
</em>
-th geometry in the
<code class="literal">
GeometryCollection
</code>
value
<em class="replaceable">
<code>
gc
</code>
</em>
. Geometries are numbered
beginning with 1.
</p>
<p>
<a class="link" href="gis-geometrycollection-property-functions.html#function_st-geometryn">
<code class="literal">
ST_GeometryN()
</code>
</a>
handles its
arguments as described in the introduction to this section.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa82797247"><div class="copy-help left">Press ⌘+C to 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 variable">@gc</span> <span class="token operator">=</span> <span class="token string">'GeometryCollection(Point(1 1),LineString(2 2, 3 3))'</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">ST_AsText</span><span class="token punctuation">(</span><span class="token function">ST_GeometryN</span><span class="token punctuation">(</span><span class="token function">ST_GeomFromText</span><span class="token punctuation">(</span><span class="token variable">@gc</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 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>
<span class="token output"><span class="token punctuation">|</span> ST_AsText(ST_GeometryN(ST_GeomFromText(@gc),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>
<span class="token output"><span class="token punctuation">|</span> POINT(1 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></code></pre>
</div>
</li>
<li class="listitem">
<a name="function_st-numgeometries">
</a>
<p>
<a class="link" href="gis-geometrycollection-property-functions.html#function_st-numgeometries">
<code class="literal">
ST_NumGeometries(
<em class="replaceable">
<code>
gc
</code>
</em>
)
</code>
</a>
</p>
<a class="indexterm" name="idm46045197007696">
</a>
<p>
Returns the number of geometries in the
<code class="literal">
GeometryCollection
</code>
value
<em class="replaceable">
<code>
gc
</code>
</em>
.
</p>
<p>
<a class="link" href="gis-geometrycollection-property-functions.html#function_st-numgeometries">
<code class="literal">
ST_NumGeometries()
</code>
</a>
handles
its arguments as described in the introduction to this
section.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa17277049"><div class="copy-help left">Press ⌘+C to 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 variable">@gc</span> <span class="token operator">=</span> <span class="token string">'GeometryCollection(Point(1 1),LineString(2 2, 3 3))'</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">ST_NumGeometries</span><span class="token punctuation">(</span><span class="token function">ST_GeomFromText</span><span class="token punctuation">(</span><span class="token variable">@gc</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>
<span class="token output"><span class="token punctuation">|</span> ST_NumGeometries(ST_GeomFromText(@gc)) <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> 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></code></pre>
</div>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/mysql-shell-tutorial-javascript-relational-tables.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="mysql-shell-tutorial-javascript-relational-tables">
</a>
22.3.4 Relational Tables
</h3>
</div>
</div>
</div>
<div class="toc">
<dl class="toc">
<dt>
<span class="section">
<a href="mysql-shell-tutorial-javascript-table-insert.html">
22.3.4.1 Insert Records into Tables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-shell-tutorial-javascript-table-select.html">
22.3.4.2 Select Tables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-shell-tutorial-javascript-table-update.html">
22.3.4.3 Update Tables
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="mysql-shell-tutorial-javascript-table-delete.html">
22.3.4.4 Delete Tables
</a>
</span>
</dt>
</dl>
</div>
<a class="indexterm" name="idm46045127653888">
</a>
<p>
You can also use X DevAPI to work with relational tables. In
MySQL, each relational table is associated with a particular
storage engine. The examples in this section use
<a class="link" href="innodb-storage-engine.html" title="Chapter 17 The InnoDB Storage Engine">
<code class="literal">
InnoDB
</code>
</a>
tables in the
<code class="literal">
world_x
</code>
schema.
</p>
<h4>
<a name="idm46045127649840">
</a>
Confirm the Schema
</h4>
<p>
To show the schema that is assigned to the
<code class="literal">
db
</code>
global variable, issue
<code class="literal">
db
</code>
.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-mysqlsh"><div class="docs-select-all right" id="sa7465531"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-mysqlsh"><span class="token prompt">mysql-js></span> db
<span class="token operator"><</span>Schema<span class="token punctuation">:</span>world_x<span class="token operator">></span></code></pre>
</div>
<p>
If the returned value is not
<code class="literal">
Schema:world_x
</code>
,
set the
<code class="literal">
db
</code>
variable as follows:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-mysqlsh"><div class="docs-select-all right" id="sa3353430"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-mysqlsh"><span class="token prompt">mysql-js></span> \use world_x
Schema <span class="token template-string"><span class="token string">`world_x`</span></span> accessible through db<span class="token punctuation">.</span></code></pre>
</div>
<h4>
<a name="idm46045127642144">
</a>
Show All Tables
</h4>
<p>
To display all relational tables in the
<code class="literal">
world_x
</code>
schema, use the
<code class="literal">
getTables()
</code>
method on the
<code class="literal">
db
</code>
object.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-mysqlsh"><div class="docs-select-all right" id="sa11796249"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-mysqlsh"><span class="token prompt">mysql-js></span> db<span class="token punctuation">.</span><span class="token function">getTables</span><span class="token punctuation">(</span><span class="token punctuation">)</span>
<span class="token inlinejson"><span class="token punctuation">{</span>
<span class="token property">"city"</span><span class="token operator">:</span> <Table<span class="token operator">:</span>city><span class="token punctuation">,</span>
<span class="token property">"country"</span><span class="token operator">:</span> <Table<span class="token operator">:</span>country><span class="token punctuation">,</span>
<span class="token property">"countrylanguage"</span><span class="token operator">:</span> <Table<span class="token operator">:</span>countrylanguage>
<span class="token punctuation">}</span></span></code></pre>
</div>
<h4>
<a name="idm46045127636976">
</a>
Basic Table Operations
</h4>
<p>
Basic operations scoped by tables include:
</p>
<div class="informaltable">
<table summary="CRUD operations to use interactively on tables within MySQL Shell">
<colgroup>
<col style="width: 32%"/>
<col style="width: 68%"/>
</colgroup>
<thead>
<tr>
<th>
Operation form
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<code class="literal">
db.
<em class="replaceable">
<code>
name
</code>
</em>
.insert()
</code>
</td>
<td>
The
<a class="link" href="mysql-shell-tutorial-javascript-table-insert.html" title="22.3.4.1 Insert Records into Tables">
insert()
</a>
method inserts one or more records into the named table.
</td>
</tr>
<tr>
<td>
<code class="literal">
db.
<em class="replaceable">
<code>
name
</code>
</em>
.select()
</code>
</td>
<td>
The
<a class="link" href="mysql-shell-tutorial-javascript-table-select.html" title="22.3.4.2 Select Tables">
select()
</a>
method returns some or all records in the named table.
</td>
</tr>
<tr>
<td>
<code class="literal">
db.
<em class="replaceable">
<code>
name
</code>
</em>
.update()
</code>
</td>
<td>
The
<a class="link" href="mysql-shell-tutorial-javascript-table-update.html" title="22.3.4.3 Update Tables">
update()
</a>
method updates records in the named table.
</td>
</tr>
<tr>
<td>
<code class="literal">
db.
<em class="replaceable">
<code>
name
</code>
</em>
.delete()
</code>
</td>
<td>
The
<a class="link" href="mysql-shell-tutorial-javascript-table-delete.html" title="22.3.4.4 Delete Tables">
delete()
</a>
method deletes one or more records from the named table.
</td>
</tr>
</tbody>
</table>
</div>
<h4>
<a name="idm46045127614160">
</a>
Related Information
</h4>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
See
<a class="ulink" href="/doc/x-devapi-userguide/en/devapi-users-working-with-relational-tables.html" target="_top">
Working with Relational Tables
</a>
for more information.
</p>
</li>
<li class="listitem">
<p>
<a class="ulink" href="/doc/x-devapi-userguide/en/mysql-x-crud-ebnf-definitions.html" target="_top">
CRUD EBNF Definitions
</a>
provides a
complete list of operations.
</p>
</li>
<li class="listitem">
<p>
See
<a class="xref" href="mysql-shell-tutorial-javascript-download.html" title="22.3.2 Download and Import world_x Database">
Section 22.3.2, “Download and Import world_x Database”
</a>
for instructions on setting up the
<code class="literal">
world_x
</code>
schema sample.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/innodb-undo-logs.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="innodb-undo-logs">
</a>
17.6.6 Undo Logs
</h3>
</div>
</div>
</div>
<p>
An undo log is a collection of undo log records associated with a
single read-write transaction. An undo log record contains
information about how to undo the latest change by a transaction
to a
<a class="link" href="glossary.html#glos_clustered_index" title="clustered index">
clustered index
</a>
record. If another transaction needs to see the original data as
part of a consistent read operation, the unmodified data is
retrieved from undo log records. Undo logs exist within
<a class="link" href="glossary.html#glos_undo_log_segment" title="undo log segment">
undo log segments
</a>
,
which are contained within
<a class="link" href="glossary.html#glos_rollback_segment" title="rollback segment">
rollback segments
</a>
.
Rollback segments reside in
<a class="link" href="glossary.html#glos_undo_tablespace" title="undo tablespace">
undo tablespaces
</a>
and
in the
<a class="link" href="glossary.html#glos_global_temporary_tablespace" title="global temporary tablespace">
global
temporary tablespace
</a>
.
</p>
<p>
Undo logs that reside in the global temporary tablespace are used
for transactions that modify data in user-defined temporary
tables. These undo logs are not redo-logged, as they are not
required for crash recovery. They are used only for rollback while
the server is running. This type of undo log benefits performance
by avoiding redo logging I/O.
</p>
<p>
For information about data-at-rest encryption for undo logs, see
<a class="xref" href="innodb-data-encryption.html#innodb-data-encryption-undo-log" title="Undo Log Encryption">
Undo Log Encryption
</a>
.
</p>
<p>
Each undo tablespace and the global temporary tablespace
individually support a maximum of 128 rollback segments. The
<a class="link" href="innodb-parameters.html#sysvar_innodb_rollback_segments">
<code class="literal">
innodb_rollback_segments
</code>
</a>
variable
defines the number of rollback segments.
</p>
<p>
The number of transactions that a rollback segment supports
depends on the number of undo slots in the rollback segment and
the number of undo logs required by each transaction. The number
of undo slots in a rollback segment differs according to
<code class="literal">
InnoDB
</code>
page size.
</p>
<div class="informaltable">
<table summary="Number of undo slots in a rollback segment for each InnoDB page size">
<colgroup>
<col style="width: 50%"/>
<col style="width: 50%"/>
</colgroup>
<thead>
<tr>
<th>
InnoDB Page Size
</th>
<th>
Number of Undo Slots in a Rollback Segment (InnoDB Page Size / 16)
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<code class="literal">
4096 (4KB)
</code>
</td>
<td>
<code class="literal">
256
</code>
</td>
</tr>
<tr>
<td>
<code class="literal">
8192 (8KB)
</code>
</td>
<td>
<code class="literal">
512
</code>
</td>
</tr>
<tr>
<td>
<code class="literal">
16384 (16KB)
</code>
</td>
<td>
<code class="literal">
1024
</code>
</td>
</tr>
<tr>
<td>
<code class="literal">
32768 (32KB)
</code>
</td>
<td>
<code class="literal">
2048
</code>
</td>
</tr>
<tr>
<td>
<code class="literal">
65536 (64KB)
</code>
</td>
<td>
<code class="literal">
4096
</code>
</td>
</tr>
</tbody>
</table>
</div>
<p>
A transaction is assigned up to four undo logs, one for each of
the following operation types:
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
<a class="link" href="insert.html" title="15.2.7 INSERT Statement">
<code class="literal">
INSERT
</code>
</a>
operations on
user-defined tables
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="update.html" title="15.2.17 UPDATE Statement">
<code class="literal">
UPDATE
</code>
</a>
and
<a class="link" href="delete.html" title="15.2.2 DELETE Statement">
<code class="literal">
DELETE
</code>
</a>
operations on
user-defined tables
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="insert.html" title="15.2.7 INSERT Statement">
<code class="literal">
INSERT
</code>
</a>
operations on
user-defined temporary tables
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="update.html" title="15.2.17 UPDATE Statement">
<code class="literal">
UPDATE
</code>
</a>
and
<a class="link" href="delete.html" title="15.2.2 DELETE Statement">
<code class="literal">
DELETE
</code>
</a>
operations on
user-defined temporary tables
</p>
</li>
</ol>
</div>
<p>
Undo logs are assigned as needed. For example, a transaction that
performs
<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>
, and
<a class="link" href="delete.html" title="15.2.2 DELETE Statement">
<code class="literal">
DELETE
</code>
</a>
operations on regular and
temporary tables requires a full assignment of four undo logs. A
transaction that performs only
<a class="link" href="insert.html" title="15.2.7 INSERT Statement">
<code class="literal">
INSERT
</code>
</a>
operations on regular tables
requires a single undo log.
</p>
<p>
A transaction that performs operations on regular tables is
assigned undo logs from an assigned undo tablespace rollback
segment. A transaction that performs operations on temporary
tables is assigned undo logs from an assigned global temporary
tablespace rollback segment.
</p>
<p>
An undo log assigned to a transaction remains attached to the
transaction for its duration. For example, an undo log assigned to
a transaction for an
<a class="link" href="insert.html" title="15.2.7 INSERT Statement">
<code class="literal">
INSERT
</code>
</a>
operation on a regular table is used for all
<a class="link" href="insert.html" title="15.2.7 INSERT Statement">
<code class="literal">
INSERT
</code>
</a>
operations on regular tables
performed by that transaction.
</p>
<p>
Given the factors described above, the following formulas can be
used to estimate the number of concurrent read-write transactions
that
<code class="literal">
InnoDB
</code>
is capable of supporting.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
It is possible to encounter a concurrent transaction limit error
before reaching the number of concurrent read-write transactions
that
<code class="literal">
InnoDB
</code>
is capable of supporting. This
occurs when a rollback segment assigned to a transaction runs
out of undo slots. In such cases, try rerunning the transaction.
</p>
<p>
When transactions perform operations on temporary tables, the
number of concurrent read-write transactions that
<code class="literal">
InnoDB
</code>
is capable of supporting is
constrained by the number of rollback segments allocated to the
global temporary tablespace, which is 128 by default.
</p>
</div>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
If each transaction performs either an
<a class="link" href="insert.html" title="15.2.7 INSERT Statement">
<code class="literal">
INSERT
</code>
</a>
<span class="bold">
<strong>
or
</strong>
</span>
an
<a class="link" href="update.html" title="15.2.17 UPDATE Statement">
<code class="literal">
UPDATE
</code>
</a>
or
<a class="link" href="delete.html" title="15.2.2 DELETE Statement">
<code class="literal">
DELETE
</code>
</a>
operation, the number of
concurrent read-write transactions that
<code class="literal">
InnoDB
</code>
is capable of supporting is:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-none"><div class="docs-select-all right" id="sa12494739"><div class="copy-help left">Press ⌘+C to 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_page_size / 16) * innodb_rollback_segments * number of undo tablespaces</code></pre>
</div>
</li>
<li class="listitem">
<p>
If each transaction performs an
<a class="link" href="insert.html" title="15.2.7 INSERT Statement">
<code class="literal">
INSERT
</code>
</a>
<span class="bold">
<strong>
and
</strong>
</span>
an
<a class="link" href="update.html" title="15.2.17 UPDATE Statement">
<code class="literal">
UPDATE
</code>
</a>
or
<a class="link" href="delete.html" title="15.2.2 DELETE Statement">
<code class="literal">
DELETE
</code>
</a>
operation, the number of
concurrent read-write transactions that
<code class="literal">
InnoDB
</code>
is capable of supporting is:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-none"><div class="docs-select-all right" id="sa86131014"><div class="copy-help left">Press ⌘+C to 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_page_size / 16 / 2) * innodb_rollback_segments * number of undo tablespaces</code></pre>
</div>
</li>
<li class="listitem">
<p>
If each transaction performs an
<a class="link" href="insert.html" title="15.2.7 INSERT Statement">
<code class="literal">
INSERT
</code>
</a>
operation on a temporary
table, the number of concurrent read-write transactions that
<code class="literal">
InnoDB
</code>
is capable of supporting is:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-none"><div class="docs-select-all right" id="sa6789528"><div class="copy-help left">Press ⌘+C to 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_page_size / 16) * innodb_rollback_segments</code></pre>
</div>
</li>
<li class="listitem">
<p>
If each transaction performs an
<a class="link" href="insert.html" title="15.2.7 INSERT Statement">
<code class="literal">
INSERT
</code>
</a>
<span class="bold">
<strong>
and
</strong>
</span>
an
<a class="link" href="update.html" title="15.2.17 UPDATE Statement">
<code class="literal">
UPDATE
</code>
</a>
or
<a class="link" href="delete.html" title="15.2.2 DELETE Statement">
<code class="literal">
DELETE
</code>
</a>
operation on a temporary
table, the number of concurrent read-write transactions that
<code class="literal">
InnoDB
</code>
is capable of supporting is:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-none"><div class="docs-select-all right" id="sa40513178"><div class="copy-help left">Press ⌘+C to 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_page_size / 16 / 2) * innodb_rollback_segments</code></pre>
</div>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/preventing-use-of-optimizer-trace.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="preventing-use-of-optimizer-trace">
</a>
10.15.14 Preventing the Use of Optimizer Trace
</h3>
</div>
</div>
</div>
<p>
If, for some reason, you wish to prevent users from seeing traces
of their queries, start the server with the options shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa25718024"><div class="copy-help left">Press ⌘+C to 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">--maximum-optimizer-trace-max-mem-size</span><span class="token attr-value"><span class="token punctuation">=</span>0</span> <span class="token constant">--optimizer-trace-max-mem-size</span><span class="token attr-value"><span class="token punctuation">=</span>0</span></code></pre>
</div>
<p>
This sets the maximum size to 0 and prevents users from changing
this limit, thus truncating all traces to 0 bytes.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/if.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="if">
</a>
15.6.5.2 IF Statement
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045176311136">
</a>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa72985986"><div class="copy-help left">Press ⌘+C to 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">IF</span> <em class="replaceable">search_condition</em> <span class="token keyword">THEN</span> <em class="replaceable">statement_list</em>
<span class="token punctuation">[</span><span class="token keyword">ELSEIF</span> <em class="replaceable">search_condition</em> <span class="token keyword">THEN</span> <em class="replaceable">statement_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 keyword">ELSE</span> <em class="replaceable">statement_list</em><span class="token punctuation">]</span>
<span class="token keyword">END</span> <span class="token keyword">IF</span></code></pre>
</div>
<p>
The
<a class="link" href="if.html" title="15.6.5.2 IF Statement">
<code class="literal">
IF
</code>
</a>
statement for stored
programs implements a basic conditional construct.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
There is also an
<a class="link" href="flow-control-functions.html#function_if">
<code class="literal">
IF()
</code>
</a>
<span class="emphasis">
<em>
function
</em>
</span>
, which differs from the
<a class="link" href="if.html" title="15.6.5.2 IF Statement">
<code class="literal">
IF
</code>
</a>
<span class="emphasis">
<em>
statement
</em>
</span>
described here. See
<a class="xref" href="flow-control-functions.html" title="14.5 Flow Control Functions">
Section 14.5, “Flow Control Functions”
</a>
. The
<a class="link" href="if.html" title="15.6.5.2 IF Statement">
<code class="literal">
IF
</code>
</a>
statement can have
<code class="literal">
THEN
</code>
,
<code class="literal">
ELSE
</code>
, and
<code class="literal">
ELSEIF
</code>
clauses, and it is terminated with
<code class="literal">
END IF
</code>
.
</p>
</div>
<p>
If a given
<em class="replaceable">
<code>
search_condition
</code>
</em>
evaluates
to true, the corresponding
<code class="literal">
THEN
</code>
or
<code class="literal">
ELSEIF
</code>
clause
<em class="replaceable">
<code>
statement_list
</code>
</em>
executes. If no
<em class="replaceable">
<code>
search_condition
</code>
</em>
matches, the
<code class="literal">
ELSE
</code>
clause
<em class="replaceable">
<code>
statement_list
</code>
</em>
executes.
</p>
<p>
Each
<em class="replaceable">
<code>
statement_list
</code>
</em>
consists of one
or more SQL statements; an empty
<em class="replaceable">
<code>
statement_list
</code>
</em>
is not permitted.
</p>
<p>
An
<code class="literal">
IF ... END IF
</code>
block, like all other
flow-control blocks used within stored programs, must be
terminated with a semicolon, as shown in this example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa21649589"><div class="copy-help left">Press ⌘+C to 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">DELIMITER</span> <span class="token comment" spellcheck="true">//</span>
<span class="token keyword">CREATE</span> <span class="token keyword">FUNCTION</span> SimpleCompare<span class="token punctuation">(</span>n <span class="token datatype">INT</span><span class="token punctuation">,</span> m <span class="token datatype">INT</span><span class="token punctuation">)</span>
<span class="token keyword">RETURNS</span> <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 keyword">BEGIN</span>
<span class="token keyword">DECLARE</span> s <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 punctuation">;</span>
<span class="token keyword">IF</span> n <span class="token operator">></span> m <span class="token keyword">THEN</span> <span class="token keyword">SET</span> s <span class="token operator">=</span> <span class="token string">'>'</span><span class="token punctuation">;</span>
<span class="token keyword">ELSEIF</span> n <span class="token operator">=</span> m <span class="token keyword">THEN</span> <span class="token keyword">SET</span> s <span class="token operator">=</span> <span class="token string">'='</span><span class="token punctuation">;</span>
<span class="token keyword">ELSE</span> <span class="token keyword">SET</span> s <span class="token operator">=</span> <span class="token string">'<'</span><span class="token punctuation">;</span>
<span class="token keyword">END</span> <span class="token keyword">IF</span><span class="token punctuation">;</span>
<span class="token keyword">SET</span> s <span class="token operator">=</span> <span class="token function">CONCAT</span><span class="token punctuation">(</span>n<span class="token punctuation">,</span> <span class="token string">' '</span><span class="token punctuation">,</span> s<span class="token punctuation">,</span> <span class="token string">' '</span><span class="token punctuation">,</span> m<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">RETURN</span> s<span class="token punctuation">;</span>
<span class="token keyword">END</span> <span class="token comment" spellcheck="true">//</span>
<span class="token keyword">DELIMITER</span> <span class="token punctuation">;</span></code></pre>
</div>
<p>
As with other flow-control constructs,
<code class="literal">
IF ... END
IF
</code>
blocks may be nested within other flow-control
constructs, including other
<a class="link" href="if.html" title="15.6.5.2 IF Statement">
<code class="literal">
IF
</code>
</a>
statements. Each
<a class="link" href="if.html" title="15.6.5.2 IF Statement">
<code class="literal">
IF
</code>
</a>
must be
terminated by its own
<code class="literal">
END IF
</code>
followed by a
semicolon. You can use indentation to make nested flow-control
blocks more easily readable by humans (although this is not
required by MySQL), as shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa92501967"><div class="copy-help left">Press ⌘+C to 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">DELIMITER</span> <span class="token comment" spellcheck="true">//</span>
<span class="token keyword">CREATE</span> <span class="token keyword">FUNCTION</span> VerboseCompare <span class="token punctuation">(</span>n <span class="token datatype">INT</span><span class="token punctuation">,</span> m <span class="token datatype">INT</span><span class="token punctuation">)</span>
<span class="token keyword">RETURNS</span> <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 keyword">BEGIN</span>
<span class="token keyword">DECLARE</span> s <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 punctuation">;</span>
<span class="token keyword">IF</span> n <span class="token operator">=</span> m <span class="token keyword">THEN</span> <span class="token keyword">SET</span> s <span class="token operator">=</span> <span class="token string">'equals'</span><span class="token punctuation">;</span>
<span class="token keyword">ELSE</span>
<span class="token keyword">IF</span> n <span class="token operator">></span> m <span class="token keyword">THEN</span> <span class="token keyword">SET</span> s <span class="token operator">=</span> <span class="token string">'greater'</span><span class="token punctuation">;</span>
<span class="token keyword">ELSE</span> <span class="token keyword">SET</span> s <span class="token operator">=</span> <span class="token string">'less'</span><span class="token punctuation">;</span>
<span class="token keyword">END</span> <span class="token keyword">IF</span><span class="token punctuation">;</span>
<span class="token keyword">SET</span> s <span class="token operator">=</span> <span class="token function">CONCAT</span><span class="token punctuation">(</span><span class="token string">'is '</span><span class="token punctuation">,</span> s<span class="token punctuation">,</span> <span class="token string">' than'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">END</span> <span class="token keyword">IF</span><span class="token punctuation">;</span>
<span class="token keyword">SET</span> s <span class="token operator">=</span> <span class="token function">CONCAT</span><span class="token punctuation">(</span>n<span class="token punctuation">,</span> <span class="token string">' '</span><span class="token punctuation">,</span> s<span class="token punctuation">,</span> <span class="token string">' '</span><span class="token punctuation">,</span> m<span class="token punctuation">,</span> <span class="token string">'.'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">RETURN</span> s<span class="token punctuation">;</span>
<span class="token keyword">END</span> <span class="token comment" spellcheck="true">//</span>
<span class="token keyword">DELIMITER</span> <span class="token punctuation">;</span></code></pre>
</div>
<p>
In this example, the inner
<a class="link" href="if.html" title="15.6.5.2 IF Statement">
<code class="literal">
IF
</code>
</a>
is
evaluated only if
<code class="literal">
n
</code>
is not equal to
<code class="literal">
m
</code>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/packet-too-large.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="packet-too-large">
</a>
B.3.2.8 Packet Too Large
</h4>
</div>
</div>
</div>
<p>
A communication packet is a single SQL statement sent to the
MySQL server, a single row that is sent to the client, or a
binary log event sent from a replication source server to a
replica.
</p>
<p>
The largest possible packet that can be transmitted to or from
a MySQL 8.4 server or client is 1GB.
</p>
<p>
When a MySQL client or the
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
server
receives a packet bigger than
<a class="link" href="server-system-variables.html#sysvar_max_allowed_packet">
<code class="literal">
max_allowed_packet
</code>
</a>
bytes, it
issues an
<a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_net_packet_too_large" target="_top">
<code class="literal">
ER_NET_PACKET_TOO_LARGE
</code>
</a>
error
and closes the connection. With some clients, you may also get
a
<code class="literal">
Lost connection to MySQL server during
query
</code>
error if the communication packet is too
large.
</p>
<p>
Both the client and the server have their own
<a class="link" href="server-system-variables.html#sysvar_max_allowed_packet">
<code class="literal">
max_allowed_packet
</code>
</a>
variable,
so if you want to handle big packets, you must increase this
variable both in the client and in the server.
</p>
<p>
If you are 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 program,
its default
<a class="link" href="server-system-variables.html#sysvar_max_allowed_packet">
<code class="literal">
max_allowed_packet
</code>
</a>
variable
is 16MB. To set a larger value, start
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
like this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa96119891"><div class="copy-help left">Press ⌘+C to 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">--max_allowed_packet</span><span class="token attr-value"><span class="token punctuation">=</span>32M</span></code></pre>
</div>
<p>
That sets the packet size to 32MB.
</p>
<p>
The server's default
<a class="link" href="server-system-variables.html#sysvar_max_allowed_packet">
<code class="literal">
max_allowed_packet
</code>
</a>
value is
64MB. You can increase this if the server needs to handle big
queries (for example, if you are working with big
<a class="link" href="blob.html" title="13.3.4 The BLOB and TEXT Types">
<code class="literal">
BLOB
</code>
</a>
columns). For example, to
set the variable to 128MB, start the server like this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa65994170"><div class="copy-help left">Press ⌘+C to 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">mysqld</span> <span class="token constant">--max_allowed_packet</span><span class="token attr-value"><span class="token punctuation">=</span>128M</span></code></pre>
</div>
<p>
You can also use an option file to set
<a class="link" href="server-system-variables.html#sysvar_max_allowed_packet">
<code class="literal">
max_allowed_packet
</code>
</a>
. For
example, to set the size for the server to 128MB, add the
following lines in an option file:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-ini"><div class="docs-select-all right" id="sa53726827"><div class="copy-help left">Press ⌘+C to 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">max_allowed_packet</span><span class="token attr-value"><span class="token punctuation">=</span>128M</span></code></pre>
</div>
<p>
It is safe to increase the value of this variable because the
extra memory is allocated only when needed. For example,
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
allocates more memory only when you
issue a long query or when
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
must
return a large result row. The small default value of the
variable is a precaution to catch incorrect packets between
the client and server and also to ensure that you do not run
out of memory by using large packets accidentally.
</p>
<p>
You can also get strange problems with large packets if you
are using large
<a class="link" href="blob.html" title="13.3.4 The BLOB and TEXT Types">
<code class="literal">
BLOB
</code>
</a>
values but
have not given
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
access to enough
memory to handle the query. If you suspect this is the case,
try adding
<span class="command">
<strong>
ulimit -d 256000
</strong>
</span>
to the
beginning of the
<a class="link" href="mysqld-safe.html" title="6.3.2 mysqld_safe — MySQL Server Startup Script">
<span class="command">
<strong>
mysqld_safe
</strong>
</span>
</a>
script and
restarting
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/selinux.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title">
<a name="selinux">
</a>
8.7 SELinux
</h2>
</div>
</div>
</div>
<div class="toc">
<dl class="toc">
<dt>
<span class="section">
<a href="selinux-checking.html">
8.7.1 Check if SELinux is Enabled
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="selinux-mode.html">
8.7.2 Changing the SELinux Mode
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="selinux-policies.html">
8.7.3 MySQL Server SELinux Policies
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="selinux-file-context.html">
8.7.4 SELinux File Context
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="selinux-context-tcp-port.html">
8.7.5 SELinux TCP Port Context
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="selinux-troubleshooting.html">
8.7.6 Troubleshooting SELinux
</a>
</span>
</dt>
</dl>
</div>
<a class="indexterm" name="idm46045231672656">
</a>
<p>
Security-Enhanced Linux (SELinux) is a mandatory access control
(MAC) system that implements access rights by applying a security
label referred to as an
<span class="emphasis">
<em>
SELinux context
</em>
</span>
to each
system object. SELinux policy modules use SELinux contexts to define
rules for how processes, files, ports, and other system objects
interact with each other. Interaction between system objects is only
permitted if a policy rule allows it.
</p>
<p>
An SELinux context (the label applied to a system object) has the
following fields:
<code class="literal">
user
</code>
,
<code class="literal">
role
</code>
,
<code class="literal">
type
</code>
, and
<code class="literal">
security level
</code>
. Type
information rather than the entire SELinux context is used most
commonly to define rules for how processes interact with other
system objects. MySQL SELinux policy modules, for example, define
policy rules using
<code class="literal">
type
</code>
information.
</p>
<p>
You can view SELinux contexts using operating system commands such
as
<span class="command">
<strong>
ls
</strong>
</span>
and
<span class="command">
<strong>
ps
</strong>
</span>
with the
<code class="literal">
-Z
</code>
option. Assuming that SELinux is enabled and a
MySQL Server is running, the following commands show the SELinux
context for the
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
process and MySQL data
directory:
</p>
<p>
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
process:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa35109598"><div class="copy-help left">Press ⌘+C to 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">ps</span> <span class="token property">-eZ</span> | grep mysqld
system_u<span class="token punctuation">:</span>system_r<span class="token punctuation">:</span>mysqld_t<span class="token punctuation">:</span>s0 5924 ? 00<span class="token punctuation">:</span>00<span class="token punctuation">:</span>03 mysqld</code></pre>
</div>
<p>
MySQL data directory:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa21607084"><div class="copy-help left">Press ⌘+C to 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">cd</span> /var/lib
<span class="token prompt">$> </span><span class="token command">ls</span> <span class="token property">-Z</span> | grep mysql
system_u<span class="token punctuation">:</span>object_r<span class="token punctuation">:</span>mysqld_db_t<span class="token punctuation">:</span>s0 mysql</code></pre>
</div>
<p>
where:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
system_u
</code>
is an SELinux user identity for
system processes and objects.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
system_r
</code>
is an SELinux role used for system
processes.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
objects_r
</code>
is an SELinux role used for system
objects.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
mysqld_t
</code>
is the type associated with the
mysqld process.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
mysqld_db_t
</code>
is the type associated with the
MySQL data directory and its files.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
s0
</code>
is the security level.
</p>
</li>
</ul>
</div>
<p>
For more information about interpreting SELinux contexts, refer to
your distribution's SELinux documentation.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/innodb-redo-log.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="innodb-redo-log">
</a>
17.6.5 Redo Log
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045164868480">
</a>
<a class="indexterm" name="idm46045164867088">
</a>
<p>
The redo log is a disk-based data structure used during crash
recovery to correct data written by incomplete transactions.
During normal operations, the redo log encodes requests to change
table data that result from SQL statements or low-level API calls.
Modifications that did not finish updating data files before an
unexpected shutdown are replayed automatically during
initialization and before connections are accepted. For
information about the role of the redo log in crash recovery, see
<a class="xref" href="innodb-recovery.html" title="17.18.2 InnoDB Recovery">
Section 17.18.2, “InnoDB Recovery”
</a>
.
</p>
<p>
The redo log is physically represented on disk by redo log files.
Data that is written to redo log files is encoded in terms of
records affected, and this data is collectively referred to as
redo. The passage of data through redo log files is represented by
an ever-increasing
<a class="link" href="glossary.html#glos_lsn" title="LSN">
LSN
</a>
value. Redo
log data is appended as data modifications occur, and the oldest
data is truncated as the checkpoint progresses.
</p>
<p>
Information and procedures related to redo logs are described
under the following topics in the section:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="xref" href="innodb-redo-log.html#innodb-modifying-redo-log-capacity" title="Configuring Redo Log Capacity">
Configuring Redo Log Capacity
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="innodb-redo-log.html#innodb-redo-log-capacity-automatic-configuration" title="Automatic Redo Log Capacity Configuration">
Automatic Redo Log Capacity Configuration
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="innodb-redo-log.html#innodb-redo-log-archiving" title="Redo Log Archiving">
Redo Log Archiving
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="innodb-redo-log.html#innodb-disable-redo-logging" title="Disabling Redo Logging">
Disabling Redo Logging
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="innodb-redo-log.html#innodb-redo-log-related-topics" title="Related Topics">
Related Topics
</a>
</p>
</li>
</ul>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="innodb-modifying-redo-log-capacity">
</a>
Configuring Redo Log Capacity
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045164857728">
</a>
<a class="indexterm" name="idm46045164856336">
</a>
<p>
The
<a class="link" href="innodb-parameters.html#sysvar_innodb_redo_log_capacity">
<code class="literal">
innodb_redo_log_capacity
</code>
</a>
system variable controls the amount of disk space occupied by
redo log files. You can set this variable in an option file at
startup or at runtime using a
<a class="link" href="set-variable.html" title="15.7.6.1 SET Syntax for Variable Assignment">
<code class="literal">
SET
GLOBAL
</code>
</a>
statement; for example, the following statement
sets the redo log capacity to 8GB:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa89019147"><div class="copy-help left">Press ⌘+C to 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> innodb_redo_log_capacity <span class="token operator">=</span> <span class="token number">8589934592</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
When set at runtime, the configuration change occurs immediately
but it may take some time for the new limit to be fully
implemented. If the redo log files occupy less space than the
specified value, dirty pages are flushed from the buffer pool to
tablespace data files less aggressively, eventually increasing
the disk space occupied by the redo log files. If the redo log
files occupy more space than the specified value, dirty pages
are flushed more aggressively, eventually decreasing the disk
space occupied by redo log files.
</p>
<p>
If
<code class="literal">
innodb_redo_log_capacity
</code>
is not defined,
and if neither
<code class="literal">
innodb_log_file_size
</code>
or
<code class="literal">
innodb_log_files_in_group
</code>
are defined, then
the default
<code class="literal">
innodb_redo_log_capacity
</code>
value is
used.
</p>
<p>
If
<code class="literal">
innodb_redo_log_capacity
</code>
is not defined,
and if
<code class="literal">
innodb_log_file_size
</code>
and/or
<code class="literal">
innodb_log_files_in_group
</code>
is defined, then
the InnoDB redo log capacity is calculated as
<span class="emphasis">
<em>
(innodb_log_files_in_group *
innodb_log_file_size)
</em>
</span>
. This calculation does not
modify the unused
<code class="literal">
innodb_redo_log_capacity
</code>
setting's value.
</p>
<p>
The
<a class="link" href="server-status-variables.html#statvar_Innodb_redo_log_capacity_resized">
<code class="literal">
Innodb_redo_log_capacity_resized
</code>
</a>
server status variable indicates the total redo log capacity for
all redo log files.
</p>
<p>
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
<a class="link" href="innodb-parameters.html#sysvar_innodb_log_group_home_dir">
<code class="literal">
innodb_log_group_home_dir
</code>
</a>
was
defined, the redo log files reside in the
<code class="filename">
#innodb_redo
</code>
directory in that directory.
There are two types of redo log files, ordinary and spare.
Ordinary redo log files are those being used. Spare redo log
files are those waiting to be used.
<code class="literal">
InnoDB
</code>
tries to maintain 32 redo log files in total, with each file
equal in size to 1/32 *
<code class="literal">
innodb_redo_log_capacity
</code>
; however, file sizes
may differ for a time after modifying the
<code class="literal">
innodb_redo_log_capacity
</code>
setting.
</p>
<p>
Redo log files use an
<code class="filename">
#ib_redo
<em class="replaceable">
<code>
N
</code>
</em>
</code>
naming
convention, where
<em class="replaceable">
<code>
N
</code>
</em>
is the redo log
file number. Spare redo log files are denoted by a
<code class="filename">
_tmp
</code>
suffix. The following example shows
the redo log files in an
<code class="filename">
#innodb_redo
</code>
directory, where there are 21 active redo log files and 11 spare
redo log files, numbered sequentially.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-simple"><div class="docs-select-all right" id="sa11910901"><div class="copy-help left">Press ⌘+C to 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">'<span class="token comment" spellcheck="true">#ib_redo582' '#ib_redo590' '#ib_redo598' '#ib_redo606_tmp'</span>
'<span class="token comment" spellcheck="true">#ib_redo583' '#ib_redo591' '#ib_redo599' '#ib_redo607_tmp'</span>
'<span class="token comment" spellcheck="true">#ib_redo584' '#ib_redo592' '#ib_redo600' '#ib_redo608_tmp'</span>
'<span class="token comment" spellcheck="true">#ib_redo585' '#ib_redo593' '#ib_redo601' '#ib_redo609_tmp'</span>
'<span class="token comment" spellcheck="true">#ib_redo586' '#ib_redo594' '#ib_redo602' '#ib_redo610_tmp'</span>
'<span class="token comment" spellcheck="true">#ib_redo587' '#ib_redo595' '#ib_redo603_tmp' '#ib_redo611_tmp'</span>
'<span class="token comment" spellcheck="true">#ib_redo588' '#ib_redo596' '#ib_redo604_tmp' '#ib_redo612_tmp'</span>
'<span class="token comment" spellcheck="true">#ib_redo589' '#ib_redo597' '#ib_redo605_tmp' '#ib_redo613_tmp'</span></code></pre>
</div>
<p>
Each ordinary redo log file is associated with a particular
range of LSN values; for example, the following query shows the
<code class="literal">
START_LSN
</code>
and
<code class="literal">
END_LSN
</code>
values for the active redo log files listed in the previous
example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa60101669"><div class="copy-help left">Press ⌘+C to 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> FILE_NAME<span class="token punctuation">,</span> START_LSN<span class="token punctuation">,</span> END_LSN <span class="token keyword">FROM</span> performance_schema<span class="token punctuation">.</span>innodb_redo_log_files<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> FILE_NAME <span class="token punctuation">|</span> START_LSN <span class="token punctuation">|</span> END_LSN <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> ./#innodb_redo/#ib_redo582 <span class="token punctuation">|</span> 117654982144 <span class="token punctuation">|</span> 117658256896 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> ./#innodb_redo/#ib_redo583 <span class="token punctuation">|</span> 117658256896 <span class="token punctuation">|</span> 117661531648 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> ./#innodb_redo/#ib_redo584 <span class="token punctuation">|</span> 117661531648 <span class="token punctuation">|</span> 117664806400 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> ./#innodb_redo/#ib_redo585 <span class="token punctuation">|</span> 117664806400 <span class="token punctuation">|</span> 117668081152 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> ./#innodb_redo/#ib_redo586 <span class="token punctuation">|</span> 117668081152 <span class="token punctuation">|</span> 117671355904 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> ./#innodb_redo/#ib_redo587 <span class="token punctuation">|</span> 117671355904 <span class="token punctuation">|</span> 117674630656 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> ./#innodb_redo/#ib_redo588 <span class="token punctuation">|</span> 117674630656 <span class="token punctuation">|</span> 117677905408 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> ./#innodb_redo/#ib_redo589 <span class="token punctuation">|</span> 117677905408 <span class="token punctuation">|</span> 117681180160 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> ./#innodb_redo/#ib_redo590 <span class="token punctuation">|</span> 117681180160 <span class="token punctuation">|</span> 117684454912 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> ./#innodb_redo/#ib_redo591 <span class="token punctuation">|</span> 117684454912 <span class="token punctuation">|</span> 117687729664 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> ./#innodb_redo/#ib_redo592 <span class="token punctuation">|</span> 117687729664 <span class="token punctuation">|</span> 117691004416 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> ./#innodb_redo/#ib_redo593 <span class="token punctuation">|</span> 117691004416 <span class="token punctuation">|</span> 117694279168 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> ./#innodb_redo/#ib_redo594 <span class="token punctuation">|</span> 117694279168 <span class="token punctuation">|</span> 117697553920 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> ./#innodb_redo/#ib_redo595 <span class="token punctuation">|</span> 117697553920 <span class="token punctuation">|</span> 117700828672 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> ./#innodb_redo/#ib_redo596 <span class="token punctuation">|</span> 117700828672 <span class="token punctuation">|</span> 117704103424 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> ./#innodb_redo/#ib_redo597 <span class="token punctuation">|</span> 117704103424 <span class="token punctuation">|</span> 117707378176 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> ./#innodb_redo/#ib_redo598 <span class="token punctuation">|</span> 117707378176 <span class="token punctuation">|</span> 117710652928 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> ./#innodb_redo/#ib_redo599 <span class="token punctuation">|</span> 117710652928 <span class="token punctuation">|</span> 117713927680 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> ./#innodb_redo/#ib_redo600 <span class="token punctuation">|</span> 117713927680 <span class="token punctuation">|</span> 117717202432 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> ./#innodb_redo/#ib_redo601 <span class="token punctuation">|</span> 117717202432 <span class="token punctuation">|</span> 117720477184 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> ./#innodb_redo/#ib_redo602 <span class="token punctuation">|</span> 117720477184 <span class="token punctuation">|</span> 117723751936 <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></code></pre>
</div>
<p>
When doing a checkpoint,
<code class="literal">
InnoDB
</code>
stores the
checkpoint LSN in the header of the file which contains this
LSN. During recovery, all redo log files are checked and
recovery starts at the latest checkpoint LSN.
</p>
<p>
Several status variables are provided for monitoring the redo
log and redo log capacity resize operations; for example, you
can query
<a class="link" href="server-status-variables.html#statvar_Innodb_redo_log_resize_status">
<code class="literal">
Innodb_redo_log_resize_status
</code>
</a>
to view the status of a resize operation:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa918276"><div class="copy-help left">Press ⌘+C to 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">STATUS</span> <span class="token operator">LIKE</span> <span class="token string">'Innodb_redo_log_resize_status'</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> 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>
<span class="token output"><span class="token punctuation">|</span> Innodb_redo_log_resize_status <span class="token punctuation">|</span> OK <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
<a class="link" href="server-status-variables.html#statvar_Innodb_redo_log_capacity_resized">
<code class="literal">
Innodb_redo_log_capacity_resized
</code>
</a>
status variable shows the current redo log capacity limit:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa30349956"><div class="copy-help left">Press ⌘+C to 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">STATUS</span> <span class="token operator">LIKE</span> <span class="token string">'Innodb_redo_log_capacity_resized'</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>
<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>
<span class="token output"><span class="token punctuation">|</span> Innodb_redo_log_capacity_resized <span class="token punctuation">|</span> 104857600 <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></code></pre>
</div>
<p>
Other applicable status variables include:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="link" href="server-status-variables.html#statvar_Innodb_redo_log_checkpoint_lsn">
<code class="literal">
Innodb_redo_log_checkpoint_lsn
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="server-status-variables.html#statvar_Innodb_redo_log_current_lsn">
<code class="literal">
Innodb_redo_log_current_lsn
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="server-status-variables.html#statvar_Innodb_redo_log_flushed_to_disk_lsn">
<code class="literal">
Innodb_redo_log_flushed_to_disk_lsn
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="server-status-variables.html#statvar_Innodb_redo_log_logical_size">
<code class="literal">
Innodb_redo_log_logical_size
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="server-status-variables.html#statvar_Innodb_redo_log_physical_size">
<code class="literal">
Innodb_redo_log_physical_size
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="server-status-variables.html#statvar_Innodb_redo_log_read_only">
<code class="literal">
Innodb_redo_log_read_only
</code>
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="server-status-variables.html#statvar_Innodb_redo_log_uuid">
<code class="literal">
Innodb_redo_log_uuid
</code>
</a>
</p>
</li>
</ul>
</div>
<p>
Refer to the status variable descriptions for more information.
</p>
<p>
You can view information about active redo log files by querying
the
<a class="link" href="performance-schema-innodb-redo-log-files-table.html" title="29.12.22.4 The innodb_redo_log_files Table">
<code class="literal">
innodb_redo_log_files
</code>
</a>
Performance Schema table. The following query retrieves data
from all of the table's columns:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa90470680"><div class="copy-help left">Press ⌘+C to 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> FILE_ID<span class="token punctuation">,</span> START_LSN<span class="token punctuation">,</span> END_LSN<span class="token punctuation">,</span> SIZE_IN_BYTES<span class="token punctuation">,</span> IS_FULL<span class="token punctuation">,</span> CONSUMER_LEVEL
<span class="token keyword">FROM</span> performance_schema<span class="token punctuation">.</span>innodb_redo_log_files<span class="token punctuation">;</span></code></pre>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="innodb-redo-log-capacity-automatic-configuration">
</a>
Automatic Redo Log Capacity Configuration
</h4>
</div>
</div>
</div>
<p>
When the server is started with
<a class="link" href="innodb-parameters.html#option_mysqld_innodb-dedicated-server">
<code class="option">
--innodb-dedicated-server
</code>
</a>
,
<code class="literal">
InnoDB
</code>
automatically calculates and sets the
values for certain
<code class="literal">
InnoDB
</code>
parameters,
including redo log capacity. Automated configuration is intended
for MySQL instances that reside on a server dedicated to MySQL,
where the MySQL server can use all available system resources.
For more information, see
<a class="xref" href="innodb-dedicated-server.html" title="17.8.12 Enabling Automatic InnoDB Configuration for a Dedicated MySQL Server">
Section 17.8.12, “Enabling Automatic InnoDB Configuration for a Dedicated MySQL Server”
</a>
.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="innodb-redo-log-archiving">
</a>
Redo Log Archiving
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045164797824">
</a>
<p>
Backup utilities that copy redo log records may sometimes fail
to keep pace with redo log generation while a backup operation
is in progress, resulting in lost redo log records due to those
records being overwritten. This issue most often occurs when
there is significant MySQL server activity during the backup
operation, and the redo log file storage media operates at a
faster speed than the backup storage media. The redo log
archiving feature addresses this issue by sequentially writing
redo log records to an archive file in addition to the redo log
files. Backup utilities can copy redo log records from the
archive file as necessary, thereby avoiding the potential loss
of data.
</p>
<p>
If redo log archiving is configured on the server,
<a class="ulink" href="/doc/mysql-enterprise-backup/en/" target="_top">
MySQL Enterprise Backup
</a>
,
available with
<a class="ulink" href="https://www.mysql.com/products/enterprise/" target="_blank">
MySQL Enterprise Edition
</a>
,
uses the redo log archiving feature when backing up a MySQL
server.
</p>
<p>
Enabling redo log archiving on the server requires setting a
value for the
<a class="link" href="innodb-parameters.html#sysvar_innodb_redo_log_archive_dirs">
<code class="literal">
innodb_redo_log_archive_dirs
</code>
</a>
system variable. The value is specified as a semicolon-separated
list of labeled redo log archive directories. The
<code class="literal">
<em class="replaceable">
<code>
label
</code>
</em>
:
<em class="replaceable">
<code>
directory
</code>
</em>
</code>
pair is separated by a colon (
<code class="literal">
:
</code>
). For
example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa43071840"><div class="copy-help left">Press ⌘+C to 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">GLOBAL</span> innodb_redo_log_archive_dirs<span class="token operator">=</span><span class="token string">'<em class="replaceable">label1</em>:<em class="replaceable">directory_path1</em>[;<em class="replaceable">label2</em>:<em class="replaceable">directory_path2</em>;…]'</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
The
<em class="replaceable">
<code>
label
</code>
</em>
is an arbitrary identifier
for the archive directory. It can be any string of characters,
with the exception of colons (:), which are not permitted. An
empty label is also permitted, but the colon (:) is still
required in this case. A
<em class="replaceable">
<code>
directory_path
</code>
</em>
must be specified. The
directory selected for the redo log archive file must exist when
redo log archiving is activated, or an error is returned. The
path can contain colons (':'), but semicolons (;) are not
permitted.
</p>
<p>
The
<a class="link" href="innodb-parameters.html#sysvar_innodb_redo_log_archive_dirs">
<code class="literal">
innodb_redo_log_archive_dirs
</code>
</a>
variable must be configured before redo log archiving can be
activated. The default value is
<code class="literal">
NULL
</code>
, which
does not permit activating redo log archiving.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Notes
</div>
<p>
The archive directories that you specify must satisfy the
following requirements. (The requirements are enforced when
redo log archiving is activated.):
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Directories must exist. Directories are not created by the
redo log archive process. Otherwise, the following error
is returned:
</p>
<p>
<span class="errortext">
ERROR 3844 (HY000): Redo log archive directory
'
<em class="replaceable">
<code>
directory_path1
</code>
</em>
' does not
exist or is not a directory
</span>
</p>
</li>
<li class="listitem">
<p>
Directories must not be world-accessible. This is to
prevent the redo log data from being exposed to
unauthorized users on the system. Otherwise, the following
error is returned:
</p>
<p>
<span class="errortext">
ERROR 3846 (HY000): Redo log archive directory
'
<em class="replaceable">
<code>
directory_path1
</code>
</em>
' is accessible
to all OS users
</span>
</p>
</li>
<li class="listitem">
<p>
Directories cannot be those defined by
<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>
,
<a class="link" href="innodb-parameters.html#sysvar_innodb_directories">
<code class="literal">
innodb_directories
</code>
</a>
,
<a class="link" href="innodb-parameters.html#sysvar_innodb_log_group_home_dir">
<code class="literal">
innodb_log_group_home_dir
</code>
</a>
,
<a class="link" href="innodb-parameters.html#sysvar_innodb_temp_tablespaces_dir">
<code class="literal">
innodb_temp_tablespaces_dir
</code>
</a>
,
<a class="link" href="innodb-parameters.html#sysvar_innodb_tmpdir">
<code class="literal">
innodb_tmpdir
</code>
</a>
<a class="link" href="innodb-parameters.html#sysvar_innodb_undo_directory">
<code class="literal">
innodb_undo_directory
</code>
</a>
, or
<a class="link" href="server-system-variables.html#sysvar_secure_file_priv">
<code class="literal">
secure_file_priv
</code>
</a>
, nor can
they be parent directories or subdirectories of those
directories. Otherwise, an error similar to the following
is returned:
</p>
<p>
<span class="errortext">
ERROR 3845 (HY000): Redo log archive directory
'
<em class="replaceable">
<code>
directory_path1
</code>
</em>
' is in, under,
or over server directory 'datadir' -
'
<em class="replaceable">
<code>
/path/to/data_directory
</code>
</em>
'
</span>
</p>
</li>
</ul>
</div>
</div>
<p>
When a backup utility that supports redo log archiving initiates
a backup, the backup utility activates redo log archiving by
invoking the
<code class="literal">
innodb_redo_log_archive_start()
</code>
function.
</p>
<p>
If you are not using a backup utility that supports redo log
archiving, redo log archiving can also be activated manually, as
shown:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa65331819"><div class="copy-help left">Press ⌘+C to 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> innodb_redo_log_archive_start<span class="token punctuation">(</span><span class="token string">'<em class="replaceable">label</em>'</span><span class="token punctuation">,</span> <span class="token string">'<em class="replaceable">subdir</em>'</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>
<span class="token output"><span class="token punctuation">|</span> innodb_redo_log_archive_start('<em class="replaceable">label</em>') <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>
<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><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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>
Or:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa88164451"><div class="copy-help left">Press ⌘+C to 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">DO</span> innodb_redo_log_archive_start<span class="token punctuation">(</span><span class="token string">'<em class="replaceable">label</em>'</span><span class="token punctuation">,</span> <span class="token string">'<em class="replaceable">subdir</em>'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 0 rows affected (0.09 sec)</span></code></pre>
</div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
The MySQL session that activates redo log archiving (using
<code class="literal">
innodb_redo_log_archive_start()
</code>
) must
remain open for the duration of the archiving. The same
session must deactivate redo log archiving (using
<code class="literal">
innodb_redo_log_archive_stop()
</code>
). If the
session is terminated before the redo log archiving is
explicitly deactivated, the server deactivates redo log
archiving implicitly and removes the redo log archive file.
</p>
</div>
<p>
where
<em class="replaceable">
<code>
label
</code>
</em>
is a label defined by
<a class="link" href="innodb-parameters.html#sysvar_innodb_redo_log_archive_dirs">
<code class="literal">
innodb_redo_log_archive_dirs
</code>
</a>
;
<code class="literal">
subdir
</code>
is an optional argument for specifying
a subdirectory of the directory identified by
<em class="replaceable">
<code>
label
</code>
</em>
for saving the archive file; it
must be a simple directory name (no slash (/), backslash (\), or
colon (:) is permitted).
<code class="literal">
subdir
</code>
can be empty,
null, or it can be left out.
</p>
<p>
Only users with the
<a class="link" href="privileges-provided.html#priv_innodb-redo-log-archive">
<code class="literal">
INNODB_REDO_LOG_ARCHIVE
</code>
</a>
privilege
can activate redo log archiving by invoking
<code class="literal">
innodb_redo_log_archive_start()
</code>
, or
deactivate it using
<code class="literal">
innodb_redo_log_archive_stop()
</code>
. The MySQL
user running the backup utility or the MySQL user activating and
deactivating redo log archiving manually must have this
privilege.
</p>
<p>
The redo log archive file path is
<code class="filename">
<em class="replaceable">
<code>
directory_identified_by_label
</code>
</em>
/[
<em class="replaceable">
<code>
subdir
</code>
</em>
/]archive.
<em class="replaceable">
<code>
serverUUID
</code>
</em>
.000001.log
</code>
,
where
<code class="filename">
<em class="replaceable">
<code>
directory_identified_by_label
</code>
</em>
</code>
is the archive directory identified by the
<code class="literal">
<em class="replaceable">
<code>
label
</code>
</em>
</code>
argument for
<code class="literal">
innodb_redo_log_archive_start()
</code>
.
<code class="filename">
<em class="replaceable">
<code>
subdir
</code>
</em>
</code>
is the
optional argument used for
<code class="literal">
innodb_redo_log_archive_start()
</code>
.
</p>
<p>
For example, the full path and name for a redo log archive file
appears similar to the following:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa27049542"><div class="copy-help left">Press ⌘+C to 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">/<em class="replaceable">directory_path</em>/<em class="replaceable">subdirectory</em>/archive<span class="token punctuation">.</span>e71a47dc-61f8-11e9-a3cb-080027154b4d<span class="token punctuation">.</span>000001<span class="token punctuation">.</span>log</code></pre>
</div>
<p>
After the backup utility finishes copying
<code class="literal">
InnoDB
</code>
data files, it deactivates redo log
archiving by calling the
<code class="literal">
innodb_redo_log_archive_stop()
</code>
function.
</p>
<p>
If you are not using a backup utility that supports redo log
archiving, redo log archiving can also be deactivated manually,
as shown:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa62752200"><div class="copy-help left">Press ⌘+C to 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> innodb_redo_log_archive_stop<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>
<span class="token output"><span class="token punctuation">|</span> innodb_redo_log_archive_stop() <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>
<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><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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>
Or:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa92711235"><div class="copy-help left">Press ⌘+C to 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">DO</span> innodb_redo_log_archive_stop<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.01 sec)</span></code></pre>
</div>
<p>
After the stop function completes successfully, the backup
utility looks for the relevant section of redo log data from the
archive file and copies it into the backup.
</p>
<p>
After the backup utility finishes copying the redo log data and
no longer needs the redo log archive file, it deletes the
archive file.
</p>
<p>
Removal of the archive file is the responsibility of the backup
utility in normal situations. However, if the redo log archiving
operation quits unexpectedly before
<code class="literal">
innodb_redo_log_archive_stop()
</code>
is called, the
MySQL server removes the file.
</p>
<h5>
<a name="idm46045164734160">
</a>
Performance Considerations
</h5>
<p>
Activating redo log archiving typically has a minor performance
cost due to the additional write activity.
</p>
<p>
On Unix and Unix-like operating systems, the performance impact
is typically minor, assuming there is not a sustained high rate
of updates. On Windows, the performance impact is typically a
bit higher, assuming the same.
</p>
<p>
If there is a sustained high rate of updates and the redo log
archive file is on the same storage media as the redo log files,
the performance impact may be more significant due to compounded
write activity.
</p>
<p>
If there is a sustained high rate of updates and the redo log
archive file is on slower storage media than the redo log files,
performance is impacted arbitrarily.
</p>
<p>
Writing to the redo log archive file does not impede normal
transactional logging except in the case that the redo log
archive file storage media operates at a much slower rate than
the redo log file storage media, and there is a large backlog of
persisted redo log blocks waiting to be written to the redo log
archive file. In this case, the transactional logging rate is
reduced to a level that can be managed by the slower storage
media where the redo log archive file resides.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="innodb-disable-redo-logging">
</a>
Disabling Redo Logging
</h4>
</div>
</div>
</div>
<p>
You can disable redo logging using the
<a class="link" href="alter-instance.html" title="15.1.5 ALTER INSTANCE Statement">
<code class="literal">
ALTER INSTANCE
DISABLE INNODB REDO_LOG
</code>
</a>
statement. This functionality
is intended for loading data into a new MySQL instance.
Disabling redo logging speeds up data loading by avoiding redo
log writes and doublewrite buffering.
</p>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Warning
</div>
<p>
This feature is intended only for loading data into a new
MySQL instance.
<span class="emphasis">
<em>
Do not disable redo logging on a
production system.
</em>
</span>
It is permitted to shutdown and
restart the server while redo logging is disabled, but an
unexpected server stoppage while redo logging is disabled can
cause data loss and instance corruption.
</p>
<p>
Attempting to restart the server after an unexpected server
stoppage while redo logging is disabled is refused with the
following error:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa93178817"><div class="copy-help left">Press ⌘+C to 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 property"><span class="token punctuation">[</span>ERROR<span class="token punctuation">]</span></span> <span class="token punctuation">[</span>MY-013598<span class="token punctuation">]</span> <span class="token punctuation">[</span>InnoDB<span class="token punctuation">]</span> Server was killed when Innodb Redo
logging was disabled<span class="token punctuation">.</span> Data files could be corrupt<span class="token punctuation">.</span> You can try
to restart the database with innodb_force_recovery<span class="token attr-value"><span class="token punctuation">=</span>6</span></code></pre>
</div>
<p>
In this case, initialize a new MySQL instance and start the
data loading procedure again.
</p>
</div>
<p>
The
<a class="link" href="privileges-provided.html#priv_innodb-redo-log-enable">
<code class="literal">
INNODB_REDO_LOG_ENABLE
</code>
</a>
privilege is required to enable and disable redo logging.
</p>
<p>
The
<a class="link" href="server-status-variables.html#statvar_Innodb_redo_log_enabled">
<code class="literal">
Innodb_redo_log_enabled
</code>
</a>
status variable permits monitoring redo logging status.
</p>
<p>
Cloning operations and redo log archiving are not permitted
while redo logging is disabled and vice versa.
</p>
<p>
An
<a class="link" href="alter-instance.html" title="15.1.5 ALTER INSTANCE Statement">
<code class="literal">
ALTER
INSTANCE [ENABLE|DISABLE] INNODB REDO_LOG
</code>
</a>
operation
requires an exclusive backup metadata lock, which prevents other
<a class="link" href="alter-instance.html" title="15.1.5 ALTER INSTANCE Statement">
<code class="literal">
ALTER INSTANCE
</code>
</a>
operations from
executing concurrently. Other
<a class="link" href="alter-instance.html" title="15.1.5 ALTER INSTANCE Statement">
<code class="literal">
ALTER
INSTANCE
</code>
</a>
operations must wait for the lock to be
released before executing.
</p>
<p>
The following procedure demonstrates how to disable redo logging
when loading data into a new MySQL instance.
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
On the new MySQL instance, grant the
<a class="link" href="privileges-provided.html#priv_innodb-redo-log-enable">
<code class="literal">
INNODB_REDO_LOG_ENABLE
</code>
</a>
privilege to the user account responsible for disabling redo
logging.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa20906141"><div class="copy-help left">Press ⌘+C to 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">GRANT</span> INNODB_REDO_LOG_ENABLE <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> <span class="token string">'data_load_admin'</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
As the
<code class="literal">
data_load_admin
</code>
user, disable redo
logging:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa86241723"><div class="copy-help left">Press ⌘+C to 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">INSTANCE</span> <span class="token keyword">DISABLE</span> INNODB REDO_LOG<span class="token punctuation">;</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
Check the
<a class="link" href="server-status-variables.html#statvar_Innodb_redo_log_enabled">
<code class="literal">
Innodb_redo_log_enabled
</code>
</a>
status variable to ensure that redo logging is disabled.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa6442225"><div class="copy-help left">Press ⌘+C to 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">'Innodb_redo_log_enabled'</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> 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>
<span class="token output"><span class="token punctuation">|</span> Innodb_redo_log_enabled <span class="token punctuation">|</span> OFF <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>
</li>
<li class="listitem">
<p>
Run the data load operation.
</p>
</li>
<li class="listitem">
<p>
As the
<code class="literal">
data_load_admin
</code>
user, enable redo
logging after the data load operation finishes:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa76572622"><div class="copy-help left">Press ⌘+C to 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">INSTANCE</span> <span class="token keyword">ENABLE</span> INNODB REDO_LOG<span class="token punctuation">;</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
Check the
<a class="link" href="server-status-variables.html#statvar_Innodb_redo_log_enabled">
<code class="literal">
Innodb_redo_log_enabled
</code>
</a>
status variable to ensure that redo logging is enabled.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa65695399"><div class="copy-help left">Press ⌘+C to 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">'Innodb_redo_log_enabled'</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> 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>
<span class="token output"><span class="token punctuation">|</span> Innodb_redo_log_enabled <span class="token punctuation">|</span> ON <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>
</li>
</ol>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h4 class="title">
<a name="innodb-redo-log-related-topics">
</a>
Related Topics
</h4>
</div>
</div>
</div>
<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-log-file-configuration" title="Redo Log Configuration">
Redo Log Configuration
</a>
</p>
</li>
<li class="listitem">
<p>
<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>
<li class="listitem">
<p>
<a class="xref" href="innodb-data-encryption.html#innodb-data-encryption-redo-log" title="Redo Log Encryption">
Redo Log Encryption
</a>
</p>
</li>
</ul>
</div>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/data-dictionary-usage-differences.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title">
<a name="data-dictionary-usage-differences">
</a>
16.7 Data Dictionary Usage Differences
</h2>
</div>
</div>
</div>
<a class="indexterm" name="idm46045167581712">
</a>
<p>
Use of a data dictionary-enabled MySQL server entails some
operational differences compared to a server that does not have a
data dictionary:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Previously, enabling the
<a class="link" href="innodb-parameters.html#sysvar_innodb_read_only">
<code class="literal">
innodb_read_only
</code>
</a>
system
variable prevented creating and dropping tables only for the
<code class="literal">
InnoDB
</code>
storage engine. As of MySQL
8.4, enabling
<a class="link" href="innodb-parameters.html#sysvar_innodb_read_only">
<code class="literal">
innodb_read_only
</code>
</a>
prevents
these operations for all storage engines. Table creation and
drop operations for any storage engine modify data dictionary
tables in the
<code class="literal">
mysql
</code>
system database, but
those tables use the
<code class="literal">
InnoDB
</code>
storage engine
and cannot be modified when
<a class="link" href="innodb-parameters.html#sysvar_innodb_read_only">
<code class="literal">
innodb_read_only
</code>
</a>
is enabled.
The same principle applies to other table operations that
require modifying data dictionary tables. Examples:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<a class="link" href="analyze-table.html" title="15.7.3.1 ANALYZE TABLE Statement">
<code class="literal">
ANALYZE TABLE
</code>
</a>
fails because
it updates table statistics, which are stored in the data
dictionary.
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER TABLE
<em class="replaceable">
<code>
tbl_name
</code>
</em>
ENGINE=
<em class="replaceable">
<code>
engine_name
</code>
</em>
</code>
</a>
fails because it updates the storage engine designation,
which is stored in the data dictionary.
</p>
</li>
</ul>
</div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
Enabling
<a class="link" href="innodb-parameters.html#sysvar_innodb_read_only">
<code class="literal">
innodb_read_only
</code>
</a>
also has important implications for non-data dictionary
tables in the
<code class="literal">
mysql
</code>
system database. For
details, see the description of
<a class="link" href="innodb-parameters.html#sysvar_innodb_read_only">
<code class="literal">
innodb_read_only
</code>
</a>
in
<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>
</p>
</div>
</li>
<li class="listitem">
<p>
Previously, tables in the
<code class="literal">
mysql
</code>
system
database were visible to DML and DDL statements. As of MySQL
8.4, data dictionary tables are invisible and
cannot be modified or queried directly. However, in most cases
there are corresponding
<code class="literal">
INFORMATION_SCHEMA
</code>
tables that can be queried instead. This enables the
underlying data dictionary tables to be changed as server
development proceeds, while maintaining a stable
<code class="literal">
INFORMATION_SCHEMA
</code>
interface for
application use.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
INFORMATION_SCHEMA
</code>
tables in MySQL
8.4 are closely tied to the data dictionary,
resulting in several usage differences:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
Previously,
<code class="literal">
INFORMATION_SCHEMA
</code>
queries
for table statistics in the
<a class="link" href="information-schema-statistics-table.html" title="28.3.34 The INFORMATION_SCHEMA STATISTICS Table">
<code class="literal">
STATISTICS
</code>
</a>
and
<a class="link" href="information-schema-tables-table.html" title="28.3.38 The INFORMATION_SCHEMA TABLES Table">
<code class="literal">
TABLES
</code>
</a>
tables retrieved
statistics directly from storage engines. As of MySQL
8.4, cached table statistics are used by
default. The
<a class="link" href="server-system-variables.html#sysvar_information_schema_stats_expiry">
<code class="literal">
information_schema_stats_expiry
</code>
</a>
system variable defines the period of time before cached
table statistics expire. The default is 86400 seconds (24
hours). (To update the cached values at any time for a
given table, use
<a class="link" href="analyze-table.html" title="15.7.3.1 ANALYZE TABLE Statement">
<code class="literal">
ANALYZE
TABLE
</code>
</a>
.) If there are no cached statistics or
statistics have expired, statistics are retrieved from
storage engines when querying table statistics columns. To
always retrieve the latest statistics directly from
storage engines, set
<a class="link" href="server-system-variables.html#sysvar_information_schema_stats_expiry">
<code class="literal">
information_schema_stats_expiry
</code>
</a>
to
<code class="literal">
0
</code>
. For more information, see
<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>
.
</p>
</li>
<li class="listitem">
<p>
Several
<code class="literal">
INFORMATION_SCHEMA
</code>
tables are
views on data dictionary tables, which enables the
optimizer to use indexes on those underlying tables.
Consequently, depending on optimizer choices, the row
order of results for
<code class="literal">
INFORMATION_SCHEMA
</code>
queries might differ from previous results. If a query
result must have specific row ordering characteristics,
include an
<code class="literal">
ORDER BY
</code>
clause.
</p>
</li>
<li class="listitem">
<p>
Queries on
<code class="literal">
INFORMATION_SCHEMA
</code>
tables
may return column names in a different lettercase than in
earlier MySQL series. Applications should test result set
column names in case-insensitive fashion. If that is not
feasible, a workaround is to use column aliases in the
select list that return column names in the required
lettercase. For example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa56554258"><div class="copy-help left">Press ⌘+C to 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> TABLE_SCHEMA <span class="token keyword">AS</span> table_schema<span class="token punctuation">,</span> <span class="token keyword">TABLE_NAME</span> <span class="token keyword">AS</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">TABLES</span> <span class="token keyword">WHERE</span> <span class="token keyword">TABLE_NAME</span> <span class="token operator">=</span> <span class="token string">'users'</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
<a class="link" href="mysqldump.html" title="6.5.4 mysqldump — A Database Backup Program">
<span class="command">
<strong>
mysqldump
</strong>
</span>
</a>
no longer dumps the
<code class="literal">
INFORMATION_SCHEMA
</code>
database, even if
explicitly named on the command line.
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="create-table-like.html" title="15.1.20.3 CREATE TABLE ... LIKE Statement">
<code class="literal">
CREATE
TABLE
<em class="replaceable">
<code>
dst_tbl
</code>
</em>
LIKE
<em class="replaceable">
<code>
src_tbl
</code>
</em>
</code>
</a>
requires that
<em class="replaceable">
<code>
src_tbl
</code>
</em>
be a base table and
fails if it is an
<code class="literal">
INFORMATION_SCHEMA
</code>
table that is a view on data dictionary tables.
</p>
</li>
<li class="listitem">
<p>
Previously, result set headers of columns selected from
<code class="literal">
INFORMATION_SCHEMA
</code>
tables used the
capitalization specified in the query. This query produces
a result set with a header of
<code class="literal">
table_name
</code>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa12679201"><div class="copy-help left">Press ⌘+C to 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">table_name</span> <span class="token keyword">FROM</span> INFORMATION_SCHEMA<span class="token punctuation">.</span><span class="token keyword">TABLES</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
As of MySQL 8.4, these headers are
capitalized; the preceding query produces a result set
with a header of
<code class="literal">
TABLE_NAME
</code>
. If
necessary, a column alias can be used to achieve a
different lettercase. For example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa95232025"><div class="copy-help left">Press ⌘+C to 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">table_name</span> <span class="token keyword">AS</span> <span class="token string">'table_name'</span> <span class="token keyword">FROM</span> INFORMATION_SCHEMA<span class="token punctuation">.</span><span class="token keyword">TABLES</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
The data directory affects how
<a class="link" href="mysqldump.html" title="6.5.4 mysqldump — A Database Backup Program">
<span class="command">
<strong>
mysqldump
</strong>
</span>
</a>
dumps information from the
<code class="literal">
mysql
</code>
system
database:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<a class="link" href="mysqldump.html" title="6.5.4 mysqldump — A Database Backup Program">
<span class="command">
<strong>
mysqldump
</strong>
</span>
</a>
only dumps non-data
dictionary tables in that database, when previously it was
possible to dump all tables in the
<code class="literal">
mysql
</code>
system database.
</p>
</li>
<li class="listitem">
<p>
Previously, the
<a class="link" href="mysqldump.html#option_mysqldump_routines">
<code class="option">
--routines
</code>
</a>
and
<a class="link" href="mysqldump.html#option_mysqldump_events">
<code class="option">
--events
</code>
</a>
options were
not required to include stored routines and events when
using the
<a class="link" href="mysqldump.html#option_mysqldump_all-databases">
<code class="option">
--all-databases
</code>
</a>
option:
The dump included the
<code class="literal">
mysql
</code>
system
database, and therefore also the
<code class="literal">
proc
</code>
and
<code class="literal">
event
</code>
tables containing stored
routine and event definitions. As of MySQL
8.4, the
<code class="literal">
event
</code>
and
<code class="literal">
proc
</code>
tables are not used. Definitions
for the corresponding objects are stored in data
dictionary tables, but those tables are not dumped. To
include stored routines and events in a dump made using
<a class="link" href="mysqldump.html#option_mysqldump_all-databases">
<code class="option">
--all-databases
</code>
</a>
, use the
<a class="link" href="mysqldump.html#option_mysqldump_routines">
<code class="option">
--routines
</code>
</a>
and
<a class="link" href="mysqldump.html#option_mysqldump_events">
<code class="option">
--events
</code>
</a>
options
explicitly.
</p>
</li>
<li class="listitem">
<p>
Previously, the
<a class="link" href="mysqldump.html#option_mysqldump_routines">
<code class="option">
--routines
</code>
</a>
option
required the
<a class="link" href="privileges-provided.html#priv_select">
<code class="literal">
SELECT
</code>
</a>
privilege for the
<code class="literal">
proc
</code>
table. As of
MySQL 8.4, that table is not used;
<a class="link" href="mysqldump.html#option_mysqldump_routines">
<code class="option">
--routines
</code>
</a>
requires the
global
<a class="link" href="privileges-provided.html#priv_select">
<code class="literal">
SELECT
</code>
</a>
privilege
instead.
</p>
</li>
<li class="listitem">
<p>
Previously, it was possible to dump stored routine and
event definitions together with their creation and
modification timestamps, by dumping the
<code class="literal">
proc
</code>
and
<code class="literal">
event
</code>
tables. As of MySQL 8.4, those tables are not
used, so it is not possible to dump timestamps.
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
Previously, creating a stored routine that contains illegal
characters produced a warning. As of MySQL 8.4,
this is an error.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/performance-schema-replication-asynchronous-connection-failover-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-table">
</a>
29.12.11.8 The replication_asynchronous_connection_failover Table
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045071216944">
</a>
<a class="indexterm" name="idm46045071215424">
</a>
<p>
This table holds the replica's source lists for each
replication channel for the asynchronous connection failover
mechanism. The asynchronous connection failover mechanism
automatically establishes an asynchronous (source to replica)
replication connection to a new source from the appropriate
list after the existing connection from the replica to its
source fails. 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>
You set and manage source lists using the
<a class="link" href="replication-functions-async-failover.html#function_asynchronous-connection-failover-add-source">
<code class="literal">
asynchronous_connection_failover_add_source
</code>
</a>
and
<a class="link" href="replication-functions-async-failover.html#function_asynchronous-connection-failover-delete-source">
<code class="literal">
asynchronous_connection_failover_delete_source
</code>
</a>
functions to add and remove replication source servers from
the source list for a replication channel. To add and remove
managed groups of servers, use the
<a class="link" href="replication-functions-async-failover.html#function_asynchronous-connection-failover-add-managed">
<code class="literal">
asynchronous_connection_failover_add_managed
</code>
</a>
and
<a class="link" href="replication-functions-async-failover.html#function_asynchronous-connection-failover-delete-managed">
<code class="literal">
asynchronous_connection_failover_delete_managed
</code>
</a>
functions instead.
</p>
<p>
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-table.html" title="29.12.11.8 The replication_asynchronous_connection_failover Table">
<code class="literal">
replication_asynchronous_connection_failover
</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 for which this replication source
server is part of the source list. If this channel's
connection to its current source fails, this replication
source server is one of its potential new sources.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
HOST
</code>
</p>
<p>
The host name for this replication source server.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
PORT
</code>
</p>
<p>
The port number for this replication source server.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
NETWORK_NAMESPACE
</code>
</p>
<p>
The network namespace for this replication source server.
If this value is empty, connections use the default
(global) namespace.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
WEIGHT
</code>
</p>
<p>
The priority of this replication source server in the
replication channel's source list. The weight is from
1 to 100, with 100 being the highest, and 50 being the
default. When the asynchronous connection failover
mechanism activates, the source with the highest weight
setting among the alternative sources listed in the source
list for the channel is chosen for the first connection
attempt. If this attempt does not work, the replica tries
with all the listed sources in descending order of weight,
then starts again from the highest weighted source. If
multiple sources have the same weight, the replica orders
them randomly.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
MANAGED_NAME
</code>
</p>
<p>
The identifier for the managed group that the server is a
part of. 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>
</ul>
</div>
<p>
The
<a class="link" href="performance-schema-replication-asynchronous-connection-failover-table.html" title="29.12.11.8 The replication_asynchronous_connection_failover Table">
<code class="literal">
replication_asynchronous_connection_failover
</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, HOST, PORT,
NETWORK_NAMESPACE, 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-table.html" title="29.12.11.8 The replication_asynchronous_connection_failover Table">
<code class="literal">
replication_asynchronous_connection_failover
</code>
</a>
table.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/innodb-row-format.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title">
<a name="innodb-row-format">
</a>
17.10 InnoDB Row Formats
</h2>
</div>
</div>
</div>
<p>
The row format of a table determines how its rows are physically
stored, which in turn can affect the performance of queries and DML
operations. As more rows fit into a single disk page, queries and
index lookups can work faster, less cache memory is required in the
buffer pool, and less I/O is required to write out updated values.
</p>
<p>
The data in each table is divided into pages. The pages that make up
each table are arranged in a tree data structure called a B-tree
index. Table data and secondary indexes both use this type of
structure. The B-tree index that represents an entire table is known
as the clustered index, which is organized according to the primary
key columns. The nodes of a clustered index data structure contain
the values of all columns in the row. The nodes of a secondary index
structure contain the values of index columns and primary key
columns.
</p>
<p>
Variable-length columns are an exception to the rule that column
values are stored in B-tree index nodes. Variable-length columns
that are too long to fit on a B-tree page are stored on separately
allocated disk pages called overflow pages. Such columns are
referred to as off-page columns. The values of off-page columns are
stored in singly-linked lists of overflow pages, with each such
column having its own list of one or more overflow pages. Depending
on column length, all or a prefix of variable-length column values
are stored in the B-tree to avoid wasting storage and having to read
a separate page.
</p>
<p>
The
<code class="literal">
InnoDB
</code>
storage engine supports four row
formats:
<code class="literal">
REDUNDANT
</code>
,
<code class="literal">
COMPACT
</code>
,
<code class="literal">
DYNAMIC
</code>
, and
<code class="literal">
COMPRESSED
</code>
.
</p>
<div class="table">
<a name="innodb-row-format-overview">
</a>
<p class="title">
<b>
Table 17.14 InnoDB Row Format Overview
</b>
</p>
<div class="table-contents">
<table summary="Overview of InnoDB row formats incuding a description, supported features, and supported tablespace types.">
<colgroup>
<col style="width: 10%"/>
<col style="width: 18%"/>
<col style="width: 18%"/>
<col style="width: 18%"/>
<col style="width: 18%"/>
<col style="width: 18%"/>
</colgroup>
<thead>
<tr>
<th scope="col">
Row Format
</th>
<th scope="col">
Compact Storage Characteristics
</th>
<th scope="col">
Enhanced Variable-Length Column Storage
</th>
<th scope="col">
Large Index Key Prefix Support
</th>
<th scope="col">
Compression Support
</th>
<th scope="col">
Supported Tablespace Types
</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">
<code class="literal">
REDUNDANT
</code>
</th>
<td>
No
</td>
<td>
No
</td>
<td>
No
</td>
<td>
No
</td>
<td>
system, file-per-table, general
</td>
</tr>
<tr>
<th scope="row">
<code class="literal">
COMPACT
</code>
</th>
<td>
Yes
</td>
<td>
No
</td>
<td>
No
</td>
<td>
No
</td>
<td>
system, file-per-table, general
</td>
</tr>
<tr>
<th scope="row">
<code class="literal">
DYNAMIC
</code>
</th>
<td>
Yes
</td>
<td>
Yes
</td>
<td>
Yes
</td>
<td>
No
</td>
<td>
system, file-per-table, general
</td>
</tr>
<tr>
<th scope="row">
<code class="literal">
COMPRESSED
</code>
</th>
<td>
Yes
</td>
<td>
Yes
</td>
<td>
Yes
</td>
<td>
Yes
</td>
<td>
file-per-table, general
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br class="table-break"/>
<p>
The topics that follow describe row format storage characteristics
and how to define and determine the row format of a table.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="xref" href="innodb-row-format.html#innodb-row-format-redundant" title="REDUNDANT Row Format">
REDUNDANT Row Format
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="innodb-row-format.html#innodb-row-format-compact" title="COMPACT Row Format">
COMPACT Row Format
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="innodb-row-format.html#innodb-row-format-dynamic" title="DYNAMIC Row Format">
DYNAMIC Row Format
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="innodb-row-format.html#innodb-row-format-compressed" title="COMPRESSED Row Format">
COMPRESSED Row Format
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="innodb-row-format.html#innodb-row-format-defining" title="Defining the Row Format of a Table">
Defining the Row Format of a Table
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="innodb-row-format.html#innodb-row-format-detrmining" title="Determining the Row Format of a Table">
Determining the Row Format of a Table
</a>
</p>
</li>
</ul>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h3 class="title">
<a name="innodb-row-format-redundant">
</a>
REDUNDANT Row Format
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045160971984">
</a>
<a class="indexterm" name="idm46045160970496">
</a>
<p>
The
<code class="literal">
REDUNDANT
</code>
format provides compatibility
with older versions of MySQL.
</p>
<p>
Tables that use the
<code class="literal">
REDUNDANT
</code>
row format store
the first 768 bytes of variable-length column values
(
<a class="link" href="char.html" title="13.3.2 The CHAR and VARCHAR Types">
<code class="literal">
VARCHAR
</code>
</a>
,
<a class="link" href="binary-varbinary.html" title="13.3.3 The BINARY and VARBINARY Types">
<code class="literal">
VARBINARY
</code>
</a>
, and
<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>
types) in the index record
within the B-tree node, with the remainder stored on overflow
pages. Fixed-length columns greater than or equal to 768 bytes are
encoded as variable-length columns, which can be stored off-page.
For example, a
<code class="literal">
CHAR(255)
</code>
column can exceed 768
bytes if the maximum byte length of the character set is greater
than 3, as it is with
<code class="literal">
utf8mb4
</code>
.
</p>
<p>
If the value of a column is 768 bytes or less, an overflow page is
not used, and some savings in I/O may result, since the value is
stored entirely in the B-tree node. This works well for relatively
short
<code class="literal">
BLOB
</code>
column values, but may cause B-tree
nodes to fill with data rather than key values, reducing their
efficiency. Tables with many
<code class="literal">
BLOB
</code>
columns could
cause B-tree nodes to become too full, and contain too few rows,
making the entire index less efficient than if rows were shorter
or column values were stored off-page.
</p>
<h4>
<a name="innodb-redundant-row-format-characteristics">
</a>
REDUNDANT Row Format Storage Characteristics
</h4>
<a class="indexterm" name="idm46045160956736">
</a>
<p>
The
<code class="literal">
REDUNDANT
</code>
row format has the following
storage characteristics:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Each index record contains a 6-byte header. The header is used
to link together consecutive records, and for row-level
locking.
</p>
</li>
<li class="listitem">
<p>
Records in the clustered index contain fields for all
user-defined columns. In addition, there is a 6-byte
transaction ID field and a 7-byte roll pointer field.
</p>
</li>
<li class="listitem">
<p>
If no primary key is defined for a table, each clustered index
record also contains a 6-byte row ID field.
</p>
</li>
<li class="listitem">
<p>
Each secondary index record contains all the primary key
columns defined for the clustered index key that are not in
the secondary index.
</p>
</li>
<li class="listitem">
<p>
A record contains a pointer to each field of the record. If
the total length of the fields in a record is less than 128
bytes, the pointer is one byte; otherwise, two bytes. The
array of pointers is called the record directory. The area
where the pointers point is the data part of the record.
</p>
</li>
<li class="listitem">
<p>
Internally, fixed-length character columns such as
<a class="link" href="char.html" title="13.3.2 The CHAR and VARCHAR Types">
<code class="literal">
CHAR(10)
</code>
</a>
in stored in
fixed-length format. Trailing spaces are not truncated from
<a class="link" href="char.html" title="13.3.2 The CHAR and VARCHAR Types">
<code class="literal">
VARCHAR
</code>
</a>
columns.
</p>
</li>
<li class="listitem">
<p>
Fixed-length columns greater than or equal to 768 bytes are
encoded as variable-length columns, which can be stored
off-page. For example, a
<code class="literal">
CHAR(255)
</code>
column
can exceed 768 bytes if the maximum byte length of the
character set is greater than 3, as it is with
<code class="literal">
utf8mb4
</code>
.
</p>
</li>
<li class="listitem">
<p>
An SQL
<code class="literal">
NULL
</code>
value reserves one or two bytes
in the record directory. An SQL
<code class="literal">
NULL
</code>
value
reserves zero bytes in the data part of the record if stored
in a variable-length column. For a fixed-length column, the
fixed length of the column is reserved in the data part of the
record. Reserving fixed space for
<code class="literal">
NULL
</code>
values permits columns to be updated in place from
<code class="literal">
NULL
</code>
to non-
<code class="literal">
NULL
</code>
values
without causing index page fragmentation.
</p>
</li>
</ul>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h3 class="title">
<a name="innodb-row-format-compact">
</a>
COMPACT Row Format
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045160936640">
</a>
<a class="indexterm" name="idm46045160935152">
</a>
<p>
The
<code class="literal">
COMPACT
</code>
row format reduces row storage
space by about 20% compared to the
<code class="literal">
REDUNDANT
</code>
row format, at the cost of increasing CPU use for some operations.
If your workload is a typical one that is limited by cache hit
rates and disk speed,
<code class="literal">
COMPACT
</code>
format is likely
to be faster. If the workload is limited by CPU speed, compact
format might be slower.
</p>
<p>
Tables that use the
<code class="literal">
COMPACT
</code>
row format store
the first 768 bytes of variable-length column values
(
<a class="link" href="char.html" title="13.3.2 The CHAR and VARCHAR Types">
<code class="literal">
VARCHAR
</code>
</a>
,
<a class="link" href="binary-varbinary.html" title="13.3.3 The BINARY and VARBINARY Types">
<code class="literal">
VARBINARY
</code>
</a>
, and
<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>
types) in the index record
within the
<a class="link" href="glossary.html#glos_b_tree" title="B-tree">
B-tree
</a>
node, with
the remainder stored on overflow pages. Fixed-length columns
greater than or equal to 768 bytes are encoded as variable-length
columns, which can be stored off-page. For example, a
<code class="literal">
CHAR(255)
</code>
column can exceed 768 bytes if the
maximum byte length of the character set is greater than 3, as it
is with
<code class="literal">
utf8mb4
</code>
.
</p>
<p>
If the value of a column is 768 bytes or less, an overflow page is
not used, and some savings in I/O may result, since the value is
stored entirely in the B-tree node. This works well for relatively
short
<code class="literal">
BLOB
</code>
column values, but may cause B-tree
nodes to fill with data rather than key values, reducing their
efficiency. Tables with many
<code class="literal">
BLOB
</code>
columns could
cause B-tree nodes to become too full, and contain too few rows,
making the entire index less efficient than if rows were shorter
or column values were stored off-page.
</p>
<h4>
<a name="innodb-compact-row-format-characteristics">
</a>
COMPACT Row Format Storage Characteristics
</h4>
<a class="indexterm" name="idm46045160918816">
</a>
<p>
The
<code class="literal">
COMPACT
</code>
row format has the following
storage characteristics:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Each index record contains a 5-byte header that may be
preceded by a variable-length header. The header is used to
link together consecutive records, and for row-level locking.
</p>
</li>
<li class="listitem">
<p>
The variable-length part of the record header contains a bit
vector for indicating
<code class="literal">
NULL
</code>
columns. If the
number of columns in the index that can be
<code class="literal">
NULL
</code>
is
<em class="replaceable">
<code>
N
</code>
</em>
, the
bit vector occupies
<code class="literal">
CEILING(
<em class="replaceable">
<code>
N
</code>
</em>
/8)
</code>
bytes. (For example, if there are anywhere from 9 to 16
columns that can be
<code class="literal">
NULL
</code>
, the bit vector
uses two bytes.) Columns that are
<code class="literal">
NULL
</code>
do
not occupy space other than the bit in this vector. The
variable-length part of the header also contains the lengths
of variable-length columns. Each length takes one or two
bytes, depending on the maximum length of the column. If all
columns in the index are
<code class="literal">
NOT NULL
</code>
and have
a fixed length, the record header has no variable-length part.
</p>
</li>
<li class="listitem">
<p>
For each non-
<code class="literal">
NULL
</code>
variable-length field,
the record header contains the length of the column in one or
two bytes. Two bytes are only needed if part of the column is
stored externally in overflow pages or the maximum length
exceeds 255 bytes and the actual length exceeds 127 bytes. For
an externally stored column, the 2-byte length indicates the
length of the internally stored part plus the 20-byte pointer
to the externally stored part. The internal part is 768 bytes,
so the length is 768+20. The 20-byte pointer stores the true
length of the column.
</p>
</li>
<li class="listitem">
<p>
The record header is followed by the data contents of
non-
<code class="literal">
NULL
</code>
columns.
</p>
</li>
<li class="listitem">
<p>
Records in the clustered index contain fields for all
user-defined columns. In addition, there is a 6-byte
transaction ID field and a 7-byte roll pointer field.
</p>
</li>
<li class="listitem">
<p>
If no primary key is defined for a table, each clustered index
record also contains a 6-byte row ID field.
</p>
</li>
<li class="listitem">
<p>
Each secondary index record contains all the primary key
columns defined for the clustered index key that are not in
the secondary index. If any of the primary key columns are
variable length, the record header for each secondary index
has a variable-length part to record their lengths, even if
the secondary index is defined on fixed-length columns.
</p>
</li>
<li class="listitem">
<p>
Internally, for nonvariable-length character sets,
fixed-length character columns such as
<a class="link" href="char.html" title="13.3.2 The CHAR and VARCHAR Types">
<code class="literal">
CHAR(10)
</code>
</a>
are stored in a
fixed-length format.
</p>
<p>
Trailing spaces are not truncated from
<a class="link" href="char.html" title="13.3.2 The CHAR and VARCHAR Types">
<code class="literal">
VARCHAR
</code>
</a>
columns.
</p>
</li>
<li class="listitem">
<p>
Internally, for variable-length character sets such as
<code class="literal">
utf8mb3
</code>
and
<code class="literal">
utf8mb4
</code>
,
<code class="literal">
InnoDB
</code>
attempts to store
<a class="link" href="char.html" title="13.3.2 The CHAR and VARCHAR Types">
<code class="literal">
CHAR(
<em class="replaceable">
<code>
N
</code>
</em>
)
</code>
</a>
in
<em class="replaceable">
<code>
N
</code>
</em>
bytes by trimming trailing
spaces. If the byte length of a
<a class="link" href="char.html" title="13.3.2 The CHAR and VARCHAR Types">
<code class="literal">
CHAR(
<em class="replaceable">
<code>
N
</code>
</em>
)
</code>
</a>
column value exceeds
<em class="replaceable">
<code>
N
</code>
</em>
bytes,
trailing spaces are trimmed to a maximum of the column value
byte length. The maximum length of a
<a class="link" href="char.html" title="13.3.2 The CHAR and VARCHAR Types">
<code class="literal">
CHAR(
<em class="replaceable">
<code>
N
</code>
</em>
)
</code>
</a>
column is the maximum character byte length ×
<em class="replaceable">
<code>
N
</code>
</em>
.
</p>
<p>
A minimum of
<em class="replaceable">
<code>
N
</code>
</em>
bytes is reserved
for
<a class="link" href="char.html" title="13.3.2 The CHAR and VARCHAR Types">
<code class="literal">
CHAR(
<em class="replaceable">
<code>
N
</code>
</em>
)
</code>
</a>
.
Reserving the minimum space
<em class="replaceable">
<code>
N
</code>
</em>
in
many cases enables column updates to be done in place without
causing index page fragmentation. By comparison,
<a class="link" href="char.html" title="13.3.2 The CHAR and VARCHAR Types">
<code class="literal">
CHAR(
<em class="replaceable">
<code>
N
</code>
</em>
)
</code>
</a>
columns occupy the maximum character byte length ×
<em class="replaceable">
<code>
N
</code>
</em>
when using the
<code class="literal">
REDUNDANT
</code>
row format.
</p>
<p>
Fixed-length columns greater than or equal to 768 bytes are
encoded as variable-length fields, which can be stored
off-page. For example, a
<code class="literal">
CHAR(255)
</code>
column
can exceed 768 bytes if the maximum byte length of the
character set is greater than 3, as it is with
<code class="literal">
utf8mb4
</code>
.
</p>
</li>
</ul>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h3 class="title">
<a name="innodb-row-format-dynamic">
</a>
DYNAMIC Row Format
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045160878432">
</a>
<a class="indexterm" name="idm46045160876944">
</a>
<p>
The
<code class="literal">
DYNAMIC
</code>
row format offers the same storage
characteristics as the
<code class="literal">
COMPACT
</code>
row format but
adds enhanced storage capabilities for long variable-length
columns and supports large index key prefixes.
</p>
<p>
When a table is created with
<code class="literal">
ROW_FORMAT=DYNAMIC
</code>
,
<code class="literal">
InnoDB
</code>
can store long variable-length column values (for
<a class="link" href="char.html" title="13.3.2 The CHAR and VARCHAR Types">
<code class="literal">
VARCHAR
</code>
</a>
,
<a class="link" href="binary-varbinary.html" title="13.3.3 The BINARY and VARBINARY Types">
<code class="literal">
VARBINARY
</code>
</a>
, and
<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>
types) fully off-page, with
the clustered index record containing only a 20-byte pointer to
the overflow page. Fixed-length fields greater than or equal to
768 bytes are encoded as variable-length fields. For example, a
<code class="literal">
CHAR(255)
</code>
column can exceed 768 bytes if the
maximum byte length of the character set is greater than 3, as it
is with
<code class="literal">
utf8mb4
</code>
.
</p>
<p>
Whether columns are stored off-page depends on the page size and
the total size of the row. When a row is too long, the longest
columns are chosen for off-page storage until the clustered index
record fits on the
<a class="link" href="glossary.html#glos_b_tree" title="B-tree">
B-tree
</a>
page.
<a class="link" href="blob.html" title="13.3.4 The BLOB and TEXT Types">
<code class="literal">
TEXT
</code>
</a>
and
<a class="link" href="blob.html" title="13.3.4 The BLOB and TEXT Types">
<code class="literal">
BLOB
</code>
</a>
columns that are less than or
equal to 40 bytes are stored in line.
</p>
<p>
The
<code class="literal">
DYNAMIC
</code>
row format maintains the efficiency
of storing the entire row in the index node if it fits (as do the
<code class="literal">
COMPACT
</code>
and
<code class="literal">
REDUNDANT
</code>
formats), but the
<code class="literal">
DYNAMIC
</code>
row format avoids the
problem of filling B-tree nodes with a large number of data bytes
of long columns. The
<code class="literal">
DYNAMIC
</code>
row format is
based on the idea that if a portion of a long data value is stored
off-page, it is usually most efficient to store the entire value
off-page. With
<code class="literal">
DYNAMIC
</code>
format, shorter columns
are likely to remain in the B-tree node, minimizing the number of
overflow pages required for a given row.
</p>
<p>
The
<code class="literal">
DYNAMIC
</code>
row format supports index key
prefixes up to 3072 bytes.
</p>
<p>
Tables that use the
<code class="literal">
DYNAMIC
</code>
row format can be
stored in the system tablespace, file-per-table tablespaces, and
general tablespaces. To store
<code class="literal">
DYNAMIC
</code>
tables in
the system tablespace, either disable
<a class="link" href="innodb-parameters.html#sysvar_innodb_file_per_table">
<code class="literal">
innodb_file_per_table
</code>
</a>
and use a
regular
<code class="literal">
CREATE TABLE
</code>
or
<code class="literal">
ALTER
TABLE
</code>
statement, or use the
<code class="literal">
TABLESPACE [=]
innodb_system
</code>
table option with
<code class="literal">
CREATE
TABLE
</code>
or
<code class="literal">
ALTER TABLE
</code>
. The
<a class="link" href="innodb-parameters.html#sysvar_innodb_file_per_table">
<code class="literal">
innodb_file_per_table
</code>
</a>
variable is
not applicable to general tablespaces, nor is it applicable when
using the
<code class="literal">
TABLESPACE [=] innodb_system
</code>
table
option to store
<code class="literal">
DYNAMIC
</code>
tables in the system
tablespace.
</p>
<h4>
<a name="innodb-dynamic-row-format-characteristics">
</a>
DYNAMIC Row Format Storage Characteristics
</h4>
<a class="indexterm" name="idm46045160843776">
</a>
<p>
The
<code class="literal">
DYNAMIC
</code>
row format is a variation of the
<code class="literal">
COMPACT
</code>
row format. For storage
characteristics, see
<a class="xref" href="innodb-row-format.html#innodb-compact-row-format-characteristics" title="COMPACT Row Format Storage Characteristics">
COMPACT Row Format Storage Characteristics
</a>
.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h3 class="title">
<a name="innodb-row-format-compressed">
</a>
COMPRESSED Row Format
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045160838368">
</a>
<a class="indexterm" name="idm46045160836880">
</a>
<p>
The
<code class="literal">
COMPRESSED
</code>
row format offers the same
storage characteristics and capabilities as the
<code class="literal">
DYNAMIC
</code>
row format but adds support for table
and index data compression.
</p>
<p>
The
<code class="literal">
COMPRESSED
</code>
row format uses similar internal
details for off-page storage as the
<code class="literal">
DYNAMIC
</code>
row
format, with additional storage and performance considerations
from the table and index data being compressed and using smaller
page sizes. With the
<code class="literal">
COMPRESSED
</code>
row format, the
<code class="literal">
KEY_BLOCK_SIZE
</code>
option controls how much column
data is stored in the clustered index, and how much is placed on
overflow pages. For more information about the
<code class="literal">
COMPRESSED
</code>
row format, see
<a class="xref" href="innodb-compression.html" title="17.9 InnoDB Table and Page Compression">
Section 17.9, “InnoDB Table and Page Compression”
</a>
.
</p>
<p>
The
<code class="literal">
COMPRESSED
</code>
row format supports index key
prefixes up to 3072 bytes.
</p>
<p>
Tables that use the
<code class="literal">
COMPRESSED
</code>
row format can
be created in file-per-table tablespaces or general tablespaces.
The system tablespace does not support the
<code class="literal">
COMPRESSED
</code>
row format. To store a
<code class="literal">
COMPRESSED
</code>
table in a file-per-table
tablespace, the
<a class="link" href="innodb-parameters.html#sysvar_innodb_file_per_table">
<code class="literal">
innodb_file_per_table
</code>
</a>
variable
must be enabled. The
<a class="link" href="innodb-parameters.html#sysvar_innodb_file_per_table">
<code class="literal">
innodb_file_per_table
</code>
</a>
variable is
not applicable to general tablespaces. General tablespaces support
all row formats with the caveat that compressed and uncompressed
tables cannot coexist in the same general tablespace due to
different physical page sizes. For more information, see
<a class="xref" href="general-tablespaces.html" title="17.6.3.3 General Tablespaces">
Section 17.6.3.3, “General Tablespaces”
</a>
.
</p>
<h4>
<a name="innodb-compressed-row-format-characteristics">
</a>
Compressed Row Format Storage Characteristics
</h4>
<a class="indexterm" name="idm46045160820048">
</a>
<p>
The
<code class="literal">
COMPRESSED
</code>
row format is a variation of the
<code class="literal">
COMPACT
</code>
row format. For storage
characteristics, see
<a class="xref" href="innodb-row-format.html#innodb-compact-row-format-characteristics" title="COMPACT Row Format Storage Characteristics">
COMPACT Row Format Storage Characteristics
</a>
.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h3 class="title">
<a name="innodb-row-format-defining">
</a>
Defining the Row Format of a Table
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045160814608">
</a>
<a class="indexterm" name="idm46045160813120">
</a>
<a class="indexterm" name="idm46045160811632">
</a>
<p>
The default row format for
<code class="literal">
InnoDB
</code>
tables is
defined by
<a class="link" href="innodb-parameters.html#sysvar_innodb_default_row_format">
<code class="literal">
innodb_default_row_format
</code>
</a>
variable, which has a default value of
<code class="literal">
DYNAMIC
</code>
.
The default row format is used when the
<code class="literal">
ROW_FORMAT
</code>
table option is not defined
explicitly or when
<code class="literal">
ROW_FORMAT=DEFAULT
</code>
is
specified.
</p>
<p>
The row format of a table can be defined explicitly using the
<code class="literal">
ROW_FORMAT
</code>
table option in a
<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>
statement. For example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa23120995"><div class="copy-help left">Press ⌘+C to 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> <span class="token keyword">ROW_FORMAT</span><span class="token operator">=</span><span class="token keyword">DYNAMIC</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
An explicitly defined
<code class="literal">
ROW_FORMAT
</code>
setting
overrides the default row format. Specifying
<code class="literal">
ROW_FORMAT=DEFAULT
</code>
is equivalent to using the
implicit default.
</p>
<p>
The
<a class="link" href="innodb-parameters.html#sysvar_innodb_default_row_format">
<code class="literal">
innodb_default_row_format
</code>
</a>
variable can be set dynamically:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa3748118"><div class="copy-help left">Press ⌘+C to 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">GLOBAL</span> innodb_default_row_format<span class="token operator">=</span><span class="token keyword">DYNAMIC</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Valid
<a class="link" href="innodb-parameters.html#sysvar_innodb_default_row_format">
<code class="literal">
innodb_default_row_format
</code>
</a>
options include
<code class="literal">
DYNAMIC
</code>
,
<code class="literal">
COMPACT
</code>
, and
<code class="literal">
REDUNDANT
</code>
. The
<code class="literal">
COMPRESSED
</code>
row format, which is not supported
for use in the system tablespace, cannot be defined as the
default. It can only be specified explicitly in a
<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>
statement. Attempting
to set the
<a class="link" href="innodb-parameters.html#sysvar_innodb_default_row_format">
<code class="literal">
innodb_default_row_format
</code>
</a>
variable to
<code class="literal">
COMPRESSED
</code>
returns an error:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa13488640"><div class="copy-help left">Press ⌘+C to 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">GLOBAL</span> innodb_default_row_format<span class="token operator">=</span><span class="token keyword">COMPRESSED</span><span class="token punctuation">;</span>
<span class="token output">ERROR 1231 (42000)<span class="token punctuation">:</span> Variable 'innodb_default_row_format'
can't be set to the value of 'COMPRESSED'</span></code></pre>
</div>
<p>
Newly created tables use the row format defined by the
<a class="link" href="innodb-parameters.html#sysvar_innodb_default_row_format">
<code class="literal">
innodb_default_row_format
</code>
</a>
variable when a
<code class="literal">
ROW_FORMAT
</code>
option is not
specified explicitly, or when
<code class="literal">
ROW_FORMAT=DEFAULT
</code>
is used. For example, the
following
<a class="link" href="create-table.html" title="15.1.20 CREATE TABLE Statement">
<code class="literal">
CREATE TABLE
</code>
</a>
statements
use the row format defined by the
<a class="link" href="innodb-parameters.html#sysvar_innodb_default_row_format">
<code class="literal">
innodb_default_row_format
</code>
</a>
variable.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa85205161"><div class="copy-help left">Press ⌘+C to 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><span class="token punctuation">;</span></code></pre>
</div>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa10274326"><div class="copy-help left">Press ⌘+C to 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> t2 <span class="token punctuation">(</span>c1 <span class="token datatype">INT</span><span class="token punctuation">)</span> <span class="token keyword">ROW_FORMAT</span><span class="token operator">=</span><span class="token keyword">DEFAULT</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
When a
<code class="literal">
ROW_FORMAT
</code>
option is not specified
explicitly, or when
<code class="literal">
ROW_FORMAT=DEFAULT
</code>
is used,
an operation that rebuilds a table silently changes the row format
of the table to the format defined by the
<a class="link" href="innodb-parameters.html#sysvar_innodb_default_row_format">
<code class="literal">
innodb_default_row_format
</code>
</a>
variable.
</p>
<p>
Table-rebuilding operations include
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER
TABLE
</code>
</a>
operations that use
<code class="literal">
ALGORITHM=COPY
</code>
or
<code class="literal">
ALGORITHM=INPLACE
</code>
where table rebuilding is
required. See
<a class="xref" href="innodb-online-ddl-operations.html" title="17.12.1 Online DDL Operations">
Section 17.12.1, “Online DDL Operations”
</a>
for
more information.
<a class="link" href="optimize-table.html" title="15.7.3.4 OPTIMIZE TABLE Statement">
<code class="literal">
OPTIMIZE TABLE
</code>
</a>
is
also a table-rebuilding operation.
</p>
<p>
The following example demonstrates a table-rebuilding operation
that silently changes the row format of a table created without an
explicitly defined row format.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa90701201"><div class="copy-help left">Press ⌘+C to 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 variable">@@innodb_default_row_format</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> @@innodb_default_row_format <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> dynamic <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 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">INT</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> INFORMATION_SCHEMA<span class="token punctuation">.</span>INNODB_TABLES <span class="token keyword">WHERE</span> <span class="token keyword">NAME</span> <span class="token operator">LIKE</span> <span class="token string">'test/t1'</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>
TABLE_ID<span class="token punctuation">:</span> 54
NAME<span class="token punctuation">:</span> test/t1
FLAG<span class="token punctuation">:</span> 33
N_COLS<span class="token punctuation">:</span> 4
SPACE<span class="token punctuation">:</span> 35
ROW_FORMAT<span class="token punctuation">:</span> Dynamic
ZIP_PAGE_SIZE<span class="token punctuation">:</span> 0
SPACE_TYPE<span class="token punctuation">:</span> Single
</span>
<span class="token prompt">mysql></span> <span class="token keyword">SET</span> <span class="token keyword">GLOBAL</span> innodb_default_row_format<span class="token operator">=</span><span class="token keyword">COMPACT</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">ALTER</span> <span class="token keyword">TABLE</span> t1 <span class="token keyword">ADD</span> <span class="token keyword">COLUMN</span> <span class="token punctuation">(</span>c2 <span class="token datatype">INT</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> INFORMATION_SCHEMA<span class="token punctuation">.</span>INNODB_TABLES <span class="token keyword">WHERE</span> <span class="token keyword">NAME</span> <span class="token operator">LIKE</span> <span class="token string">'test/t1'</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>
TABLE_ID<span class="token punctuation">:</span> 55
NAME<span class="token punctuation">:</span> test/t1
FLAG<span class="token punctuation">:</span> 1
N_COLS<span class="token punctuation">:</span> 5
SPACE<span class="token punctuation">:</span> 36
ROW_FORMAT<span class="token punctuation">:</span> Compact
ZIP_PAGE_SIZE<span class="token punctuation">:</span> 0
SPACE_TYPE<span class="token punctuation">:</span> Single</span></code></pre>
</div>
<p>
Consider the following potential issues before changing the row
format of existing tables from
<code class="literal">
REDUNDANT
</code>
or
<code class="literal">
COMPACT
</code>
to
<code class="literal">
DYNAMIC
</code>
.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
The
<code class="literal">
REDUNDANT
</code>
and
<code class="literal">
COMPACT
</code>
row formats support a maximum index
key prefix length of 767 bytes whereas
<code class="literal">
DYNAMIC
</code>
and
<code class="literal">
COMPRESSED
</code>
row formats support an index key prefix length of 3072 bytes.
In a replication environment, if the
<a class="link" href="innodb-parameters.html#sysvar_innodb_default_row_format">
<code class="literal">
innodb_default_row_format
</code>
</a>
variable is set to
<code class="literal">
DYNAMIC
</code>
on the source,
and set to
<code class="literal">
COMPACT
</code>
on the replica, the
following DDL statement, which does not explicitly define a
row format, succeeds on the source but fails on the replica:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa56106502"><div class="copy-help left">Press ⌘+C to 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 keyword">PRIMARY</span> <span class="token keyword">KEY</span><span class="token punctuation">,</span> c2 <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">5000</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token keyword">KEY</span> i1<span class="token punctuation">(</span>c2<span class="token punctuation">(</span><span class="token number">3070</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>
For related information, see
<a class="xref" href="innodb-limits.html" title="17.21 InnoDB Limits">
Section 17.21, “InnoDB Limits”
</a>
.
</p>
</li>
<li class="listitem">
<p>
Importing a table that does not explicitly define a row format
results in a schema mismatch error if the
<a class="link" href="innodb-parameters.html#sysvar_innodb_default_row_format">
<code class="literal">
innodb_default_row_format
</code>
</a>
setting on the source server differs from the setting on the
destination server. For more information, see
<a class="xref" href="innodb-table-import.html" title="17.6.1.3 Importing InnoDB Tables">
Section 17.6.1.3, “Importing InnoDB Tables”
</a>
.
</p>
</li>
</ul>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h3 class="title">
<a name="innodb-row-format-detrmining">
</a>
Determining the Row Format of a Table
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045160745488">
</a>
<p>
To determine the row format of a table, use
<a class="link" href="show-table-status.html" title="15.7.7.38 SHOW TABLE STATUS Statement">
<code class="literal">
SHOW TABLE STATUS
</code>
</a>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa50201761"><div class="copy-help left">Press ⌘+C to 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">TABLE</span> <span class="token keyword">STATUS</span> <span class="token keyword">IN</span> test1\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>
Name<span class="token punctuation">:</span> t1
Engine<span class="token punctuation">:</span> InnoDB
Version<span class="token punctuation">:</span> 10
Row_format<span class="token punctuation">:</span> Dynamic
Rows<span class="token punctuation">:</span> 0
Avg_row_length<span class="token punctuation">:</span> 0
Data_length<span class="token punctuation">:</span> 16384
Max_data_length<span class="token punctuation">:</span> 0
Index_length<span class="token punctuation">:</span> 16384
Data_free<span class="token punctuation">:</span> 0
Auto_increment<span class="token punctuation">:</span> 1
Create_time<span class="token punctuation">:</span> 2016-09-14 16<span class="token punctuation">:</span>29<span class="token punctuation">:</span>38
Update_time<span class="token punctuation">:</span> NULL
Check_time<span class="token punctuation">:</span> NULL
Collation<span class="token punctuation">:</span> utf8mb4_0900_ai_ci
Checksum<span class="token punctuation">:</span> NULL
Create_options<span class="token punctuation">:</span>
Comment<span class="token punctuation">:</span></span></code></pre>
</div>
<p>
Alternatively, query the Information Schema
<a class="link" href="information-schema-innodb-tables-table.html" title="28.4.23 The INFORMATION_SCHEMA INNODB_TABLES Table">
<code class="literal">
INNODB_TABLES
</code>
</a>
table:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa28360740"><div class="copy-help left">Press ⌘+C to 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> <span class="token keyword">ROW_FORMAT</span> <span class="token keyword">FROM</span> INFORMATION_SCHEMA<span class="token punctuation">.</span>INNODB_TABLES <span class="token keyword">WHERE</span> <span class="token keyword">NAME</span><span class="token operator">=</span><span class="token string">'test1/t1'</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> NAME <span class="token punctuation">|</span> ROW_FORMAT <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> test1/t1 <span class="token punctuation">|</span> Dynamic <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>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/sql-prepared-statements.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title">
<a name="sql-prepared-statements">
</a>
15.5 Prepared Statements
</h2>
</div>
</div>
</div>
<div class="toc">
<dl class="toc">
<dt>
<span class="section">
<a href="prepare.html">
15.5.1 PREPARE Statement
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="execute.html">
15.5.2 EXECUTE Statement
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="deallocate-prepare.html">
15.5.3 DEALLOCATE PREPARE Statement
</a>
</span>
</dt>
</dl>
</div>
<a class="indexterm" name="idm46045176785728">
</a>
<a class="indexterm" name="idm46045176784656">
</a>
<a class="indexterm" name="idm46045176783584">
</a>
<a class="indexterm" name="idm46045176782512">
</a>
<p>
MySQL 8.4 provides support for server-side prepared
statements. This support takes advantage of the efficient
client/server binary protocol. Using prepared statements with
placeholders for parameter values has the following benefits:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Less overhead for parsing the statement each time it is
executed. Typically, database applications process large volumes
of almost-identical statements, with only changes to literal or
variable values in clauses such as
<code class="literal">
WHERE
</code>
for
queries and deletes,
<code class="literal">
SET
</code>
for updates, and
<code class="literal">
VALUES
</code>
for inserts.
</p>
</li>
<li class="listitem">
<p>
Protection against SQL injection attacks. The parameter values
can contain unescaped SQL quote and delimiter characters.
</p>
<a class="indexterm" name="idm46045176776528">
</a>
<a class="indexterm" name="idm46045176775456">
</a>
</li>
</ul>
</div>
<p>
The following sections provide an overview of the characteristics of
prepared statements:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="xref" href="sql-prepared-statements.html#prepared-statements-in-applications" title="Prepared Statements in Application Programs">
Prepared Statements in Application Programs
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="sql-prepared-statements.html#prepared-statements-in-scripts" title="Prepared Statements in SQL Scripts">
Prepared Statements in SQL Scripts
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="sql-prepared-statements.html#prepared-statement-types" title="PREPARE, EXECUTE, and DEALLOCATE PREPARE Statements">
PREPARE, EXECUTE, and DEALLOCATE PREPARE Statements
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="sql-prepared-statements.html#prepared-statements-permitted" title="SQL Syntax Permitted in Prepared Statements">
SQL Syntax Permitted in Prepared Statements
</a>
</p>
</li>
</ul>
</div>
<h3>
<a name="prepared-statements-in-applications">
</a>
Prepared Statements in Application Programs
</h3>
<p>
You can use server-side prepared statements through client
programming interfaces, including the
<a class="ulink" href="/doc/c-api/8.4/en/" target="_top">
MySQL C
API client library
</a>
for C programs,
<a class="ulink" href="/doc/connector-j/en/" target="_top">
MySQL Connector/J
</a>
for Java
programs, and
<a class="ulink" href="/doc/connector-net/en/" target="_top">
MySQL Connector/NET
</a>
for
programs using .NET technologies. For example, the C API provides a
set of function calls that make up its prepared statement API. See
<a class="ulink" href="/doc/c-api/8.4/en/c-api-prepared-statement-interface.html" target="_top">
C API Prepared Statement Interface
</a>
. Other language
interfaces can provide support for prepared statements that use the
binary protocol by linking in the C client library, one example
being the
<a class="ulink" href="http://php.net/mysqli" target="_blank">
<code class="literal">
mysqli
</code>
extension
</a>
, available in PHP 5.0 and later.
</p>
<h3>
<a name="prepared-statements-in-scripts">
</a>
Prepared Statements in SQL Scripts
</h3>
<p>
An alternative SQL interface to prepared statements is available.
This interface is not as efficient as using the binary protocol
through a prepared statement API, but requires no programming
because it is available directly at the SQL level:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
You can use it when no programming interface is available to
you.
</p>
</li>
<li class="listitem">
<p>
You can use it from any program that can send SQL statements to
the server to be executed, such as 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 program.
</p>
</li>
<li class="listitem">
<p>
You can use it even if the client is using an old version of the
client library.
</p>
</li>
</ul>
</div>
<p>
SQL syntax for prepared statements is intended to be used for
situations such as these:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
To test how prepared statements work in your application before
coding it.
</p>
</li>
<li class="listitem">
<p>
To use prepared statements when you do not have access to a
programming API that supports them.
</p>
</li>
<li class="listitem">
<p>
To interactively troubleshoot application issues with prepared
statements.
</p>
</li>
<li class="listitem">
<p>
To create a test case that reproduces a problem with prepared
statements, so that you can file a bug report.
</p>
</li>
</ul>
</div>
<h3>
<a name="prepared-statement-types">
</a>
PREPARE, EXECUTE, and DEALLOCATE PREPARE Statements
</h3>
<p>
SQL syntax for prepared statements is based on three SQL statements:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="link" href="prepare.html" title="15.5.1 PREPARE Statement">
<code class="literal">
PREPARE
</code>
</a>
prepares a statement for
execution (see
<a class="xref" href="prepare.html" title="15.5.1 PREPARE Statement">
Section 15.5.1, “PREPARE Statement”
</a>
).
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="execute.html" title="15.5.2 EXECUTE Statement">
<code class="literal">
EXECUTE
</code>
</a>
executes a prepared
statement (see
<a class="xref" href="execute.html" title="15.5.2 EXECUTE Statement">
Section 15.5.2, “EXECUTE Statement”
</a>
).
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="deallocate-prepare.html" title="15.5.3 DEALLOCATE PREPARE Statement">
<code class="literal">
DEALLOCATE PREPARE
</code>
</a>
releases a
prepared statement (see
<a class="xref" href="deallocate-prepare.html" title="15.5.3 DEALLOCATE PREPARE Statement">
Section 15.5.3, “DEALLOCATE PREPARE Statement”
</a>
).
</p>
</li>
</ul>
</div>
<p>
The following examples show two equivalent ways of preparing a
statement that computes the hypotenuse of a triangle given the
lengths of the two sides.
</p>
<p>
The first example shows how to create a prepared statement by using
a string literal to supply the text of the statement:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa63366899"><div class="copy-help left">Press ⌘+C to 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">PREPARE</span> stmt1 <span class="token keyword">FROM</span> <span class="token string">'SELECT SQRT(POW(?,2) + POW(?,2)) AS hypotenuse'</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">SET</span> <span class="token variable">@a</span> <span class="token operator">=</span> <span class="token number">3</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">SET</span> <span class="token variable">@b</span> <span class="token operator">=</span> <span class="token number">4</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">EXECUTE</span> stmt1 <span class="token keyword">USING</span> <span class="token variable">@a</span><span class="token punctuation">,</span> <span class="token variable">@b</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>
<span class="token output"><span class="token punctuation">|</span> hypotenuse <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>
<span class="token output"><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>
<span class="token prompt">mysql></span> <span class="token keyword">DEALLOCATE</span> <span class="token keyword">PREPARE</span> stmt1<span class="token punctuation">;</span></code></pre>
</div>
<p>
The second example is similar, but supplies the text of the
statement as a user variable:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa11220015"><div class="copy-help left">Press ⌘+C to 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 variable">@s</span> <span class="token operator">=</span> <span class="token string">'SELECT SQRT(POW(?,2) + POW(?,2)) AS hypotenuse'</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">PREPARE</span> stmt2 <span class="token keyword">FROM</span> <span class="token variable">@s</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">SET</span> <span class="token variable">@a</span> <span class="token operator">=</span> <span class="token number">6</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">SET</span> <span class="token variable">@b</span> <span class="token operator">=</span> <span class="token number">8</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">EXECUTE</span> stmt2 <span class="token keyword">USING</span> <span class="token variable">@a</span><span class="token punctuation">,</span> <span class="token variable">@b</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>
<span class="token output"><span class="token punctuation">|</span> hypotenuse <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>
<span class="token output"><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>
<span class="token prompt">mysql></span> <span class="token keyword">DEALLOCATE</span> <span class="token keyword">PREPARE</span> stmt2<span class="token punctuation">;</span></code></pre>
</div>
<p>
Here is an additional example that demonstrates how to choose the
table on which to perform a query at runtime, by storing the name of
the table as a user variable:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa80249"><div class="copy-help left">Press ⌘+C to 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">USE</span> test<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 punctuation">(</span>a <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> t1 <span class="token keyword">VALUES</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 number">8</span><span class="token punctuation">)</span><span class="token punctuation">,</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">32</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token number">80</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">SET</span> <span class="token variable">@table</span> <span class="token operator">=</span> <span class="token string">'t1'</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">SET</span> <span class="token variable">@s</span> <span class="token operator">=</span> <span class="token function">CONCAT</span><span class="token punctuation">(</span><span class="token string">'SELECT * FROM '</span><span class="token punctuation">,</span> <span class="token variable">@table</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">PREPARE</span> stmt3 <span class="token keyword">FROM</span> <span class="token variable">@s</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">EXECUTE</span> stmt3<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> 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>
<span class="token output"><span class="token punctuation">|</span> 4 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 8 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 11 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 32 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 80 <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 prompt">mysql></span> <span class="token keyword">DEALLOCATE</span> <span class="token keyword">PREPARE</span> stmt3<span class="token punctuation">;</span></code></pre>
</div>
<p>
A prepared statement is specific to the session in which it was
created. If you terminate a session without deallocating a
previously prepared statement, the server deallocates it
automatically.
</p>
<p>
A prepared statement is also global to the session. If you create a
prepared statement within a stored routine, it is not deallocated
when the stored routine ends.
</p>
<p>
To guard against too many prepared statements being created
simultaneously, set the
<a class="link" href="server-system-variables.html#sysvar_max_prepared_stmt_count">
<code class="literal">
max_prepared_stmt_count
</code>
</a>
system
variable. To prevent the use of prepared statements, set the value
to 0.
</p>
<h3>
<a name="prepared-statements-permitted">
</a>
SQL Syntax Permitted in Prepared Statements
</h3>
<p>
The following SQL statements can be used as prepared statements:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa88896382"><div class="copy-help left">Press ⌘+C to 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">INSTANCE</span> <span class="token operator">|</span> <span class="token keyword">TABLE</span> <span class="token operator">|</span> <span class="token keyword">USER</span>}
<span class="token keyword">ANALYZE</span>
<span class="token keyword">CALL</span>
<span class="token keyword">CHANGE</span> {<span class="token keyword">REPLICATION</span> <span class="token keyword">SOURCE</span> <span class="token keyword">TO</span> <span class="token operator">|</span> <span class="token keyword">REPLICATION</span> <span class="token keyword">FILTER</span>}
<span class="token keyword">CHECKSUM</span>
<span class="token keyword">COMMIT</span>
{<span class="token keyword">CREATE</span> <span class="token operator">|</span> <span class="token keyword">DROP</span>} <span class="token keyword">INDEX</span>
{<span class="token keyword">CREATE</span> <span class="token operator">|</span> <span class="token keyword">DROP</span> <span class="token operator">|</span> <span class="token keyword">RENAME</span>} <span class="token keyword">DATABASE</span>
{<span class="token keyword">CREATE</span> <span class="token operator">|</span> <span class="token keyword">DROP</span> <span class="token operator">|</span> <span class="token keyword">RENAME</span>} <span class="token keyword">TABLE</span>
{<span class="token keyword">CREATE</span> <span class="token operator">|</span> <span class="token keyword">DROP</span> <span class="token operator">|</span> <span class="token keyword">RENAME</span>} <span class="token keyword">USER</span>
<span class="token keyword">DEALLOCATE</span> <span class="token keyword">PREPARE</span>
<span class="token keyword">DROP</span> <span class="token keyword">VIEW</span>
<span class="token keyword">DELETE</span>
<span class="token keyword">DO</span>
<span class="token keyword">EXECUTE</span>
<span class="token keyword">FLUSH</span>
<span class="token keyword">GRANT</span> {<span class="token keyword">ROLE</span>}
<span class="token keyword">INSERT</span>
<span class="token keyword">INSTALL</span> <span class="token keyword">PLUGIN</span>
<span class="token keyword">KILL</span>
<span class="token keyword">OPTIMIZE</span>
<span class="token keyword">PREPARE</span>
<span class="token keyword">REPAIR</span> <span class="token keyword">TABLE</span>
<span class="token keyword">REPLACE</span>
<span class="token keyword">REPLICA</span> {<span class="token keyword">START</span> <span class="token operator">|</span> <span class="token keyword">STOP</span>}
<span class="token keyword">RESET</span>
<span class="token keyword">REVOKE</span> {<span class="token keyword">ALL</span> <span class="token operator">|</span> <span class="token keyword">ROLE</span>}
<span class="token keyword">SELECT</span>
<span class="token keyword">SET</span> <span class="token keyword">ROLE</span>
<span class="token keyword">SHOW</span> {<span class="token keyword">BINLOG</span> <span class="token keyword">EVENTS</span> <span class="token operator">|</span> <span class="token datatype">BINARY</span> <span class="token keyword">LOGS</span> <span class="token operator">|</span> <span class="token datatype">BINARY</span> LOG <span class="token keyword">STATUS</span> <span class="token operator">|</span> <span class="token keyword">CHARACTER</span> SETS <span class="token operator">|</span> COLLATIONS <span class="token operator">|</span> <span class="token keyword">DATABASES</span> <span class="token operator">|</span> <span class="token keyword">ENGINES</span> <span class="token operator">|</span>
<span class="token keyword">ERRORS</span> <span class="token operator">|</span> <span class="token keyword">EVENTS</span> <span class="token operator">|</span> <span class="token keyword">FIELDS</span> <span class="token operator">|</span> <span class="token keyword">FUNCTION</span> <span class="token keyword">CODE</span> <span class="token operator">|</span> <span class="token keyword">FUNCTION</span> <span class="token keyword">STATUS</span> <span class="token operator">|</span> <span class="token keyword">GRANTS</span> <span class="token operator">|</span> <span class="token keyword">KEYS</span> <span class="token operator">|</span> <span class="token keyword">OPEN</span> <span class="token keyword">TABLES</span> <span class="token operator">|</span>
<span class="token keyword">PLUGINS</span> <span class="token operator">|</span> <span class="token keyword">PRIVILEGES</span> <span class="token operator">|</span> <span class="token keyword">PROCEDURE</span> <span class="token keyword">CODE</span> <span class="token operator">|</span> <span class="token keyword">PROCEDURE</span> <span class="token keyword">STATUS</span> <span class="token operator">|</span> <span class="token keyword">PROCESSLIST</span> <span class="token operator">|</span> <span class="token keyword">PROFILE</span> <span class="token operator">|</span> <span class="token keyword">PROFILES</span> <span class="token operator">|</span>
<span class="token keyword">RELAYLOG</span> <span class="token keyword">EVENTS</span> <span class="token operator">|</span> <span class="token keyword">REPLICAS</span> <span class="token operator">|</span> <span class="token keyword">REPLICA</span> <span class="token keyword">STATUS</span> <span class="token operator">|</span> <span class="token keyword">STATUS</span> <span class="token operator">|</span> <span class="token keyword">PROCEDURE</span> <span class="token keyword">STATUS</span> <span class="token operator">|</span> <span class="token keyword">TABLE</span> <span class="token keyword">STATUS</span> <span class="token operator">|</span> <span class="token keyword">TABLES</span> <span class="token operator">|</span>
<span class="token keyword">TRIGGERS</span> <span class="token operator">|</span> <span class="token keyword">VARIABLES</span> <span class="token operator">|</span> <span class="token keyword">WARNINGS</span>}
<span class="token keyword">SHOW</span> <span class="token keyword">CREATE</span> { <span class="token keyword">DATABASE</span> <span class="token operator">|</span> <span class="token keyword">EVENT</span> <span class="token operator">|</span> <span class="token keyword">FUNCTION</span> <span class="token operator">|</span> <span class="token keyword">PROCEDURE</span> <span class="token operator">|</span> <span class="token keyword">TABLE</span> <span class="token operator">|</span> <span class="token keyword">TRIGGER</span> <span class="token operator">|</span> <span class="token keyword">USER</span> <span class="token operator">|</span> <span class="token keyword">VIEW</span>}
<span class="token keyword">TRUNCATE</span>
<span class="token keyword">UNINSTALL</span> <span class="token keyword">PLUGIN</span>
<span class="token keyword">UPDATE</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">
CREATE TABLE ... START TRANSACTION
</code>
is not
supported in prepared statements.
</p>
</div>
<p>
Other statements are not supported.
</p>
<p>
For compliance with the SQL standard, which states that diagnostics
statements are not preparable, MySQL does not support the following
as prepared statements:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
SHOW COUNT(*) WARNINGS
</code>
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
SHOW COUNT(*) ERRORS
</code>
</p>
</li>
<li class="listitem">
<p>
Statements containing any reference to the
<a class="link" href="server-system-variables.html#sysvar_warning_count">
<code class="literal">
warning_count
</code>
</a>
or
<a class="link" href="server-system-variables.html#sysvar_error_count">
<code class="literal">
error_count
</code>
</a>
system variable.
</p>
</li>
</ul>
</div>
<p>
Generally, statements not permitted in SQL prepared statements are
also not permitted in stored programs. Exceptions are noted in
<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>
Metadata changes to tables or views referred to by prepared
statements are detected and cause automatic repreparation of the
statement when it is next executed. For more information, see
<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>
.
</p>
<p>
Placeholders can be used for the arguments of the
<code class="literal">
LIMIT
</code>
clause when using prepared statements. See
<a class="xref" href="select.html" title="15.2.13 SELECT Statement">
Section 15.2.13, “SELECT Statement”
</a>
.
</p>
<p>
In prepared
<a class="link" href="call.html" title="15.2.1 CALL Statement">
<code class="literal">
CALL
</code>
</a>
statements used with
<a class="link" href="prepare.html" title="15.5.1 PREPARE Statement">
<code class="literal">
PREPARE
</code>
</a>
and
<a class="link" href="execute.html" title="15.5.2 EXECUTE Statement">
<code class="literal">
EXECUTE
</code>
</a>
, placeholder support for
<code class="literal">
OUT
</code>
and
<code class="literal">
INOUT
</code>
parameters is
available beginning with MySQL 8.4. See
<a class="xref" href="call.html" title="15.2.1 CALL Statement">
Section 15.2.1, “CALL Statement”
</a>
, for an example and a workaround for earlier
versions. Placeholders can be used for
<code class="literal">
IN
</code>
parameters regardless of version.
</p>
<p>
SQL syntax for prepared statements cannot be used in nested fashion.
That is, a statement passed to
<a class="link" href="prepare.html" title="15.5.1 PREPARE Statement">
<code class="literal">
PREPARE
</code>
</a>
cannot itself be a
<a class="link" href="prepare.html" title="15.5.1 PREPARE Statement">
<code class="literal">
PREPARE
</code>
</a>
,
<a class="link" href="execute.html" title="15.5.2 EXECUTE Statement">
<code class="literal">
EXECUTE
</code>
</a>
, or
<a class="link" href="deallocate-prepare.html" title="15.5.3 DEALLOCATE PREPARE Statement">
<code class="literal">
DEALLOCATE PREPARE
</code>
</a>
statement.
</p>
<p>
SQL syntax for prepared statements is distinct from using prepared
statement API calls. For example, you cannot use the
<a class="ulink" href="/doc/c-api/8.4/en/mysql-stmt-prepare.html" target="_top">
<code class="literal">
mysql_stmt_prepare()
</code>
</a>
C API function
to prepare a
<a class="link" href="prepare.html" title="15.5.1 PREPARE Statement">
<code class="literal">
PREPARE
</code>
</a>
,
<a class="link" href="execute.html" title="15.5.2 EXECUTE Statement">
<code class="literal">
EXECUTE
</code>
</a>
, or
<a class="link" href="deallocate-prepare.html" title="15.5.3 DEALLOCATE PREPARE Statement">
<code class="literal">
DEALLOCATE PREPARE
</code>
</a>
statement.
</p>
<p>
SQL syntax for prepared statements can be used within stored
procedures, but not in stored functions or triggers. However, a
cursor cannot be used for a dynamic statement that is prepared and
executed with
<a class="link" href="prepare.html" title="15.5.1 PREPARE Statement">
<code class="literal">
PREPARE
</code>
</a>
and
<a class="link" href="execute.html" title="15.5.2 EXECUTE Statement">
<code class="literal">
EXECUTE
</code>
</a>
. The statement for a cursor
is checked at cursor creation time, so the statement cannot be
dynamic.
</p>
<p>
SQL syntax for prepared statements does not support multi-statements
(that is, multiple statements within a single string separated by
<code class="literal">
;
</code>
characters).
</p>
<p>
To write C programs that use the
<a class="link" href="call.html" title="15.2.1 CALL Statement">
<code class="literal">
CALL
</code>
</a>
SQL statement to execute stored procedures that contain prepared
statements, the
<code class="literal">
CLIENT_MULTI_RESULTS
</code>
flag must be
enabled. This is because each
<a class="link" href="call.html" title="15.2.1 CALL Statement">
<code class="literal">
CALL
</code>
</a>
returns a result to indicate the call status, in addition to any
result sets that might be returned by statements executed within the
procedure.
</p>
<p>
<code class="literal">
CLIENT_MULTI_RESULTS
</code>
can be enabled when you call
<a class="ulink" href="/doc/c-api/8.4/en/mysql-real-connect.html" target="_top">
<code class="literal">
mysql_real_connect()
</code>
</a>
, either
explicitly by passing the
<code class="literal">
CLIENT_MULTI_RESULTS
</code>
flag itself, or implicitly by passing
<code class="literal">
CLIENT_MULTI_STATEMENTS
</code>
(which also enables
<code class="literal">
CLIENT_MULTI_RESULTS
</code>
). For additional
information, see
<a class="xref" href="call.html" title="15.2.1 CALL Statement">
Section 15.2.1, “CALL Statement”
</a>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/group-replication-functions.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="group-replication-functions">
</a>
14.18.1 Group Replication Functions
</h3>
</div>
</div>
</div>
<div class="toc">
<dl class="toc">
<dt>
<span class="section">
<a href="group-replication-functions-for-new-primary.html">
14.18.1.1 Function which Configures Group Replication Primary
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="group-replication-functions-for-mode.html">
14.18.1.2 Functions which Configure the Group Replication Mode
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="group-replication-functions-for-maximum-consensus.html">
14.18.1.3 Functions to Inspect and Configure the Maximum Consensus Instances of a
Group
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="group-replication-functions-for-communication-protocol.html">
14.18.1.4 Functions to Inspect and Set the Group Replication Communication
Protocol Version
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="group-replication-functions-for-member-actions.html">
14.18.1.5 Functions to Set and Reset Group Replication Member Actions
</a>
</span>
</dt>
</dl>
</div>
<a class="indexterm" name="idm46045194031216">
</a>
<a class="indexterm" name="idm46045194030128">
</a>
<p>
The functions described in the following sections are used with
Group Replication.
</p>
<div class="table">
<a name="idm46045194028128">
</a>
<p class="title">
<b>
Table 14.25 Group Replication Functions
</b>
</p>
<div class="table-contents">
<table frame="box" rules="all" summary="A reference that lists functions used with MySQL Group Replication.">
<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="group-replication-functions-for-member-actions.html#function_group-replication-disable-member-action">
<code class="literal">
group_replication_disable_member_action()
</code>
</a>
</td>
<td>
Disable member action for event specified
</td>
</tr>
<tr>
<td>
<a class="link" href="group-replication-functions-for-member-actions.html#function_group-replication-enable-member-action">
<code class="literal">
group_replication_enable_member_action()
</code>
</a>
</td>
<td>
Enable member action for event specified
</td>
</tr>
<tr>
<td>
<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>
</td>
<td>
Get version of group replication communication protocol currently
in use
</td>
</tr>
<tr>
<td>
<a class="link" href="group-replication-functions-for-maximum-consensus.html#function_group-replication-get-write-concurrency">
<code class="literal">
group_replication_get_write_concurrency()
</code>
</a>
</td>
<td>
Get maximum number of consensus instances currently set for group
</td>
</tr>
<tr>
<td>
<a class="link" href="group-replication-functions-for-member-actions.html#function_group-replication-reset-member-actions">
<code class="literal">
group_replication_reset_member_actions()
</code>
</a>
</td>
<td>
Reset all member actions to defaults and configuration version
number to 1
</td>
</tr>
<tr>
<td>
<a class="link" href="group-replication-functions-for-new-primary.html#function_group-replication-set-as-primary">
<code class="literal">
group_replication_set_as_primary()
</code>
</a>
</td>
<td>
Make a specific group member the primary
</td>
</tr>
<tr>
<td>
<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>
</td>
<td>
Set version for group replication communication protocol to use
</td>
</tr>
<tr>
<td>
<a class="link" href="group-replication-functions-for-maximum-consensus.html#function_group-replication-set-write-concurrency">
<code class="literal">
group_replication_set_write_concurrency()
</code>
</a>
</td>
<td>
Set maximum number of consensus instances that can be executed in
parallel
</td>
</tr>
<tr>
<td>
<a class="link" href="group-replication-functions-for-mode.html#function_group-replication-switch-to-multi-primary-mode">
<code class="literal">
group_replication_switch_to_multi_primary_mode()
</code>
</a>
</td>
<td>
Changes the mode of a group running in single-primary mode to
multi-primary mode
</td>
</tr>
<tr>
<td>
<a class="link" href="group-replication-functions-for-mode.html#function_group-replication-switch-to-single-primary-mode">
<code class="literal">
group_replication_switch_to_single_primary_mode()
</code>
</a>
</td>
<td>
Changes the mode of a group running in multi-primary mode to
single-primary mode
</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: 405.156px;">
Name
</th>
<th style="width: 332.844px;">
Description
</th>
</tr>
</thead>
</table>
</div>
</div>
<br class="table-break"/>
</div>
<br/>
</div>
|
Subsets and Splits