url
stringlengths 45
122
| content
stringlengths 380
3.07M
|
---|---|
https://dev.mysql.com/doc/refman/8.4/en/performance-schema-cond-instances-table.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="performance-schema-cond-instances-table">
</a>
29.12.3.1 The cond_instances Table
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045073599312">
</a>
<a class="indexterm" name="idm46045073597824">
</a>
<p>
The
<a class="link" href="performance-schema-cond-instances-table.html" title="29.12.3.1 The cond_instances Table">
<code class="literal">
cond_instances
</code>
</a>
table lists
all the conditions seen by the Performance Schema while the
server executes. A condition is a synchronization mechanism
used in the code to signal that a specific event has happened,
so that a thread waiting for this condition can resume work.
</p>
<p>
When a thread is waiting for something to happen, the
condition name is an indication of what the thread is waiting
for, but there is no immediate way to tell which other thread,
or threads, causes the condition to happen.
</p>
<p>
The
<a class="link" href="performance-schema-cond-instances-table.html" title="29.12.3.1 The cond_instances Table">
<code class="literal">
cond_instances
</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">
NAME
</code>
</p>
<p>
The instrument name associated with the condition.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
OBJECT_INSTANCE_BEGIN
</code>
</p>
<p>
The address in memory of the instrumented condition.
</p>
</li>
</ul>
</div>
<p>
The
<a class="link" href="performance-schema-cond-instances-table.html" title="29.12.3.1 The cond_instances Table">
<code class="literal">
cond_instances
</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">
OBJECT_INSTANCE_BEGIN
</code>
)
</p>
</li>
<li class="listitem">
<p>
Index on (
<code class="literal">
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-cond-instances-table.html" title="29.12.3.1 The cond_instances Table">
<code class="literal">
cond_instances
</code>
</a>
table.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/innodb-file-per-table-tablespaces.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="innodb-file-per-table-tablespaces">
</a>
17.6.3.2 File-Per-Table Tablespaces
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045165503168">
</a>
<a class="indexterm" name="idm46045165501664">
</a>
<p>
A file-per-table tablespace contains data and indexes for a single
<code class="literal">
InnoDB
</code>
table, and is stored on the file system
in a single data file.
</p>
<p>
File-per-table tablespace characteristics are described under the
following topics in this section:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="xref" href="innodb-file-per-table-tablespaces.html#innodb-file-per-table-configuration" title="File-Per-Table Tablespace Configuration">
File-Per-Table Tablespace Configuration
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="innodb-file-per-table-tablespaces.html#innodb-file-per-table-data-files" title="File-Per-Table Tablespace Data Files">
File-Per-Table Tablespace Data Files
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="innodb-file-per-table-tablespaces.html#innodb-file-per-table-advantages" title="File-Per-Table Tablespace Advantages">
File-Per-Table Tablespace Advantages
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="innodb-file-per-table-tablespaces.html#innodb-file-per-table-disadvantages" title="File-Per-Table Tablespace Disadvantages">
File-Per-Table Tablespace Disadvantages
</a>
</p>
</li>
</ul>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="innodb-file-per-table-configuration">
</a>
File-Per-Table Tablespace Configuration
</h5>
</div>
</div>
</div>
<p>
<code class="literal">
InnoDB
</code>
creates tables in file-per-table
tablespaces by default. This behavior is controlled by the
<a class="link" href="innodb-parameters.html#sysvar_innodb_file_per_table">
<code class="literal">
innodb_file_per_table
</code>
</a>
variable.
Disabling
<a class="link" href="innodb-parameters.html#sysvar_innodb_file_per_table">
<code class="literal">
innodb_file_per_table
</code>
</a>
causes
<code class="literal">
InnoDB
</code>
to create tables in the system
tablespace.
</p>
<p>
An
<a class="link" href="innodb-parameters.html#sysvar_innodb_file_per_table">
<code class="literal">
innodb_file_per_table
</code>
</a>
setting can be specified in an option file or configured 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. Changing the setting at runtime
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>
Option file:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-ini"><div class="docs-select-all right" id="sa89140588"><div class="copy-help left">Press ⌘+C to 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_file_per_table</span><span class="token attr-value"><span class="token punctuation">=</span>ON</span></code></pre>
</div>
<p>
Using
<a class="link" href="set-variable.html" title="15.7.6.1 SET Syntax for Variable Assignment">
<code class="literal">
SET
GLOBAL
</code>
</a>
at runtime:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa10292868"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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_file_per_table<span class="token operator">=</span><span class="token keyword">ON</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="innodb-file-per-table-data-files">
</a>
File-Per-Table Tablespace Data Files
</h5>
</div>
</div>
</div>
<p>
A file-per-table tablespace is created in an
<code class="filename">
.ibd
</code>
data file in a schema directory under
the MySQL data directory. The
<code class="filename">
.ibd
</code>
file is
named for the table
(
<code class="filename">
<em class="replaceable">
<code>
table_name
</code>
</em>
.ibd
</code>
).
For example, the data file for table
<code class="literal">
test.t1
</code>
is created in the
<code class="filename">
test
</code>
directory under the
MySQL data directory:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa34238097"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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>
<span class="token prompt"> -></span> id <span class="token datatype">INT</span> <span class="token keyword">PRIMARY</span> <span class="token keyword">KEY</span> <span class="token keyword">AUTO_INCREMENT</span><span class="token punctuation">,</span>
<span class="token prompt"> -></span> <span class="token keyword">name</span> <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">100</span><span class="token punctuation">)</span>
<span class="token prompt"> -></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 prompt">mysql></span> <span class="token keyword">EXIT</span><span class="token punctuation">;</span></code></pre>
</div>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa73359084"><div class="copy-help left">Press ⌘+C to 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> /<em class="replaceable">path</em>/<em class="replaceable">to</em>/<em class="replaceable">mysql</em>/data/test
<span class="token prompt">$> </span><span class="token command">ls</span>
t1<span class="token punctuation">.</span>ibd</code></pre>
</div>
<p>
You can use the
<code class="literal">
DATA DIRECTORY
</code>
clause of the
<a class="link" href="create-table.html" title="15.1.20 CREATE TABLE Statement">
<code class="literal">
CREATE TABLE
</code>
</a>
statement to
implicitly create a file-per-table tablespace data file outside
of the data directory. For more information, see
<a class="xref" href="innodb-create-table-external.html" title="17.6.1.2 Creating Tables Externally">
Section 17.6.1.2, “Creating Tables Externally”
</a>
.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="innodb-file-per-table-advantages">
</a>
File-Per-Table Tablespace Advantages
</h5>
</div>
</div>
</div>
<p>
File-per-table tablespaces have the following advantages over
shared tablespaces such as the system tablespace or general
tablespaces.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Disk space is returned to the operating system after
truncating or dropping a table created in a file-per-table
tablespace. Truncating or dropping a table stored in a
shared tablespace creates free space within the shared
tablespace data file, which can only be used for
<code class="literal">
InnoDB
</code>
data. In other words, a shared
tablespace data file does not shrink in size after a table
is truncated or dropped.
</p>
</li>
<li class="listitem">
<p>
A table-copying
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER TABLE
</code>
</a>
operation on a table that resides in a shared tablespace can
increase the amount of disk space occupied by the
tablespace. Such operations may require as much additional
space as the data in the table plus indexes. This space is
not released back to the operating system as it is for
file-per-table tablespaces.
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="truncate-table.html" title="15.1.37 TRUNCATE TABLE Statement">
<code class="literal">
TRUNCATE TABLE
</code>
</a>
performance is
better when executed on tables that reside in file-per-table
tablespaces.
</p>
</li>
<li class="listitem">
<p>
File-per-table tablespace data files can be created on
separate storage devices for I/O optimization, space
management, or backup purposes. See
<a class="xref" href="innodb-create-table-external.html" title="17.6.1.2 Creating Tables Externally">
Section 17.6.1.2, “Creating Tables Externally”
</a>
.
</p>
</li>
<li class="listitem">
<p>
You can import a table that resides in file-per-table
tablespace from another MySQL instance. 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>
<li class="listitem">
<p>
Tables created in file-per-table tablespaces support
features associated with
<code class="literal">
DYNAMIC
</code>
and
<code class="literal">
COMPRESSED
</code>
row formats, which are not
supported by the system tablespace. See
<a class="xref" href="innodb-row-format.html" title="17.10 InnoDB Row Formats">
Section 17.10, “InnoDB Row Formats”
</a>
.
</p>
</li>
<li class="listitem">
<p>
Tables stored in individual tablespace data files can save
time and improve chances for a successful recovery when data
corruption occurs, when backups or binary logs are
unavailable, or when the MySQL server instance cannot be
restarted.
</p>
</li>
<li class="listitem">
<p>
Tables created in file-per-table tablespaces can be backed
up or restored quickly using MySQL Enterprise Backup, without interrupting the
use of other
<code class="literal">
InnoDB
</code>
tables. This is
beneficial for tables on varying backup schedules or that
require backup less frequently. See
<a class="ulink" href="/doc/mysql-enterprise-backup/8.4/en/partial.html" target="_top">
Making a Partial Backup
</a>
for details.
</p>
</li>
<li class="listitem">
<p>
File-per-table tablespaces permit monitoring table size on
the file system by monitoring the size of the tablespace
data file.
</p>
</li>
<li class="listitem">
<p>
Common Linux file systems do not permit concurrent writes to
a single file such as a shared tablespace data file when
<a class="link" href="innodb-parameters.html#sysvar_innodb_flush_method">
<code class="literal">
innodb_flush_method
</code>
</a>
is set
to
<code class="literal">
O_DIRECT
</code>
. As a result, there are
possible performance improvements when using file-per-table
tablespaces in conjunction with this setting.
</p>
</li>
<li class="listitem">
<p>
Tables in a shared tablespace are limited in size by the
64TB tablespace size limit. By comparison, each
file-per-table tablespace has a 64TB size limit, which
provides plenty of room for individual tables to grow in
size.
</p>
</li>
</ul>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="innodb-file-per-table-disadvantages">
</a>
File-Per-Table Tablespace Disadvantages
</h5>
</div>
</div>
</div>
<p>
File-per-table tablespaces have the following disadvantages
compared to shared tablespaces such as the system tablespace or
general tablespaces.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
With file-per-table tablespaces, each table may have unused
space that can only be utilized by rows of the same table,
which can lead to wasted space if not properly managed.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
fsync
</code>
operations are performed on
multiple file-per-table data files instead of a single
shared tablespace data file. Because
<code class="literal">
fsync
</code>
operations are per file, write
operations for multiple tables cannot be combined, which can
result in a higher total number of
<code class="literal">
fsync
</code>
operations.
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
must keep an open file handle for
each file-per-table tablespace, which may impact performance
if you have numerous tables in file-per-table tablespaces.
</p>
</li>
<li class="listitem">
<p>
More file descriptors are required when each table has its
own data file.
</p>
</li>
<li class="listitem">
<p>
There is potential for more fragmentation, which can impede
<a class="link" href="drop-table.html" title="15.1.32 DROP TABLE Statement">
<code class="literal">
DROP TABLE
</code>
</a>
and table scan
performance. However, if fragmentation is managed,
file-per-table tablespaces can improve performance for these
operations.
</p>
</li>
<li class="listitem">
<p>
The buffer pool is scanned when dropping a table that
resides in a file-per-table tablespace, which can take
several seconds for large buffer pools. The scan is
performed with a broad internal lock, which may delay other
operations.
</p>
</li>
<li class="listitem">
<p>
The
<a class="link" href="innodb-parameters.html#sysvar_innodb_autoextend_increment">
<code class="literal">
innodb_autoextend_increment
</code>
</a>
variable, which defines the increment size for extending the
size of an auto-extending shared tablespace file when it
becomes full, does not apply to file-per-table tablespace
files, which are auto-extending regardless of the
<a class="link" href="innodb-parameters.html#sysvar_innodb_autoextend_increment">
<code class="literal">
innodb_autoextend_increment
</code>
</a>
setting. Initial file-per-table tablespace extensions are by
small amounts, after which extensions occur in increments of
4MB.
</p>
</li>
</ul>
</div>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/do.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="do">
</a>
15.2.3 DO Statement
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045182811488">
</a>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa67072904"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">DO</span> <em class="replaceable">expr</em> <span class="token punctuation">[</span><span class="token punctuation">,</span> <em class="replaceable">expr</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>
<a class="link" href="do.html" title="15.2.3 DO Statement">
<code class="literal">
DO
</code>
</a>
executes the expressions but
does not return any results. In most respects,
<a class="link" href="do.html" title="15.2.3 DO Statement">
<code class="literal">
DO
</code>
</a>
is shorthand for
<code class="literal">
SELECT
<em class="replaceable">
<code>
expr
</code>
</em>
, ...
</code>
, but has the
advantage that it is slightly faster when you do not care about
the result.
</p>
<p>
<a class="link" href="do.html" title="15.2.3 DO Statement">
<code class="literal">
DO
</code>
</a>
is useful primarily with
functions that have side effects, such as
<a class="link" href="locking-functions.html#function_release-lock">
<code class="literal">
RELEASE_LOCK()
</code>
</a>
.
</p>
<p>
Example: This
<a class="link" href="select.html" title="15.2.13 SELECT Statement">
<code class="literal">
SELECT
</code>
</a>
statement
pauses, but also produces a result set:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa47891606"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">SLEEP</span><span class="token punctuation">(</span><span class="token number">5</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> SLEEP(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>
<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>
<span class="token output">1 row in set (5.02 sec)</span></code></pre>
</div>
<p>
<a class="link" href="do.html" title="15.2.3 DO Statement">
<code class="literal">
DO
</code>
</a>
, on the other hand, pauses
without producing a result set.:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa21997559"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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> <span class="token function">SLEEP</span><span class="token punctuation">(</span><span class="token number">5</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 0 rows affected (4.99 sec)</span></code></pre>
</div>
<p>
This could be useful, for example in a stored function or trigger,
which prohibit statements that produce result sets.
</p>
<p>
<a class="link" href="do.html" title="15.2.3 DO Statement">
<code class="literal">
DO
</code>
</a>
only executes expressions. It
cannot be used in all cases where
<code class="literal">
SELECT
</code>
can be
used. For example,
<code class="literal">
DO id FROM t1
</code>
is invalid
because it references a table.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/index-page-merge-threshold.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="index-page-merge-threshold">
</a>
17.8.11 Configuring the Merge Threshold for Index Pages
</h3>
</div>
</div>
</div>
<p>
You can configure the
<code class="literal">
MERGE_THRESHOLD
</code>
value for
index pages. If the
<span class="quote">
“
<span class="quote">
page-full
</span>
”
</span>
percentage for an
index page falls below the
<code class="literal">
MERGE_THRESHOLD
</code>
value when a row is deleted or when a row is shortened by an
<a class="link" href="update.html" title="15.2.17 UPDATE Statement">
<code class="literal">
UPDATE
</code>
</a>
operation,
<code class="literal">
InnoDB
</code>
attempts to merge the index page with a
neighboring index page. The default
<code class="literal">
MERGE_THRESHOLD
</code>
value is 50, which is the
previously hardcoded value. The minimum
<code class="literal">
MERGE_THRESHOLD
</code>
value is 1 and the maximum
value is 50.
</p>
<p>
When the
<span class="quote">
“
<span class="quote">
page-full
</span>
”
</span>
percentage for an index page
falls below 50%, which is the default
<code class="literal">
MERGE_THRESHOLD
</code>
setting,
<code class="literal">
InnoDB
</code>
attempts to merge the index page with a
neighboring page. If both pages are close to 50% full, a page
split can occur soon after the pages are merged. If this
merge-split behavior occurs frequently, it can have an adverse
affect on performance. To avoid frequent merge-splits, you can
lower the
<code class="literal">
MERGE_THRESHOLD
</code>
value so that
<code class="literal">
InnoDB
</code>
attempts page merges at a lower
<span class="quote">
“
<span class="quote">
page-full
</span>
”
</span>
percentage. Merging pages at a lower
page-full percentage leaves more room in index pages and helps
reduce merge-split behavior.
</p>
<p>
The
<code class="literal">
MERGE_THRESHOLD
</code>
for index pages can be
defined for a table or for individual indexes. A
<code class="literal">
MERGE_THRESHOLD
</code>
value defined for an individual
index takes priority over a
<code class="literal">
MERGE_THRESHOLD
</code>
value defined for the table. If undefined, the
<code class="literal">
MERGE_THRESHOLD
</code>
value defaults to 50.
</p>
<h4>
<a name="idm46045161921136">
</a>
Setting MERGE_THRESHOLD for a Table
</h4>
<p>
You can set the
<code class="literal">
MERGE_THRESHOLD
</code>
value for a
table using the
<em class="replaceable">
<code>
table_option
</code>
</em>
<code class="literal">
COMMENT
</code>
clause of the
<a class="link" href="create-table.html" title="15.1.20 CREATE TABLE Statement">
<code class="literal">
CREATE TABLE
</code>
</a>
statement. For
example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa44551888"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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>
id <span class="token datatype">INT</span><span class="token punctuation">,</span>
<span class="token keyword">KEY</span> id_index <span class="token punctuation">(</span>id<span class="token punctuation">)</span>
<span class="token punctuation">)</span> <span class="token keyword">COMMENT</span><span class="token operator">=</span><span class="token string">'MERGE_THRESHOLD=45'</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
You can also set the
<code class="literal">
MERGE_THRESHOLD
</code>
value for
an existing table using the
<em class="replaceable">
<code>
table_option
</code>
</em>
<code class="literal">
COMMENT
</code>
clause with
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER TABLE
</code>
</a>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa77746136"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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>
id <span class="token datatype">INT</span><span class="token punctuation">,</span>
<span class="token keyword">KEY</span> id_index <span class="token punctuation">(</span>id<span class="token punctuation">)</span>
<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">ALTER</span> <span class="token keyword">TABLE</span> t1 <span class="token keyword">COMMENT</span><span class="token operator">=</span><span class="token string">'MERGE_THRESHOLD=40'</span><span class="token punctuation">;</span></code></pre>
</div>
<h4>
<a name="idm46045161911328">
</a>
Setting MERGE_THRESHOLD for Individual Indexes
</h4>
<p>
To set the
<code class="literal">
MERGE_THRESHOLD
</code>
value for an
individual index, you can use the
<em class="replaceable">
<code>
index_option
</code>
</em>
<code class="literal">
COMMENT
</code>
clause with
<a class="link" href="create-table.html" title="15.1.20 CREATE TABLE Statement">
<code class="literal">
CREATE TABLE
</code>
</a>
,
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER TABLE
</code>
</a>
, or
<a class="link" href="create-index.html" title="15.1.15 CREATE INDEX Statement">
<code class="literal">
CREATE INDEX
</code>
</a>
, as shown in the
following examples:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Setting
<code class="literal">
MERGE_THRESHOLD
</code>
for an individual
index using
<a class="link" href="create-table.html" title="15.1.20 CREATE TABLE Statement">
<code class="literal">
CREATE TABLE
</code>
</a>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa60266295"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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>
id <span class="token datatype">INT</span><span class="token punctuation">,</span>
<span class="token keyword">KEY</span> id_index <span class="token punctuation">(</span>id<span class="token punctuation">)</span> <span class="token keyword">COMMENT</span> <span class="token string">'MERGE_THRESHOLD=40'</span>
<span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
Setting
<code class="literal">
MERGE_THRESHOLD
</code>
for an individual
index using
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER TABLE
</code>
</a>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa31890012"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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>
id <span class="token datatype">INT</span><span class="token punctuation">,</span>
<span class="token keyword">KEY</span> id_index <span class="token punctuation">(</span>id<span class="token punctuation">)</span>
<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">ALTER</span> <span class="token keyword">TABLE</span> t1 <span class="token keyword">DROP</span> <span class="token keyword">KEY</span> id_index<span class="token punctuation">;</span>
<span class="token keyword">ALTER</span> <span class="token keyword">TABLE</span> t1 <span class="token keyword">ADD</span> <span class="token keyword">KEY</span> id_index <span class="token punctuation">(</span>id<span class="token punctuation">)</span> <span class="token keyword">COMMENT</span> <span class="token string">'MERGE_THRESHOLD=40'</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
Setting
<code class="literal">
MERGE_THRESHOLD
</code>
for an individual
index using
<a class="link" href="create-index.html" title="15.1.15 CREATE INDEX Statement">
<code class="literal">
CREATE INDEX
</code>
</a>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa92262354"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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>id <span class="token datatype">INT</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">CREATE</span> <span class="token keyword">INDEX</span> id_index <span class="token keyword">ON</span> t1 <span class="token punctuation">(</span>id<span class="token punctuation">)</span> <span class="token keyword">COMMENT</span> <span class="token string">'MERGE_THRESHOLD=40'</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
</ul>
</div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
You cannot modify the
<code class="literal">
MERGE_THRESHOLD
</code>
value
at the index level for
<code class="literal">
GEN_CLUST_INDEX
</code>
, which
is the clustered index created by
<code class="literal">
InnoDB
</code>
when
an
<code class="literal">
InnoDB
</code>
table is created without a primary
key or unique key index. You can only modify the
<code class="literal">
MERGE_THRESHOLD
</code>
value for
<code class="literal">
GEN_CLUST_INDEX
</code>
by setting
<code class="literal">
MERGE_THRESHOLD
</code>
for the table.
</p>
</div>
<h4>
<a name="idm46045161886736">
</a>
Querying the MERGE_THRESHOLD Value for an Index
</h4>
<p>
The current
<code class="literal">
MERGE_THRESHOLD
</code>
value for an index
can be obtained by querying the
<a class="link" href="information-schema-innodb-indexes-table.html" title="28.4.20 The INFORMATION_SCHEMA INNODB_INDEXES Table">
<code class="literal">
INNODB_INDEXES
</code>
</a>
table. For example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa50025705"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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_INDEXES <span class="token keyword">WHERE</span> <span class="token keyword">NAME</span><span class="token operator">=</span><span class="token string">'id_index'</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>
INDEX_ID<span class="token punctuation">:</span> 91
NAME<span class="token punctuation">:</span> id_index
TABLE_ID<span class="token punctuation">:</span> 68
TYPE<span class="token punctuation">:</span> 0
N_FIELDS<span class="token punctuation">:</span> 1
PAGE_NO<span class="token punctuation">:</span> 4
SPACE<span class="token punctuation">:</span> 57
MERGE_THRESHOLD<span class="token punctuation">:</span> 40</span></code></pre>
</div>
<p>
You can use
<a class="link" href="show-create-table.html" title="15.7.7.11 SHOW CREATE TABLE Statement">
<code class="literal">
SHOW CREATE TABLE
</code>
</a>
to
view the
<code class="literal">
MERGE_THRESHOLD
</code>
value for a table, if
explicitly defined using the
<em class="replaceable">
<code>
table_option
</code>
</em>
<code class="literal">
COMMENT
</code>
clause:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa97733350"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">CREATE</span> <span class="token keyword">TABLE</span> t2 \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> t2
Create Table<span class="token punctuation">:</span> CREATE TABLE `t2` (
`id` int(11) DEFAULT NULL,
KEY `id_index` (`id`) COMMENT 'MERGE_THRESHOLD=40'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci</span></code></pre>
</div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
A
<code class="literal">
MERGE_THRESHOLD
</code>
value defined at the index
level takes priority over a
<code class="literal">
MERGE_THRESHOLD
</code>
value defined for the table. If undefined,
<code class="literal">
MERGE_THRESHOLD
</code>
defaults to 50%
(
<code class="literal">
MERGE_THRESHOLD=50
</code>
, which is the previously
hardcoded value.
</p>
</div>
<p>
Likewise, you can use
<a class="link" href="show-index.html" title="15.7.7.23 SHOW INDEX Statement">
<code class="literal">
SHOW INDEX
</code>
</a>
to
view the
<code class="literal">
MERGE_THRESHOLD
</code>
value for an index, if
explicitly defined using the
<em class="replaceable">
<code>
index_option
</code>
</em>
<code class="literal">
COMMENT
</code>
clause:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa86304780"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">INDEX</span> <span class="token keyword">FROM</span> t2 \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> t2
Non_unique<span class="token punctuation">:</span> 1
Key_name<span class="token punctuation">:</span> id_index
Seq_in_index<span class="token punctuation">:</span> 1
Column_name<span class="token punctuation">:</span> id
Collation<span class="token punctuation">:</span> A
Cardinality<span class="token punctuation">:</span> 0
Sub_part<span class="token punctuation">:</span> NULL
Packed<span class="token punctuation">:</span> NULL
Null<span class="token punctuation">:</span> YES
Index_type<span class="token punctuation">:</span> BTREE
Comment<span class="token punctuation">:</span>
Index_comment<span class="token punctuation">:</span> MERGE_THRESHOLD=40</span></code></pre>
</div>
<h4>
<a name="idm46045161866784">
</a>
Measuring the Effect of MERGE_THRESHOLD Settings
</h4>
<p>
The
<a class="link" href="information-schema-innodb-metrics-table.html" title="28.4.21 The INFORMATION_SCHEMA INNODB_METRICS Table">
<code class="literal">
INNODB_METRICS
</code>
</a>
table provides two
counters that can be used to measure the effect of a
<code class="literal">
MERGE_THRESHOLD
</code>
setting on index page merges.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa44911639"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">COMMENT</span> <span class="token keyword">FROM</span> INFORMATION_SCHEMA<span class="token punctuation">.</span>INNODB_METRICS
<span class="token keyword">WHERE</span> <span class="token keyword">NAME</span> <span class="token operator">like</span> <span class="token string">'%index_page_merge%'</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>
<span class="token output"><span class="token punctuation">|</span> NAME <span class="token punctuation">|</span> COMMENT <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> index_page_merge_attempts <span class="token punctuation">|</span> Number of index page merge attempts <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> index_page_merge_successful <span class="token punctuation">|</span> Number of successful index page merges <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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 lowering the
<code class="literal">
MERGE_THRESHOLD
</code>
value, the
objectives are:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
A smaller number of page merge attempts and successful page
merges
</p>
</li>
<li class="listitem">
<p>
A similar number of page merge attempts and successful page
merges
</p>
</li>
</ul>
</div>
<p>
A
<code class="literal">
MERGE_THRESHOLD
</code>
setting that is too small
could result in large data files due to an excessive amount of
empty page space.
</p>
<p>
For information about using
<a class="link" href="information-schema-innodb-metrics-table.html" title="28.4.21 The INFORMATION_SCHEMA INNODB_METRICS Table">
<code class="literal">
INNODB_METRICS
</code>
</a>
counters, see
<a class="xref" href="innodb-information-schema-metrics-table.html" title="17.15.6 InnoDB INFORMATION_SCHEMA Metrics Table">
Section 17.15.6, “InnoDB INFORMATION_SCHEMA Metrics Table”
</a>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/federated-description.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="federated-description">
</a>
18.8.1 FEDERATED Storage Engine Overview
</h3>
</div>
</div>
</div>
<p>
When you create a table using one of the standard storage engines
(such as
<code class="literal">
MyISAM
</code>
,
<code class="literal">
CSV
</code>
or
<code class="literal">
InnoDB
</code>
), the table consists of the table
definition and the associated data. When you create a
<code class="literal">
FEDERATED
</code>
table, the table definition is the
same, but the physical storage of the data is handled on a remote
server.
</p>
<p>
A
<code class="literal">
FEDERATED
</code>
table consists of two elements:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
A
<span class="emphasis">
<em>
remote server
</em>
</span>
with a database table,
which in turn consists of the table definition (stored in the
MySQL data dictionary) and the associated table. The table
type of the remote table may be any type supported by the
remote
<code class="literal">
mysqld
</code>
server, including
<code class="literal">
MyISAM
</code>
or
<code class="literal">
InnoDB
</code>
.
</p>
</li>
<li class="listitem">
<p>
A
<span class="emphasis">
<em>
local server
</em>
</span>
with a database table,
where the table definition matches that of the corresponding
table on the remote server. The table definition is stored in
the data dictionary. There is no data file on the local
server. Instead, the table definition includes a connection
string that points to the remote table.
</p>
</li>
</ul>
</div>
<p>
When executing queries and statements on a
<code class="literal">
FEDERATED
</code>
table on the local server, the
operations that would normally insert, update or delete
information from a local data file are instead sent to the remote
server for execution, where they update the data file on the
remote server or return matching rows from the remote server.
</p>
<p>
The basic structure of a
<code class="literal">
FEDERATED
</code>
table setup
is shown in
<a class="xref" href="federated-description.html#figure-se-federated-structure" title="Figure 18.2 FEDERATED Table Structure">
Figure 18.2, “FEDERATED Table Structure”
</a>
.
</p>
<div class="figure">
<a name="figure-se-federated-structure">
</a>
<p class="title">
<b>
Figure 18.2 FEDERATED Table Structure
</b>
</p>
<div class="figure-contents">
<div class="mediaobject">
<img alt="Content is described in the surrounding text." src="images/se-federated-structure.png" style="width: 100%; max-width: 384px;"/>
</div>
</div>
</div>
<br class="figure-break"/>
<p>
When a client issues an SQL statement that refers to a
<code class="literal">
FEDERATED
</code>
table, the flow of information
between the local server (where the SQL statement is executed) and
the remote server (where the data is physically stored) is as
follows:
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
The storage engine looks through each column that the
<code class="literal">
FEDERATED
</code>
table has and constructs an
appropriate SQL statement that refers to the remote table.
</p>
</li>
<li class="listitem">
<p>
The statement is sent to the remote server using the MySQL
client API.
</p>
</li>
<li class="listitem">
<p>
The remote server processes the statement and the local server
retrieves any result that the statement produces (an
affected-rows count or a result set).
</p>
</li>
<li class="listitem">
<p>
If the statement produces a result set, each column is
converted to internal storage engine format that the
<code class="literal">
FEDERATED
</code>
engine expects and can use to
display the result to the client that issued the original
statement.
</p>
</li>
</ol>
</div>
<p>
The local server communicates with the remote server using MySQL
client C API functions. It invokes
<a class="ulink" href="/doc/c-api/8.4/en/mysql-real-query.html" target="_top">
<code class="literal">
mysql_real_query()
</code>
</a>
to send the
statement. To read a result set, it uses
<a class="ulink" href="/doc/c-api/8.4/en/mysql-store-result.html" target="_top">
<code class="literal">
mysql_store_result()
</code>
</a>
and fetches
rows one at a time using
<a class="ulink" href="/doc/c-api/8.4/en/mysql-fetch-row.html" target="_top">
<code class="literal">
mysql_fetch_row()
</code>
</a>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/mysql-cluster-ndbinfo-dict-obj-info.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="mysql-cluster-ndbinfo-dict-obj-info">
</a>
25.6.17.25 The ndbinfo dict_obj_info Table
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045089672720">
</a>
<p>
The
<code class="literal">
dict_obj_info
</code>
table provides information
about
<code class="literal">
NDB
</code>
data dictionary
(
<a class="ulink" href="/doc/ndb-internals/en/ndb-internals-kernel-blocks-dbdict.html" target="_top">
<code class="literal">
DICT
</code>
</a>
) objects such as
tables and indexes. (The
<a class="link" href="mysql-cluster-ndbinfo-dict-obj-types.html" title="25.6.17.27 The ndbinfo dict_obj_types Table">
<code class="literal">
dict_obj_types
</code>
</a>
table can be
queried for a list of all the types.) This information includes
the object's type, state, parent object (if any), and fully
qualified name.
</p>
<p>
The
<code class="literal">
dict_obj_info
</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">
type
</code>
</p>
<p>
Type of
<a class="ulink" href="/doc/ndb-internals/en/ndb-internals-kernel-blocks-dbdict.html" target="_top">
<code class="literal">
DICT
</code>
</a>
object;
join on
<a class="link" href="mysql-cluster-ndbinfo-dict-obj-types.html" title="25.6.17.27 The ndbinfo dict_obj_types Table">
<code class="literal">
dict_obj_types
</code>
</a>
to
obtain the name
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
id
</code>
</p>
<p>
Object identifier; for Disk Data undo log files and data
files, this is the same as the value shown in the
<code class="literal">
LOGFILE_GROUP_NUMBER
</code>
column 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;
for undo log files, it also the same as the value shown for
the
<code class="literal">
log_id
</code>
column in the
<code class="literal">
ndbinfo
</code>
<a class="link" href="mysql-cluster-ndbinfo-logbuffers.html" title="25.6.17.43 The ndbinfo logbuffers Table">
<code class="literal">
logbuffers
</code>
</a>
and
<a class="link" href="mysql-cluster-ndbinfo-logspaces.html" title="25.6.17.44 The ndbinfo logspaces Table">
<code class="literal">
logspaces
</code>
</a>
tables
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
version
</code>
</p>
<p>
Object version
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
state
</code>
</p>
<p>
Object state; see
<a class="ulink" href="/doc/ndbapi/en/ndb-object.html#ndb-object-state" target="_top">
Object::State
</a>
for
values and descriptions.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
parent_obj_type
</code>
</p>
<p>
Parent object's type (a
<code class="literal">
dict_obj_types
</code>
type ID); 0 indicates that
the object has no parent
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
parent_obj_id
</code>
</p>
<p>
Parent object ID (such as a base table); 0 indicates that
the object has no parent
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
fq_name
</code>
</p>
<p>
Fully qualified object name; for a table, this has the form
<code class="literal">
<em class="replaceable">
<code>
database_name
</code>
</em>
/def/
<em class="replaceable">
<code>
table_name
</code>
</em>
</code>
,
for a primary key, the form is
<code class="literal">
sys/def/
<em class="replaceable">
<code>
table_id
</code>
</em>
/PRIMARY
</code>
,
and for a unique key it is
<code class="literal">
sys/def/
<em class="replaceable">
<code>
table_id
</code>
</em>
/
<em class="replaceable">
<code>
uk_name
</code>
</em>
$unique
</code>
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/information-schema-innodb-ft-config-table.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="information-schema-innodb-ft-config-table">
</a>
28.4.15 The INFORMATION_SCHEMA INNODB_FT_CONFIG Table
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045076930576">
</a>
<p>
The
<a class="link" href="information-schema-innodb-ft-config-table.html" title="28.4.15 The INFORMATION_SCHEMA INNODB_FT_CONFIG Table">
<code class="literal">
INNODB_FT_CONFIG
</code>
</a>
table provides
metadata about the
<code class="literal">
FULLTEXT
</code>
index and
associated processing for an
<code class="literal">
InnoDB
</code>
table.
</p>
<p>
This table is empty initially. Before querying it, set the value
of the
<a class="link" href="innodb-parameters.html#sysvar_innodb_ft_aux_table">
<code class="literal">
innodb_ft_aux_table
</code>
</a>
system
variable to the name (including the database name) of the table
that contains the
<code class="literal">
FULLTEXT
</code>
index (for example,
<code class="literal">
test/articles
</code>
).
</p>
<p>
For related usage information and examples, see
<a class="xref" href="innodb-information-schema-fulltext_index-tables.html" title="17.15.4 InnoDB INFORMATION_SCHEMA FULLTEXT Index Tables">
Section 17.15.4, “InnoDB INFORMATION_SCHEMA FULLTEXT Index Tables”
</a>
.
</p>
<p>
The
<a class="link" href="information-schema-innodb-ft-config-table.html" title="28.4.15 The INFORMATION_SCHEMA INNODB_FT_CONFIG Table">
<code class="literal">
INNODB_FT_CONFIG
</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">
KEY
</code>
</p>
<p>
The name designating an item of metadata for an
<code class="literal">
InnoDB
</code>
table containing a
<code class="literal">
FULLTEXT
</code>
index.
</p>
<p>
The values for this column might change, depending on the
needs for performance tuning and debugging for
<code class="literal">
InnoDB
</code>
full-text processing. The key names
and their meanings include:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<code class="literal">
optimize_checkpoint_limit
</code>
: The number
of seconds after which an
<a class="link" href="optimize-table.html" title="15.7.3.4 OPTIMIZE TABLE Statement">
<code class="literal">
OPTIMIZE
TABLE
</code>
</a>
run stops.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
synced_doc_id
</code>
: The next
<code class="literal">
DOC_ID
</code>
to be issued.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
stopword_table_name
</code>
: The
<em class="replaceable">
<code>
database/table
</code>
</em>
name for a
user-defined stopword table. The
<code class="literal">
VALUE
</code>
column is empty if there is no user-defined stopword
table.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
use_stopword
</code>
: Indicates whether a
stopword table is used, which is defined when the
<code class="literal">
FULLTEXT
</code>
index is created.
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
<code class="literal">
VALUE
</code>
</p>
<p>
The value associated with the corresponding
<code class="literal">
KEY
</code>
column, reflecting some limit or
current value for an aspect of a
<code class="literal">
FULLTEXT
</code>
index for an
<code class="literal">
InnoDB
</code>
table.
</p>
</li>
</ul>
</div>
<h4>
<a name="idm46045076899952">
</a>
Example
</h4>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa71628088"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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_FT_CONFIG<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> KEY <span class="token punctuation">|</span> VALUE <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> optimize_checkpoint_limit <span class="token punctuation">|</span> 180 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> synced_doc_id <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> stopword_table_name <span class="token punctuation">|</span> test/my_stopwords <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> use_stopword <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></code></pre>
</div>
<h4>
<a name="idm46045076897200">
</a>
Notes
</h4>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
This table is intended only for internal configuration. It is
not intended for statistical information purposes.
</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 more information about
<code class="literal">
InnoDB
</code>
<code class="literal">
FULLTEXT
</code>
search, see
<a class="xref" href="innodb-fulltext-index.html" title="17.6.2.4 InnoDB Full-Text Indexes">
Section 17.6.2.4, “InnoDB Full-Text Indexes”
</a>
, and
<a class="xref" href="fulltext-search.html" title="14.9 Full-Text Search Functions">
Section 14.9, “Full-Text Search Functions”
</a>
.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/thread-pool-elements.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="thread-pool-elements">
</a>
7.6.3.1 Thread Pool Elements
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045256857264">
</a>
<p>
MySQL Enterprise Thread Pool comprises these elements:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
A plugin library file implements a plugin for the thread
pool code as well as several associated monitoring tables
that provide information about thread pool operation:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
In MySQL 8.4, the monitoring tables are
Performance Schema tables; see
<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>
In older versions of MySQL, the monitoring tables were
<code class="literal">
INFORMATION_SCHEMA
</code>
tables (see
<a class="xref" href="thread-pool-information-schema-tables.html" title="28.5 INFORMATION_SCHEMA Thread Pool Tables">
Section 28.5, “INFORMATION_SCHEMA Thread Pool Tables”
</a>
).
The
<code class="literal">
INFORMATION_SCHEMA
</code>
tables are
deprecated; expect them to be removed in a future
version of MySQL. Applications should transition away
from the
<code class="literal">
INFORMATION_SCHEMA
</code>
tables to
the Performance Schema tables. For example, if an
application uses this query:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa36939135"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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> INFORMATION_SCHEMA<span class="token punctuation">.</span>TP_THREAD_STATE<span class="token punctuation">;</span></code></pre>
</div>
<p>
The application should use this query instead:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa66787753"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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> performance_schema<span class="token punctuation">.</span>tp_thread_state<span class="token punctuation">;</span></code></pre>
</div>
</li>
</ul>
</div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
If you do not load all the monitoring tables, some or all
MySQL Enterprise Monitor thread pool graphs may be empty.
</p>
</div>
<p>
For a detailed description of how the thread pool works, see
<a class="xref" href="thread-pool-operation.html" title="7.6.3.3 Thread Pool Operation">
Section 7.6.3.3, “Thread Pool Operation”
</a>
.
</p>
</li>
<li class="listitem">
<p>
Several system variables are related to the thread pool. The
<a class="link" href="server-system-variables.html#sysvar_thread_handling">
<code class="literal">
thread_handling
</code>
</a>
system
variable has a value of
<code class="literal">
loaded-dynamically
</code>
when the server
successfully loads the thread pool plugin.
</p>
<p>
The other related system variables are implemented by the
thread pool plugin and are not available unless it is
enabled. For information about using these variables, see
<a class="xref" href="thread-pool-operation.html" title="7.6.3.3 Thread Pool Operation">
Section 7.6.3.3, “Thread Pool Operation”
</a>
, and
<a class="xref" href="thread-pool-tuning.html" title="7.6.3.4 Thread Pool Tuning">
Section 7.6.3.4, “Thread Pool Tuning”
</a>
.
</p>
</li>
<li class="listitem">
<p>
The Performance Schema has instruments that expose
information about the thread pool and may be used to
investigate operational performance. To identify them, use
this query:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa63151090"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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> performance_schema<span class="token punctuation">.</span>setup_instruments
<span class="token keyword">WHERE</span> <span class="token keyword">NAME</span> <span class="token operator">LIKE</span> <span class="token string">'%thread_pool%'</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
For more information, see
<a class="xref" href="performance-schema.html" title="Chapter 29 MySQL Performance Schema">
Chapter 29,
<i>
MySQL Performance Schema
</i>
</a>
.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/mysqlbinlog-hexdump.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="mysqlbinlog-hexdump">
</a>
6.6.9.1 mysqlbinlog Hex Dump Format
</h4>
</div>
</div>
</div>
<p>
The
<a class="link" href="mysqlbinlog.html#option_mysqlbinlog_hexdump">
<code class="option">
--hexdump
</code>
</a>
option causes
<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>
to produce a hex dump of the
binary log contents:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa17215586"><div class="copy-help left">Press ⌘+C to 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">mysqlbinlog <span class="token property">--hexdump</span> source-bin<span class="token punctuation">.</span>000001</code></pre>
</div>
<p>
The hex output consists of comment lines beginning with
<code class="literal">
#
</code>
, so the output might look like this for the
preceding command:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa96387263"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">/*!40019 SET @@SESSION.max_insert_delayed_threads=0*/</span><span class="token punctuation">;</span>
<span class="token comment" spellcheck="true">/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/</span><span class="token punctuation">;</span>
<span class="token comment" spellcheck="true"># at 4</span>
<span class="token comment" spellcheck="true">#051024 17:24:13 server id 1 end_log_pos 98</span>
<span class="token comment" spellcheck="true"># Position Timestamp Type Master ID Size Master Pos Flags</span>
<span class="token comment" spellcheck="true"># 00000004 9d fc 5c 43 0f 01 00 00 00 5e 00 00 00 62 00 00 00 00 00</span>
<span class="token comment" spellcheck="true"># 00000017 04 00 35 2e 30 2e 31 35 2d 64 65 62 75 67 2d 6c |..5.0.15.debug.l|</span>
<span class="token comment" spellcheck="true"># 00000027 6f 67 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |og..............|</span>
<span class="token comment" spellcheck="true"># 00000037 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|</span>
<span class="token comment" spellcheck="true"># 00000047 00 00 00 00 9d fc 5c 43 13 38 0d 00 08 00 12 00 |.......C.8......|</span>
<span class="token comment" spellcheck="true"># 00000057 04 04 04 04 12 00 00 4b 00 04 1a |.......K...|</span>
<span class="token comment" spellcheck="true"># Start: binlog v 4, server v 5.0.15-debug-log created 051024 17:24:13</span>
<span class="token comment" spellcheck="true"># at startup</span>
<span class="token keyword">ROLLBACK</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
Hex dump output currently contains the elements in the following
list. This format is subject to change. For more information
about binary log format, see
<a class="ulink" href="/doc/internals/en/binary-log.html" target="_top">
MySQL
Internals: The Binary Log
</a>
.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
Position
</code>
: The byte position within the
log file.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
Timestamp
</code>
: The event timestamp. In the
example shown,
<code class="literal">
'9d fc 5c 43'
</code>
is the
representation of
<code class="literal">
'051024 17:24:13'
</code>
in
hexadecimal.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
Type
</code>
: The event type code.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
Master ID
</code>
: The server ID of the
replication source server that created the event.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
Size
</code>
: The size in bytes of the event.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
Master Pos
</code>
: The position of the next
event in the original source's binary log file.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
Flags
</code>
: Event flag values.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/innodb-deadlock-detection.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="innodb-deadlock-detection">
</a>
17.7.5.2 Deadlock Detection
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045163763152">
</a>
<a class="indexterm" name="idm46045163761664">
</a>
<a class="indexterm" name="idm46045163760592">
</a>
<a class="indexterm" name="idm46045163759104">
</a>
<a class="indexterm" name="idm46045163757200">
</a>
<a class="indexterm" name="idm46045163755712">
</a>
<p>
When
<a class="link" href="glossary.html#glos_deadlock_detection" title="deadlock detection">
deadlock
detection
</a>
is enabled (the default),
<code class="literal">
InnoDB
</code>
automatically detects transaction
<a class="link" href="glossary.html#glos_deadlock" title="deadlock">
deadlocks
</a>
and rolls back a
transaction or transactions to break the deadlock.
<code class="literal">
InnoDB
</code>
tries to pick small transactions to
roll back, where the size of a transaction is determined by the
number of rows inserted, updated, or deleted.
</p>
<p>
<code class="literal">
InnoDB
</code>
is aware of table locks if
<code class="literal">
innodb_table_locks = 1
</code>
(the default) and
<a class="link" href="server-system-variables.html#sysvar_autocommit">
<code class="literal">
autocommit = 0
</code>
</a>
, and the MySQL
layer above it knows about row-level locks. Otherwise,
<code class="literal">
InnoDB
</code>
cannot detect deadlocks where a table
lock set by a MySQL
<a class="link" href="lock-tables.html" title="15.3.6 LOCK TABLES and UNLOCK TABLES Statements">
<code class="literal">
LOCK TABLES
</code>
</a>
statement or a lock set by a storage engine other than
<code class="literal">
InnoDB
</code>
is involved. Resolve these situations
by setting the value of the
<a class="link" href="innodb-parameters.html#sysvar_innodb_lock_wait_timeout">
<code class="literal">
innodb_lock_wait_timeout
</code>
</a>
system
variable.
</p>
<p>
If the
<code class="literal">
LATEST DETECTED DEADLOCK
</code>
section of
<code class="literal">
InnoDB
</code>
Monitor output includes a message
stating
<span class="errortext">
TOO DEEP OR LONG SEARCH IN THE LOCK TABLE
WAITS-FOR GRAPH, WE WILL ROLL BACK FOLLOWING
TRANSACTION
</span>
, this indicates that the number of
transactions on the wait-for list has reached a limit of 200. A
wait-for list that exceeds 200 transactions is treated as a
deadlock and the transaction attempting to check the wait-for
list is rolled back. The same error may also occur if the
locking thread must look at more than 1,000,000 locks owned by
transactions on the wait-for list.
</p>
<p>
For techniques to organize database operations to avoid
deadlocks, see
<a class="xref" href="innodb-deadlocks.html" title="17.7.5 Deadlocks in InnoDB">
Section 17.7.5, “Deadlocks in InnoDB”
</a>
.
</p>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="innodb-disable-deadlock-detection">
</a>
Disabling Deadlock Detection
</h5>
</div>
</div>
</div>
<p>
On high concurrency systems, deadlock detection can cause a
slowdown when numerous threads wait for the same lock. At
times, it may be more efficient to disable deadlock detection
and rely on the
<a class="link" href="innodb-parameters.html#sysvar_innodb_lock_wait_timeout">
<code class="literal">
innodb_lock_wait_timeout
</code>
</a>
setting for transaction rollback when a deadlock occurs.
Deadlock detection can be disabled using the
<a class="link" href="innodb-parameters.html#sysvar_innodb_deadlock_detect">
<code class="literal">
innodb_deadlock_detect
</code>
</a>
variable.
</p>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/innodb-online-ddl.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title">
<a name="innodb-online-ddl">
</a>
17.12 InnoDB and Online DDL
</h2>
</div>
</div>
</div>
<div class="toc">
<dl class="toc">
<dt>
<span class="section">
<a href="innodb-online-ddl-operations.html">
17.12.1 Online DDL Operations
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-online-ddl-performance.html">
17.12.2 Online DDL Performance and Concurrency
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-online-ddl-space-requirements.html">
17.12.3 Online DDL Space Requirements
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="online-ddl-memory-management.html">
17.12.4 Online DDL Memory Management
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="online-ddl-parallel-thread-configuration.html">
17.12.5 Configuring Parallel Threads for Online DDL Operations
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-online-ddl-single-multi.html">
17.12.6 Simplifying DDL Statements with Online DDL
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-online-ddl-failure-conditions.html">
17.12.7 Online DDL Failure Conditions
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="innodb-online-ddl-limitations.html">
17.12.8 Online DDL Limitations
</a>
</span>
</dt>
</dl>
</div>
<a class="indexterm" name="idm46045160573136">
</a>
<a class="indexterm" name="idm46045160572064">
</a>
<p>
The online DDL feature provides support for instant and in-place
table alterations and concurrent DML. Benefits of this feature
include:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Improved responsiveness and availability in busy production
environments, where making a table unavailable for minutes or
hours is not practical.
</p>
</li>
<li class="listitem">
<p>
For in-place operations, the ability to adjust the balance
between performance and concurrency during DDL operations using
the
<code class="literal">
LOCK
</code>
clause. See
<a class="xref" href="innodb-online-ddl-performance.html#innodb-online-ddl-locking-options" title="The LOCK clause">
The LOCK clause
</a>
.
</p>
</li>
<li class="listitem">
<p>
Less disk space usage and I/O overhead than the table-copy
method.
</p>
</li>
</ul>
</div>
<p>
Typically, you do not need to do anything special to enable online
DDL. By default, MySQL performs the operation instantly or in place,
as permitted, with as little locking as possible.
</p>
<p>
You can control aspects of a DDL operation using the
<code class="literal">
ALGORITHM
</code>
and
<code class="literal">
LOCK
</code>
clauses of
the
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER TABLE
</code>
</a>
statement. These
clauses are placed at the end of the statement, separated from the
table and column specifications by commas. For example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa61546769"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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> <em class="replaceable">tbl_name</em> <span class="token keyword">ADD</span> <span class="token keyword">PRIMARY</span> <span class="token keyword">KEY</span> <span class="token punctuation">(</span><span class="token keyword"><em class="replaceable">column</em></span><span class="token punctuation">)</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></code></pre>
</div>
<p>
The
<code class="literal">
LOCK
</code>
clause may be used for operations that
are performed in place and is useful for fine-tuning the degree of
concurrent access to the table during operations. Only
<code class="literal">
LOCK=DEFAULT
</code>
is supported for operations that are
performed instantly. The
<code class="literal">
ALGORITHM
</code>
clause is
primarily intended for performance comparisons and as a fallback to
the older table-copying behavior in case you encounter any issues.
For example:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
To avoid accidentally making the table unavailable for reads,
writes, or both, during an in-place
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER
TABLE
</code>
</a>
operation, specify a clause on the
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER TABLE
</code>
</a>
statement such as
<code class="literal">
LOCK=NONE
</code>
(permit reads and writes) or
<code class="literal">
LOCK=SHARED
</code>
(permit reads). The operation
halts immediately if the requested level of concurrency is not
available.
</p>
</li>
<li class="listitem">
<p>
To compare performance between algorithms, run a statement with
<code class="literal">
ALGORITHM=INSTANT
</code>
,
<code class="literal">
ALGORITHM=INPLACE
</code>
and
<code class="literal">
ALGORITHM=COPY
</code>
. You can also run a statement
with the
<a class="link" href="server-system-variables.html#sysvar_old_alter_table">
<code class="literal">
old_alter_table
</code>
</a>
configuration option enabled to force the use of
<code class="literal">
ALGORITHM=COPY
</code>
.
</p>
</li>
<li class="listitem">
<p>
To avoid tying up the server with an
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER
TABLE
</code>
</a>
operation that copies the table, include
<code class="literal">
ALGORITHM=INSTANT
</code>
or
<code class="literal">
ALGORITHM=INPLACE
</code>
. The statement halts
immediately if it cannot use the specified algorithm.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/clone-plugin-compressed-data.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="clone-plugin-compressed-data">
</a>
7.6.7.6 Cloning Compressed Data
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045255409888">
</a>
<p>
Cloning of page-compressed data is supported. The following
requirements apply when cloning remote data:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
The recipient file system must support sparse files and hole
punching for hole punching to occur on the recipient.
</p>
</li>
<li class="listitem">
<p>
The donor and recipient file systems must have the same
block size. If file system block sizes differ, an error
similar to the following is reported:
<span class="errortext">
ERROR 3868
(HY000): Clone Configuration FS Block Size: Donor value:
114688 is different from Recipient value: 4096
</span>
.
</p>
</li>
</ul>
</div>
<p>
For information about the page compression feature, see
<a class="xref" href="innodb-page-compression.html" title="17.9.2 InnoDB Page Compression">
Section 17.9.2, “InnoDB Page Compression”
</a>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/apis-ruby-mysqlruby.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="apis-ruby-mysqlruby">
</a>
31.11.1 The MySQL/Ruby API
</h3>
</div>
</div>
</div>
<p>
The MySQL/Ruby module provides access to MySQL databases using
Ruby through
<code class="literal">
libmysqlclient
</code>
.
</p>
<p>
For information on installing the module, and the functions
exposed, see
<a class="ulink" href="http://tmtm.org/en/mysql/ruby/" target="_blank">
MySQL/Ruby
</a>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/faqs-virtualization.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title">
<a name="faqs-virtualization">
</a>
A.18 MySQL 8.4 FAQ: Virtualization Support
</h2>
</div>
</div>
</div>
<a class="indexterm" name="idm46045054794736">
</a>
<div class="qandaset">
<a name="idm46045054793280">
</a>
<dl>
<dt>
A.18.1.
<a href="faqs-virtualization.html#faq-virtualization-support">
Is MySQL supported on virtualized environments such as Oracle
VM, VMWare, Docker, Microsoft Hyper-V, or others?
</a>
</dt>
</dl>
<table border="0" style="width: 100%;">
<colgroup>
<col align="left" width="1%"/>
<col/>
</colgroup>
<tbody>
<tr class="question">
<td align="left" valign="top">
<a name="faq-virtualization-support">
</a>
<a name="idm46045054792464">
</a>
<p>
<b>
A.18.1.
</b>
</p>
</td>
<td align="left" valign="top">
<p>
Is MySQL supported on virtualized environments such as Oracle
VM, VMWare, Docker, Microsoft Hyper-V, or others?
</p>
</td>
</tr>
<tr class="answer">
<td align="left" valign="top">
</td>
<td align="left" valign="top">
<p>
MySQL is supported on virtualized environments, but is certified
only for
<a class="ulink" href="http://www.oracle.com/technetwork/server-storage/vm/index.html" target="_blank">
Oracle
VM
</a>
. Contact Oracle Support for more information.
</p>
<p>
Be aware of potential problems when using virtualization
software. The usual ones are related to performance, performance
degradations, slowness, or unpredictability of disk, I/O,
network, and memory.
</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/reset.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="reset">
</a>
15.7.8.6 RESET Statement
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045168375264">
</a>
<a class="indexterm" name="idm46045168374176">
</a>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa39287278"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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>
<em class="replaceable">reset_option</em>: {
<span class="token datatype">BINARY</span> <span class="token keyword">LOGS</span> <span class="token operator">AND</span> GTIDS
<span class="token operator">|</span> <span class="token keyword">REPLICA</span>
}</code></pre>
</div>
<p>
The
<a class="link" href="reset.html" title="15.7.8.6 RESET Statement">
<code class="literal">
RESET
</code>
</a>
statement is used to
clear the state of various server operations. You must have the
<a class="link" href="privileges-provided.html#priv_reload">
<code class="literal">
RELOAD
</code>
</a>
privilege to execute
<a class="link" href="reset.html" title="15.7.8.6 RESET Statement">
<code class="literal">
RESET
</code>
</a>
.
</p>
<p>
For information about the
<a class="link" href="reset-persist.html" title="15.7.8.7 RESET PERSIST Statement">
<code class="literal">
RESET
PERSIST
</code>
</a>
statement that removes persisted global system
variables, see
<a class="xref" href="reset-persist.html" title="15.7.8.7 RESET PERSIST Statement">
Section 15.7.8.7, “RESET PERSIST Statement”
</a>
.
</p>
<p>
<a class="link" href="reset.html" title="15.7.8.6 RESET Statement">
<code class="literal">
RESET
</code>
</a>
acts as a stronger version
of the
<a class="link" href="flush.html" title="15.7.8.3 FLUSH Statement">
<code class="literal">
FLUSH
</code>
</a>
statement. See
<a class="xref" href="flush.html" title="15.7.8.3 FLUSH Statement">
Section 15.7.8.3, “FLUSH Statement”
</a>
.
</p>
<p>
The
<a class="link" href="reset.html" title="15.7.8.6 RESET Statement">
<code class="literal">
RESET
</code>
</a>
statement causes an
implicit commit. See
<a class="xref" href="implicit-commit.html" title="15.3.3 Statements That Cause an Implicit Commit">
Section 15.3.3, “Statements That Cause an Implicit Commit”
</a>
.
</p>
<p>
The following list describes the permitted
<a class="link" href="reset.html" title="15.7.8.6 RESET Statement">
<code class="literal">
RESET
</code>
</a>
statement
<em class="replaceable">
<code>
reset_option
</code>
</em>
values:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="link" href="reset-binary-logs-and-gtids.html" title="15.4.1.2 RESET BINARY LOGS AND GTIDS Statement">
<code class="literal">
RESET BINARY LOGS AND GTIDS
</code>
</a>
</p>
<p>
Deletes all binary logs listed in the index file, resets the
binary log index file to be empty, and creates a new binary
log file.
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="reset-replica.html" title="15.4.2.3 RESET REPLICA Statement">
<code class="literal">
RESET
REPLICA
</code>
</a>
</p>
<p>
Makes the replica forget its replication position in the
source binary logs. Also resets the relay log by deleting
any existing relay log files and beginning a new one.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/firewall-information-schema-tables.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title">
<a name="firewall-information-schema-tables">
</a>
28.7 INFORMATION_SCHEMA MySQL Enterprise Firewall Tables
</h2>
</div>
</div>
</div>
<div class="toc">
<dl class="toc">
<dt>
<span class="section">
<a href="information-schema-firewall-table-reference.html">
28.7.1 INFORMATION_SCHEMA Firewall Table Reference
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-mysql-firewall-users-table.html">
28.7.2 The INFORMATION_SCHEMA MYSQL_FIREWALL_USERS Table
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="information-schema-mysql-firewall-whitelist-table.html">
28.7.3 The INFORMATION_SCHEMA MYSQL_FIREWALL_WHITELIST Table
</a>
</span>
</dt>
</dl>
</div>
<a class="indexterm" name="idm46045075980752">
</a>
<p>
The following sections describe the
<code class="literal">
INFORMATION_SCHEMA
</code>
tables associated with MySQL Enterprise Firewall
(see
<a class="xref" href="firewall.html" title="8.4.7 MySQL Enterprise Firewall">
Section 8.4.7, “MySQL Enterprise Firewall”
</a>
). They provide views into the
firewall in-memory data cache. These tables are available only if
the appropriate firewall plugins are enabled.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/linux-installation-juju.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="linux-installation-juju">
</a>
2.5.8 Installing MySQL on Linux with Juju
</h3>
</div>
</div>
</div>
<p>
The Juju deployment framework supports easy installation and
configuration of MySQL servers. For instructions, see
<a class="ulink" href="https://jujucharms.com/mysql/" target="_blank">
https://jujucharms.com/mysql/
</a>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/information-schema-innodb-buffer-pool-stats-table.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="information-schema-innodb-buffer-pool-stats-table">
</a>
28.4.4 The INFORMATION_SCHEMA INNODB_BUFFER_POOL_STATS Table
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045077425312">
</a>
<p>
The
<a class="link" href="information-schema-innodb-buffer-pool-stats-table.html" title="28.4.4 The INFORMATION_SCHEMA INNODB_BUFFER_POOL_STATS Table">
<code class="literal">
INNODB_BUFFER_POOL_STATS
</code>
</a>
table
provides much of the same buffer pool information provided in
<a class="link" href="show-engine.html" title="15.7.7.16 SHOW ENGINE Statement">
<code class="literal">
SHOW ENGINE INNODB
STATUS
</code>
</a>
output. Much of the same information may also be
obtained using
<code class="literal">
InnoDB
</code>
buffer pool
<a class="link" href="server-status-variables.html" title="7.1.10 Server Status Variables">
server status
variables
</a>
.
</p>
<p>
The idea of making pages in the buffer pool
<span class="quote">
“
<span class="quote">
young
</span>
”
</span>
or
<span class="quote">
“
<span class="quote">
not young
</span>
”
</span>
refers to transferring them between
the
<a class="link" href="glossary.html#glos_sublist" title="sublist">
sublists
</a>
at the head and
tail of the buffer pool data structure. Pages made
<span class="quote">
“
<span class="quote">
young
</span>
”
</span>
take longer to age out of the buffer pool,
while pages made
<span class="quote">
“
<span class="quote">
not young
</span>
”
</span>
are moved much closer to
the point of
<a class="link" href="glossary.html#glos_eviction" title="eviction">
eviction
</a>
.
</p>
<p>
For related usage information and examples, see
<a class="xref" href="innodb-information-schema-buffer-pool-tables.html" title="17.15.5 InnoDB INFORMATION_SCHEMA Buffer Pool Tables">
Section 17.15.5, “InnoDB INFORMATION_SCHEMA Buffer Pool Tables”
</a>
.
</p>
<p>
The
<a class="link" href="information-schema-innodb-buffer-pool-stats-table.html" title="28.4.4 The INFORMATION_SCHEMA INNODB_BUFFER_POOL_STATS Table">
<code class="literal">
INNODB_BUFFER_POOL_STATS
</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">
POOL_ID
</code>
</p>
<p>
The buffer pool ID. This is an identifier to distinguish
between multiple buffer pool instances.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
POOL_SIZE
</code>
</p>
<p>
The
<code class="literal">
InnoDB
</code>
buffer pool size in pages.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
FREE_BUFFERS
</code>
</p>
<p>
The number of free pages in the
<code class="literal">
InnoDB
</code>
buffer pool.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
DATABASE_PAGES
</code>
</p>
<p>
The number of pages in the
<code class="literal">
InnoDB
</code>
buffer
pool containing data. This number includes both dirty and
clean pages.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
OLD_DATABASE_PAGES
</code>
</p>
<p>
The number of pages in the
<code class="literal">
old
</code>
buffer pool
sublist.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
MODIFIED_DATABASE_PAGES
</code>
</p>
<p>
The number of modified (dirty) database pages.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
PENDING_DECOMPRESS
</code>
</p>
<p>
The number of pages pending decompression.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
PENDING_READS
</code>
</p>
<p>
The number of pending reads.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
PENDING_FLUSH_LRU
</code>
</p>
<p>
The number of pages pending flush in the LRU.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
PENDING_FLUSH_LIST
</code>
</p>
<p>
The number of pages pending flush in the flush list.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
PAGES_MADE_YOUNG
</code>
</p>
<p>
The number of pages made young.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
PAGES_NOT_MADE_YOUNG
</code>
</p>
<p>
The number of pages not made young.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
PAGES_MADE_YOUNG_RATE
</code>
</p>
<p>
The number of pages made young per second (pages made young
since the last printout / time elapsed).
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
PAGES_MADE_NOT_YOUNG_RATE
</code>
</p>
<p>
The number of pages not made per second (pages not made young
since the last printout / time elapsed).
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
NUMBER_PAGES_READ
</code>
</p>
<p>
The number of pages read.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
NUMBER_PAGES_CREATED
</code>
</p>
<p>
The number of pages created.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
NUMBER_PAGES_WRITTEN
</code>
</p>
<p>
The number of pages written.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
PAGES_READ_RATE
</code>
</p>
<p>
The number of pages read per second (pages read since the last
printout / time elapsed).
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
PAGES_CREATE_RATE
</code>
</p>
<p>
The number of pages created per second (pages created since
the last printout / time elapsed).
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
PAGES_WRITTEN_RATE
</code>
</p>
<p>
The number of pages written per second (pages written since
the last printout / time elapsed).
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
NUMBER_PAGES_GET
</code>
</p>
<p>
The number of logical read requests.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
HIT_RATE
</code>
</p>
<p>
The buffer pool hit rate.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
YOUNG_MAKE_PER_THOUSAND_GETS
</code>
</p>
<p>
The number of pages made young per thousand gets.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
NOT_YOUNG_MAKE_PER_THOUSAND_GETS
</code>
</p>
<p>
The number of pages not made young per thousand gets.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
NUMBER_PAGES_READ_AHEAD
</code>
</p>
<p>
The number of pages read ahead.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
NUMBER_READ_AHEAD_EVICTED
</code>
</p>
<p>
The number of pages read into the
<code class="literal">
InnoDB
</code>
buffer pool by the read-ahead background thread that were
subsequently evicted without having been accessed by queries.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
READ_AHEAD_RATE
</code>
</p>
<p>
The read-ahead rate per second (pages read ahead since the
last printout / time elapsed).
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
READ_AHEAD_EVICTED_RATE
</code>
</p>
<p>
The number of read-ahead pages evicted without access per
second (read-ahead pages not accessed since the last printout
/ time elapsed).
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
LRU_IO_TOTAL
</code>
</p>
<p>
Total LRU I/O.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
LRU_IO_CURRENT
</code>
</p>
<p>
LRU I/O for the current interval.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
UNCOMPRESS_TOTAL
</code>
</p>
<p>
The total number of pages decompressed.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
UNCOMPRESS_CURRENT
</code>
</p>
<p>
The number of pages decompressed in the current interval.
</p>
</li>
</ul>
</div>
<h4>
<a name="idm46045077346112">
</a>
Example
</h4>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa75073322"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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_BUFFER_POOL_STATS\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>
POOL_ID<span class="token punctuation">:</span> 0
POOL_SIZE<span class="token punctuation">:</span> 8192
FREE_BUFFERS<span class="token punctuation">:</span> 1
DATABASE_PAGES<span class="token punctuation">:</span> 8085
OLD_DATABASE_PAGES<span class="token punctuation">:</span> 2964
MODIFIED_DATABASE_PAGES<span class="token punctuation">:</span> 0
PENDING_DECOMPRESS<span class="token punctuation">:</span> 0
PENDING_READS<span class="token punctuation">:</span> 0
PENDING_FLUSH_LRU<span class="token punctuation">:</span> 0
PENDING_FLUSH_LIST<span class="token punctuation">:</span> 0
PAGES_MADE_YOUNG<span class="token punctuation">:</span> 22821
PAGES_NOT_MADE_YOUNG<span class="token punctuation">:</span> 3544303
PAGES_MADE_YOUNG_RATE<span class="token punctuation">:</span> 357.62602199870594
PAGES_MADE_NOT_YOUNG_RATE<span class="token punctuation">:</span> 0
NUMBER_PAGES_READ<span class="token punctuation">:</span> 2389
NUMBER_PAGES_CREATED<span class="token punctuation">:</span> 12385
NUMBER_PAGES_WRITTEN<span class="token punctuation">:</span> 13111
PAGES_READ_RATE<span class="token punctuation">:</span> 0
PAGES_CREATE_RATE<span class="token punctuation">:</span> 0
PAGES_WRITTEN_RATE<span class="token punctuation">:</span> 0
NUMBER_PAGES_GET<span class="token punctuation">:</span> 33322210
HIT_RATE<span class="token punctuation">:</span> 1000
YOUNG_MAKE_PER_THOUSAND_GETS<span class="token punctuation">:</span> 18
NOT_YOUNG_MAKE_PER_THOUSAND_GETS<span class="token punctuation">:</span> 0
NUMBER_PAGES_READ_AHEAD<span class="token punctuation">:</span> 2024
NUMBER_READ_AHEAD_EVICTED<span class="token punctuation">:</span> 0
READ_AHEAD_RATE<span class="token punctuation">:</span> 0
READ_AHEAD_EVICTED_RATE<span class="token punctuation">:</span> 0
LRU_IO_TOTAL<span class="token punctuation">:</span> 0
LRU_IO_CURRENT<span class="token punctuation">:</span> 0
UNCOMPRESS_TOTAL<span class="token punctuation">:</span> 0
UNCOMPRESS_CURRENT<span class="token punctuation">:</span> 0</span></code></pre>
</div>
<h4>
<a name="idm46045077341184">
</a>
Notes
</h4>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
This table is useful primarily for expert-level performance
monitoring, or when developing performance-related extensions
for MySQL.
</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>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/replication-administration-status.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="replication-administration-status">
</a>
19.1.7.1 Checking Replication Status
</h4>
</div>
</div>
</div>
<p>
The most common task when managing a replication process is to
ensure that replication is taking place and that there have been
no errors between the replica and the source.
</p>
<p>
The
<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>
statement, which you must execute on each replica, provides
information about the configuration and status of the connection
between the replica server and the source server. The MySQL
Performance Schema contains replication tables that provide this
information in a more accessible form. See
<a class="xref" href="performance-schema-replication-tables.html" title="29.12.11 Performance Schema Replication Tables">
Section 29.12.11, “Performance Schema Replication Tables”
</a>
.
</p>
<p>
The replication heartbeat information shown in the Performance
Schema replication tables lets you check that the replication
connection is active even if the source has not sent events to
the replica recently. The source sends a heartbeat signal to a
replica if there are no updates to, and no unsent events in, the
binary log for a longer period than the heartbeat interval. The
<code class="literal">
SOURCE_HEARTBEAT_PERIOD
</code>
setting on the source
(set 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>
) specifies the frequency of the heartbeat, which
defaults to half of the connection timeout interval for the
replica (specified by the system variable
<a class="link" href="replication-options-replica.html#sysvar_replica_net_timeout">
<code class="literal">
replica_net_timeout
</code>
</a>
. The
<a class="link" href="performance-schema-replication-connection-status-table.html" title="29.12.11.13 The replication_connection_status Table">
<code class="literal">
replication_connection_status
</code>
</a>
Performance Schema table shows when the most recent heartbeat
signal was received by a replica, and how many heartbeat signals
it has received.
</p>
<p>
You can 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>
to check on the status of an individual replica; this statement
provides the information shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa50743417"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">REPLICA</span> <span class="token keyword">STATUS</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>
Replica_IO_State<span class="token punctuation">:</span> Waiting for source to send event
Source_Host<span class="token punctuation">:</span> 127.0.0.1
Source_User<span class="token punctuation">:</span> root
Source_Port<span class="token punctuation">:</span> 13000
Connect_Retry<span class="token punctuation">:</span> 1
Source_Log_File<span class="token punctuation">:</span> master-bin.000001
Read_Source_Log_Pos<span class="token punctuation">:</span> 927
Relay_Log_File<span class="token punctuation">:</span> slave-relay-bin.000002
Relay_Log_Pos<span class="token punctuation">:</span> 1145
Relay_Source_Log_File<span class="token punctuation">:</span> master-bin.000001
Replica_IO_Running<span class="token punctuation">:</span> Yes
Replica_SQL_Running<span class="token punctuation">:</span> Yes
Replicate_Do_DB<span class="token punctuation">:</span>
Replicate_Ignore_DB<span class="token punctuation">:</span>
Replicate_Do_Table<span class="token punctuation">:</span>
Replicate_Ignore_Table<span class="token punctuation">:</span>
Replicate_Wild_Do_Table<span class="token punctuation">:</span>
Replicate_Wild_Ignore_Table<span class="token punctuation">:</span>
Last_Errno<span class="token punctuation">:</span> 0
Last_Error<span class="token punctuation">:</span>
Skip_Counter<span class="token punctuation">:</span> 0
Exec_Source_Log_Pos<span class="token punctuation">:</span> 927
Relay_Log_Space<span class="token punctuation">:</span> 1355
Until_Condition<span class="token punctuation">:</span> None
Until_Log_File<span class="token punctuation">:</span>
Until_Log_Pos<span class="token punctuation">:</span> 0
Source_SSL_Allowed<span class="token punctuation">:</span> No
Source_SSL_CA_File<span class="token punctuation">:</span>
Source_SSL_CA_Path<span class="token punctuation">:</span>
Source_SSL_Cert<span class="token punctuation">:</span>
Source_SSL_Cipher<span class="token punctuation">:</span>
Source_SSL_Key<span class="token punctuation">:</span>
Seconds_Behind_Source<span class="token punctuation">:</span> 0
Source_SSL_Verify_Server_Cert<span class="token punctuation">:</span> No
Last_IO_Errno<span class="token punctuation">:</span> 0
Last_IO_Error<span class="token punctuation">:</span>
Last_SQL_Errno<span class="token punctuation">:</span> 0
Last_SQL_Error<span class="token punctuation">:</span>
Replicate_Ignore_Server_Ids<span class="token punctuation">:</span>
Source_Server_Id<span class="token punctuation">:</span> 1
Source_UUID<span class="token punctuation">:</span> 73f86016-978b-11ee-ade5-8d2a2a562feb
Source_Info_File<span class="token punctuation">:</span> mysql.slave_master_info
SQL_Delay<span class="token punctuation">:</span> 0
SQL_Remaining_Delay<span class="token punctuation">:</span> NULL
Replica_SQL_Running_State<span class="token punctuation">:</span> Replica has read all relay log; waiting for more updates
Source_Retry_Count<span class="token punctuation">:</span> 10
Source_Bind<span class="token punctuation">:</span>
Last_IO_Error_Timestamp<span class="token punctuation">:</span>
Last_SQL_Error_Timestamp<span class="token punctuation">:</span>
Source_SSL_Crl<span class="token punctuation">:</span>
Source_SSL_Crlpath<span class="token punctuation">:</span>
Retrieved_Gtid_Set<span class="token punctuation">:</span> 73f86016-978b-11ee-ade5-8d2a2a562feb<span class="token punctuation">:</span>1-3
Executed_Gtid_Set<span class="token punctuation">:</span> 73f86016-978b-11ee-ade5-8d2a2a562feb<span class="token punctuation">:</span>1-3
Auto_Position<span class="token punctuation">:</span> 1
Replicate_Rewrite_DB<span class="token punctuation">:</span>
Channel_Name<span class="token punctuation">:</span>
Source_TLS_Version<span class="token punctuation">:</span>
Source_public_key_path<span class="token punctuation">:</span>
Get_Source_public_key<span class="token punctuation">:</span> 0
Network_Namespace<span class="token punctuation">:</span></span></code></pre>
</div>
<p>
The key fields from the status report to examine are:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
Replica_IO_State
</code>
: The current status of
the replica. See
<a class="xref" href="replica-io-thread-states.html" title="10.14.5 Replication I/O (Receiver) Thread States">
Section 10.14.5, “Replication I/O (Receiver) Thread States”
</a>
,
and
<a class="xref" href="replica-sql-thread-states.html" title="10.14.6 Replication SQL Thread States">
Section 10.14.6, “Replication SQL Thread States”
</a>
, for more
information.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
Replica_IO_Running
</code>
: Whether the I/O
(receiver) thread for reading the source's binary log is
running. Normally, you want this to be
<code class="literal">
Yes
</code>
unless you have not yet started
replication or have explicitly stopped it with
<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">
Replica_SQL_Running
</code>
: Whether the SQL
thread for executing events in the relay log is running. As
with the I/O thread, this should normally be
<code class="literal">
Yes
</code>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
Last_IO_Error
</code>
,
<code class="literal">
Last_SQL_Error
</code>
: The last errors
registered by the I/O (receiver) and SQL (applier) threads
when processing the relay log. Ideally these should be
blank, indicating no errors.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
Seconds_Behind_Source
</code>
: The number of
seconds that the replication SQL (applier) thread is behind
processing the source binary log. A high number (or an
increasing one) can indicate that the replica is unable to
handle events from the source in a timely fashion.
</p>
<p>
A value of 0 for
<code class="literal">
Seconds_Behind_Source
</code>
can usually be interpreted as meaning that the replica has
caught up with the source, but there are some cases where
this is not strictly true. For example, this can occur if
the network connection between source and replica is broken
but the replication I/O (receiver) thread has not yet
noticed this; that is, the time period set by
<a class="link" href="replication-options-replica.html#sysvar_replica_net_timeout">
<code class="literal">
replica_net_timeout
</code>
</a>
has not
yet elapsed.
</p>
<p>
It is also possible that transient values for
<code class="literal">
Seconds_Behind_Source
</code>
may not reflect the
situation accurately. When the replication SQL (applier)
thread has caught up on I/O,
<code class="literal">
Seconds_Behind_Source
</code>
displays 0; but
when the replication I/O (receiver) thread is still queuing
up a new event,
<code class="literal">
Seconds_Behind_Source
</code>
may
show a large value until the replication applier thread
finishes executing the new event. This is especially likely
when the events have old timestamps; in such cases, if you
execute
<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>
several times in a relatively short period, you may see this
value change back and forth repeatedly between 0 and a
relatively large value.
</p>
</li>
</ul>
</div>
<p>
Several pairs of fields provide information about the progress
of the replica in reading events from the source binary log and
processing them in the relay log:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
(
<code class="literal">
Master_Log_file
</code>
,
<code class="literal">
Read_Master_Log_Pos
</code>
): Coordinates in the
source binary log indicating how far the replication I/O
(receiver) thread has read events from that log.
</p>
</li>
<li class="listitem">
<p>
(
<code class="literal">
Relay_Master_Log_File
</code>
,
<code class="literal">
Exec_Master_Log_Pos
</code>
): Coordinates in the
source binary log indicating how far the replication SQL
(applier) thread has executed events received from that log.
</p>
</li>
<li class="listitem">
<p>
(
<code class="literal">
Relay_Log_File
</code>
,
<code class="literal">
Relay_Log_Pos
</code>
): Coordinates in the
replica relay log indicating how far the replication SQL
(applier) thread has executed the relay log. These
correspond to the preceding coordinates, but are expressed
in replica relay log coordinates rather than source binary
log coordinates.
</p>
</li>
</ul>
</div>
<p>
On the source, you can check the status of connected replicas
using
<a class="link" href="show-processlist.html" title="15.7.7.31 SHOW PROCESSLIST Statement">
<code class="literal">
SHOW PROCESSLIST
</code>
</a>
to examine
the list of running processes. Replica connections have
<code class="literal">
Binlog Dump
</code>
in the
<code class="literal">
Command
</code>
field:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa2643694"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">PROCESSLIST</span> \G<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> 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>
Id<span class="token punctuation">:</span> 10
User<span class="token punctuation">:</span> root
Host<span class="token punctuation">:</span> replica1<span class="token punctuation">:</span>58371
db<span class="token punctuation">:</span> NULL
Command<span class="token punctuation">:</span> Binlog Dump
Time<span class="token punctuation">:</span> 777
State<span class="token punctuation">:</span> Has sent all binlog to slave; waiting for binlog to be updated
Info<span class="token punctuation">:</span> NULL</span></code></pre>
</div>
<p>
Because it is the replica that drives the replication process,
very little information is available in this report.
</p>
<p>
For replicas that were started with the
<a class="link" href="replication-options-replica.html#sysvar_report_host">
<code class="option">
--report-host
</code>
</a>
option and are
connected to the source, the
<a class="link" href="show-replicas.html" title="15.7.7.36 SHOW REPLICAS Statement">
<code class="literal">
SHOW
REPLICAS
</code>
</a>
statement on the source shows basic
information about the replicas. The output includes the ID of
the replica server, the value of the
<a class="link" href="replication-options-replica.html#sysvar_report_host">
<code class="option">
--report-host
</code>
</a>
option, the
connecting port, and source ID:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa35317527"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">REPLICAS</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> Server_id <span class="token punctuation">|</span> Host <span class="token punctuation">|</span> Port <span class="token punctuation">|</span> Rpl_recovery_rank <span class="token punctuation">|</span> Source_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 class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span 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> replica1 <span class="token punctuation">|</span> 3306 <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 class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output">1 row in set (0.00 sec)</span></code></pre>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/replication-privilege-checks-recover.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="replication-privilege-checks-recover">
</a>
19.3.3.3 Recovering From Failed Replication Privilege Checks
</h4>
</div>
</div>
</div>
<p>
If a privilege check against the
<code class="literal">
PRIVILEGE_CHECKS_USER
</code>
account fails, the
transaction is not executed and replication stops for the
channel. Details of the error and the last applied transaction
are recorded in the Performance Schema
<a class="link" href="performance-schema-replication-applier-status-by-worker-table.html" title="29.12.11.7 The replication_applier_status_by_worker Table">
<code class="literal">
replication_applier_status_by_worker
</code>
</a>
table. Follow this procedure to recover from the error:
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
Identify the replicated event that caused the error and
verify whether or not the event is expected and from a
trusted source. You can use
<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>
to retrieve and display the events that were logged around
the time of the error. For instructions to do this, see
<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>
.
</p>
</li>
<li class="listitem">
<p>
If the replicated event is not expected or is not from a
known and trusted source, investigate the cause. If you can
identify why the event took place and there are no security
considerations, proceed to fix the error as described below.
</p>
</li>
<li class="listitem">
<p>
If the
<code class="literal">
PRIVILEGE_CHECKS_USER
</code>
account
should have been permitted to execute the transaction, but
has been misconfigured, grant the missing privileges to the
account, use a
<a class="link" href="flush.html#flush-privileges">
<code class="literal">
FLUSH
PRIVILEGES
</code>
</a>
statement or execute a
<a class="link" href="mysqladmin.html" title="6.5.2 mysqladmin — A MySQL Server Administration Program">
<span class="command">
<strong>
mysqladmin flush-privileges
</strong>
</span>
</a>
or
<a class="link" href="mysqladmin.html" title="6.5.2 mysqladmin — A MySQL Server Administration Program">
<span class="command">
<strong>
mysqladmin reload
</strong>
</span>
</a>
command to reload the
grant tables, then restart replication for the channel.
</p>
</li>
<li class="listitem">
<p>
If the transaction needs to be executed and you have
verified that it is trusted, but the
<code class="literal">
PRIVILEGE_CHECKS_USER
</code>
account should not
have this privilege normally, you can grant the required
privilege to the
<code class="literal">
PRIVILEGE_CHECKS_USER
</code>
account temporarily. After the replicated event has been
applied, remove the privilege from the account, and take any
necessary steps to ensure the event does not recur if it is
avoidable.
</p>
</li>
<li class="listitem">
<p>
If the transaction is an administrative action that should
only have taken place on the source and not on the replica,
or should only have taken place on a single replication
group member, skip the transaction on the server or servers
where it stopped replication, then issue
<a class="link" href="start-replica.html" title="15.4.2.4 START REPLICA Statement">
<code class="literal">
START REPLICA
</code>
</a>
to restart
replication on the channel. To avoid the situation in
future, you could issue such administrative statements with
<code class="literal">
SET sql_log_bin = 0
</code>
before them and
<code class="literal">
SET sql_log_bin = 1
</code>
after them, so that
they are not logged on the source.
</p>
</li>
<li class="listitem">
<p>
If the transaction is a DDL or DML statement that should not
have taken place on either the source or the replica, skip
the transaction on the server or servers where it stopped
replication, undo the transaction manually on the server
where it originally took place, then issue
<a class="link" href="start-replica.html" title="15.4.2.4 START REPLICA Statement">
<code class="literal">
START REPLICA
</code>
</a>
to restart
replication.
</p>
</li>
</ol>
</div>
<p>
To skip a transaction, if GTIDs are in use, commit an empty
transaction that has the GTID of the failing transaction, for
example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa35036198"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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> GTID_NEXT<span class="token operator">=</span><span class="token string">'aaa-bbb-ccc-ddd:N'</span><span class="token punctuation">;</span>
<span class="token keyword">BEGIN</span><span class="token punctuation">;</span>
<span class="token keyword">COMMIT</span><span class="token punctuation">;</span>
<span class="token keyword">SET</span> GTID_NEXT<span class="token operator">=</span><span class="token string">'AUTOMATIC'</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
If GTIDs are not in use, issue a
<code class="literal">
SET GLOBAL
sql_replica_skip_counter
</code>
statement to skip the event.
For instructions to use this alternative method and more details
about skipping transactions, see
<a class="xref" href="replication-administration-skip.html" title="19.1.7.3 Skipping Transactions">
Section 19.1.7.3, “Skipping Transactions”
</a>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/group-replication-single-primary-mode.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="group-replication-single-primary-mode">
</a>
20.1.3.1 Single-Primary Mode
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045134489696">
</a>
<a class="indexterm" name="idm46045134488208">
</a>
<p>
In single-primary mode
(
<a class="link" href="group-replication-system-variables.html#sysvar_group_replication_single_primary_mode">
<code class="literal">
group_replication_single_primary_mode=ON
</code>
</a>
)
the group has a single primary server that is set to read/write
mode. All the other members in the group are set to read-only
mode (with
<a class="link" href="server-system-variables.html#sysvar_super_read_only">
<code class="literal">
super_read_only=ON
</code>
</a>
).
The primary typically bootstraps the entire group. All other
servers that join the group learn about the primary server and
are automatically set to read-only mode.
</p>
<p>
In single-primary mode, Group Replication enforces that only a
single server writes to the group, so compared to multi-primary
mode, consistency checking can be less strict and DDL statements
do not need to be handled with any extra care. The option
<a class="link" href="group-replication-system-variables.html#sysvar_group_replication_enforce_update_everywhere_checks">
<code class="literal">
group_replication_enforce_update_everywhere_checks
</code>
</a>
enables or disables strict consistency checks for a group. When
deploying in single-primary mode, or changing the group to
single-primary mode, this system variable must be set to
<code class="literal">
OFF
</code>
.
</p>
<p>
The member that is designated as the primary server can change
in the following ways:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
If the existing primary leaves the group, whether
voluntarily or unexpectedly, a new primary is elected
automatically.
</p>
</li>
<li class="listitem">
<p>
You can appoint a specific member as the new primary using
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>
If you use the
<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>
function to change a group that was running in
multi-primary mode to run in single-primary mode, a new
primary is elected automatically, or you can appoint the
new primary by specifying it with the function.
</p>
</li>
</ul>
</div>
<p>
When a new primary server is elected (automatically or
manually), it is automatically set to read/write, and the other
group members remain as secondaries, and as such, read-only. The
following diagram shows this process:
</p>
<div class="figure">
<a name="group-replication-primary-election-diagram">
</a>
<p class="title">
<b>
Figure 20.4 New Primary Election
</b>
</p>
<div class="figure-contents">
<div class="mediaobject">
<img alt="Five server instances, S1, S2, S3, S4, and S5, are deployed as an interconnected group. Server S1 is the primary. Write clients are communicating with server S1, and a read client is communicating with server S4. Server S1 then fails, breaking communication with the write clients. Server S2 then takes over as the new primary, and the write clients now communicate with server S2." src="images/single-primary-election.png" style="width: 100%; max-width: 899px;"/>
</div>
</div>
</div>
<br class="figure-break"/>
<p>
When a new primary is chosen, it might have a backlog of changes
that had been applied on the old primary but have not yet been
applied on the new one. In this case, until the new primary
catches up with the old one, read/write transactions might
result in conflicts and be rolled back, and read-only
transactions might result in stale reads. The Group Replication
flow control mechanism minimizes the difference between fast and
slow members, and so reduces the chances of this happening if it
is activated and properly tuned. For more information, see
<a class="xref" href="group-replication-flow-control.html" title="20.7.2 Flow Control">
Section 20.7.2, “Flow Control”
</a>
. You can also
use the
<a class="link" href="group-replication-system-variables.html#sysvar_group_replication_consistency">
<code class="literal">
group_replication_consistency
</code>
</a>
system variable to set the group's level of transaction
consistency to prevent this issue. Setting this variable to
<code class="literal">
BEFORE_ON_PRIMARY_FAILOVER
</code>
(the default) or
any higher consistency level holds new transactions on a newly
elected primary until the backlog has been applied.
</p>
<p>
For more information on transaction consistency, see
<a class="xref" href="group-replication-consistency-guarantees.html" title="20.5.3 Transaction Consistency Guarantees">
Section 20.5.3, “Transaction Consistency Guarantees”
</a>
. If
flow control and transaction consistency guarantees are not used
for a group, it is a good practice to wait for the new primary
to apply its replication-related relay log before re-routing
client applications to it.
</p>
<div class="section">
<div class="titlepage">
<div>
<div>
<h5 class="title">
<a name="group-replication-primary-election">
</a>
20.1.3.1.1 Primary Election Algorithm
</h5>
</div>
</div>
</div>
<p>
The automatic primary member election process involves each
member looking at the new view of the group, ordering the
potential new primary members, and choosing the member that
qualifies as the most suitable. Each member makes its own
decision locally, following the primary election algorithm in
its MySQL Server release. Because all members must reach the
same decision, members adapt their primary election algorithm
if other group members are running lower MySQL Server
versions, so that they have the same behavior as the member
with the lowest MySQL Server version in the group.
</p>
<p>
The factors considered by members when electing a primary, in
order, are as follows:
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
The first factor considered is which member or members
are running the lowest MySQL Server version. All group
members are first ordered by the patch version of their
release.
</p>
</li>
<li class="listitem">
<p>
If more than one member is running the lowest MySQL
Server version, the second factor considered is the
member weight of each of those members, as specified by
the
<a class="link" href="group-replication-system-variables.html#sysvar_group_replication_member_weight">
<code class="literal">
group_replication_member_weight
</code>
</a>
system variable on the member.
</p>
<p>
The
<a class="link" href="group-replication-system-variables.html#sysvar_group_replication_member_weight">
<code class="literal">
group_replication_member_weight
</code>
</a>
system variable specifies a number in the range 0-100.
All members default to a weight of 50, so set a weight
below this to lower their ordering, and a weight above
it to increase their ordering. You can use this
weighting function to prioritize the use of better
hardware or to ensure failover to a specific member
during scheduled maintenance of the primary.
</p>
</li>
<li class="listitem">
<p>
If more than one member is running the lowest MySQL
Server version, and more than one of those members has
the highest member weight (or member weighting is being
ignored), the third factor considered is the
lexicographical order of the generated server UUIDs of
each member, as specified by the
<a class="link" href="replication-options.html#sysvar_server_uuid">
<code class="literal">
server_uuid
</code>
</a>
system
variable. The member with the lowest server UUID is
chosen as the primary. This factor acts as a guaranteed
and predictable tie-breaker so that all group members
reach the same decision if it cannot be determined by
any important factors.
</p>
</li>
</ol>
</div>
<p>
</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h5 class="title">
<a name="group-replication-find-primary">
</a>
20.1.3.1.2 Finding the Primary
</h5>
</div>
</div>
</div>
<a class="indexterm" name="idm46045134447520">
</a>
<p>
To find out which server is currently the primary when
deployed in single-primary mode, use the
<code class="literal">
MEMBER_ROLE
</code>
column in the
<a class="link" href="performance-schema-replication-group-members-table.html" title="29.12.11.16 The replication_group_members Table">
<code class="literal">
performance_schema.replication_group_members
</code>
</a>
table. For example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa42339057"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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> MEMBER_HOST<span class="token punctuation">,</span> MEMBER_ROLE <span class="token keyword">FROM</span> performance_schema<span class="token punctuation">.</span>replication_group_members<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> MEMBER_HOST <span class="token punctuation">|</span> MEMBER_ROLE <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> remote1.example.com <span class="token punctuation">|</span> PRIMARY <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> remote2.example.com <span class="token punctuation">|</span> SECONDARY <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> remote3.example.com <span class="token punctuation">|</span> SECONDARY <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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/fulltext-query-expansion.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="fulltext-query-expansion">
</a>
14.9.3 Full-Text Searches with Query Expansion
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045201620208">
</a>
<a class="indexterm" name="idm46045201619136">
</a>
<p>
Full-text search supports query expansion (and in particular,
its variant
<span class="quote">
“
<span class="quote">
blind query expansion
</span>
”
</span>
). This is
generally useful when a search phrase is too short, which often
means that the user is relying on implied knowledge that the
full-text search engine lacks. For example, a user searching for
<span class="quote">
“
<span class="quote">
database
</span>
”
</span>
may really mean that
<span class="quote">
“
<span class="quote">
MySQL
</span>
”
</span>
,
<span class="quote">
“
<span class="quote">
Oracle
</span>
”
</span>
,
<span class="quote">
“
<span class="quote">
DB2
</span>
”
</span>
,
and
<span class="quote">
“
<span class="quote">
RDBMS
</span>
”
</span>
all are phrases that should match
<span class="quote">
“
<span class="quote">
databases
</span>
”
</span>
and should be returned, too. This is
implied knowledge.
</p>
<p>
Blind query expansion (also known as automatic relevance
feedback) is enabled by adding
<code class="literal">
WITH QUERY
EXPANSION
</code>
or
<code class="literal">
IN NATURAL LANGUAGE MODE WITH
QUERY EXPANSION
</code>
following the search phrase. It works
by performing the search twice, where the search phrase for the
second search is the original search phrase concatenated with
the few most highly relevant documents from the first search.
Thus, if one of these documents contains the word
<span class="quote">
“
<span class="quote">
databases
</span>
”
</span>
and the word
<span class="quote">
“
<span class="quote">
MySQL
</span>
”
</span>
, the
second search finds the documents that contain the word
<span class="quote">
“
<span class="quote">
MySQL
</span>
”
</span>
even if they do not contain the word
<span class="quote">
“
<span class="quote">
database
</span>
”
</span>
. The following example shows this
difference:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa9375064"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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> articles
<span class="token keyword">WHERE</span> <span class="token operator">MATCH</span> <span class="token punctuation">(</span>title<span class="token punctuation">,</span>body<span class="token punctuation">)</span>
<span class="token keyword">AGAINST</span> <span class="token punctuation">(</span><span class="token string">'database'</span> <span class="token keyword">IN</span> <span class="token keyword">NATURAL</span> <span class="token keyword">LANGUAGE</span> <span class="token keyword">MODE</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span 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> title <span class="token punctuation">|</span> body <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span 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> MySQL Tutorial <span class="token punctuation">|</span> DBMS stands for DataBase ... <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 5 <span class="token punctuation">|</span> MySQL vs. YourSQL <span class="token punctuation">|</span> In the following database comparison ... <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span 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 operator">*</span> <span class="token keyword">FROM</span> articles
<span class="token keyword">WHERE</span> <span class="token operator">MATCH</span> <span class="token punctuation">(</span>title<span class="token punctuation">,</span>body<span class="token punctuation">)</span>
<span class="token keyword">AGAINST</span> <span class="token punctuation">(</span><span class="token string">'database'</span> <span class="token keyword">WITH</span> <span class="token keyword">QUERY</span> <span class="token keyword">EXPANSION</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>
<span class="token output"><span class="token punctuation">|</span> id <span class="token punctuation">|</span> title <span class="token punctuation">|</span> body <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span 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> MySQL vs. YourSQL <span class="token punctuation">|</span> In the following database comparison ... <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 1 <span class="token punctuation">|</span> MySQL Tutorial <span class="token punctuation">|</span> DBMS stands for DataBase ... <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 3 <span class="token punctuation">|</span> Optimizing MySQL <span class="token punctuation">|</span> In this tutorial we show ... <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 6 <span class="token punctuation">|</span> MySQL Security <span class="token punctuation">|</span> When configured properly, MySQL ... <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 2 <span class="token punctuation">|</span> How To Use MySQL Well <span class="token punctuation">|</span> After you went through a ... <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 4 <span class="token punctuation">|</span> 1001 MySQL Tricks <span class="token punctuation">|</span> 1. Never run mysqld as root. 2. ... <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output">6 rows in set (0.00 sec)</span></code></pre>
</div>
<p>
Another example could be searching for books by Georges Simenon
about Maigret, when a user is not sure how to spell
<span class="quote">
“
<span class="quote">
Maigret
</span>
”
</span>
. A search for
<span class="quote">
“
<span class="quote">
Megre and the
reluctant witnesses
</span>
”
</span>
finds only
<span class="quote">
“
<span class="quote">
Maigret and the
Reluctant Witnesses
</span>
”
</span>
without query expansion. A search
with query expansion finds all books with the word
<span class="quote">
“
<span class="quote">
Maigret
</span>
”
</span>
on the second pass.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
Because blind query expansion tends to increase noise
significantly by returning nonrelevant documents, use it only
when a search phrase is short.
</p>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/mysql-cluster-rolling-restart.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="mysql-cluster-rolling-restart">
</a>
25.6.5 Performing a Rolling Restart of an NDB Cluster
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045092605824">
</a>
<a class="indexterm" name="idm46045092604336">
</a>
<a class="indexterm" name="idm46045092603232">
</a>
<a class="indexterm" name="idm46045092601744">
</a>
<a class="indexterm" name="idm46045092600256">
</a>
<p>
This section discusses how to perform a
<span class="firstterm">
rolling restart
</span>
of an NDB
Cluster installation, so called because it involves stopping and
starting (or restarting) each node in turn, so that the cluster
itself remains operational. This is often done as part of a
<span class="firstterm">
rolling upgrade
</span>
or
<span class="firstterm">
rolling downgrade
</span>
, where
high availability of the cluster is mandatory and no downtime of
the cluster as a whole is permissible. Where we refer to upgrades,
the information provided here also generally applies to downgrades
as well.
</p>
<p>
There are a number of reasons why a rolling restart might be
desirable. These are described in the next few paragraphs.
</p>
<p>
<b>
Configuration change.
</b>
<a class="indexterm" name="idm46045092594960">
</a>
To make a change in the cluster's configuration, such as
adding an SQL node to the cluster, or setting a configuration
parameter to a new value.
</p>
<p>
<b>
NDB Cluster software upgrade or downgrade.
</b>
To upgrade the cluster to a newer version of the NDB Cluster
software (or to downgrade it to an older version). This is
usually referred to as a
<span class="quote">
“
<span class="quote">
rolling upgrade
</span>
”
</span>
(or
<span class="quote">
“
<span class="quote">
rolling downgrade
</span>
”
</span>
, when reverting to an older
version of NDB Cluster).
</p>
<p>
<b>
Change on node host.
</b>
To make changes in the hardware or operating system on which one
or more NDB Cluster node processes are running.
</p>
<p>
<b>
System reset (cluster reset).
</b>
<a class="indexterm" name="idm46045092588384">
</a>
To reset the cluster because it has reached an undesirable
state. In such cases it is often desirable to reload the data
and metadata of one or more data nodes. This can be done in any
of three ways:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Start each data node process (
<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
possibly
<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>
) with the
<a class="link" href="mysql-cluster-programs-ndbd.html#option_ndbd_initial">
<code class="option">
--initial
</code>
</a>
option, which forces
the data node to clear its file system and to reload all NDB
Cluster data and metadata from the other data nodes. This also
forces the removal of all Disk Data objects and files
associated with those objects.
</p>
</li>
<li class="listitem">
<p>
Create a backup using 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-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 prior
to performing the restart. Following the upgrade, restore the
node or nodes using
<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>
.
</p>
<p>
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>
, and
<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>
Use
<a class="link" href="mysqldump.html" title="6.5.4 mysqldump — A Database Backup Program">
<span class="command">
<strong>
mysqldump
</strong>
</span>
</a>
to create a backup prior to
the upgrade; afterward, restore the dump using
<a class="link" href="load-data.html" title="15.2.9 LOAD DATA Statement">
<code class="literal">
LOAD DATA
</code>
</a>
.
</p>
</li>
</ul>
</div>
<p>
<b>
Resource Recovery.
</b>
<a class="indexterm" name="idm46045092570592">
</a>
To free memory previously allocated to a table by successive
<a class="link" href="insert.html" title="15.2.7 INSERT Statement">
<code class="literal">
INSERT
</code>
</a>
and
<a class="link" href="delete.html" title="15.2.2 DELETE Statement">
<code class="literal">
DELETE
</code>
</a>
operations, for re-use by
other NDB Cluster tables.
</p>
<p>
The process for performing a rolling restart may be generalized as
follows:
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
Stop all cluster management nodes (
<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>
processes), reconfigure them, then restart them. (See
<a class="xref" href="mysql-cluster-rolling-restart.html#mysql-cluster-rolling-restart-multiple-ndb-mgmd" title="Rolling restarts with multiple management servers">
Rolling restarts with multiple management servers
</a>
.)
</p>
</li>
<li class="listitem">
<p>
Stop, reconfigure, then restart each cluster data node
(
<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) in turn.
</p>
<p>
Some node configuration parameters can be updated by issuing
<a class="link" href="mysql-cluster-mgm-client-commands.html#ndbclient-restart">
<code class="literal">
RESTART
</code>
</a>
for each of the
data nodes 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 following
the previous step. Other parameters require that the data node
be stopped completely using the management client
<a class="link" href="mysql-cluster-mgm-client-commands.html#ndbclient-stop">
<code class="literal">
STOP
</code>
</a>
command, then started
again from a system shell by invoking 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>
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>
executable as appropriate. (A shell command such as
<a class="link" href="kill.html" title="15.7.8.4 KILL Statement">
<span class="command">
<strong>
kill
</strong>
</span>
</a>
can also be used on most
Unix systems to stop a data node process, but the
<code class="literal">
STOP
</code>
command is preferred and usually
simpler.)
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
On Windows, you can also use
<span class="command">
<strong>
SC STOP
</strong>
</span>
and
<span class="command">
<strong>
SC START
</strong>
</span>
commands,
<code class="literal">
NET
STOP
</code>
and
<code class="literal">
NET START
</code>
commands, or
the Windows Service Manager to stop and start nodes which
have been installed as Windows services (see
<a class="xref" href="mysql-cluster-install-windows-service.html" title="25.3.2.4 Installing NDB Cluster Processes as Windows Services">
Section 25.3.2.4, “Installing NDB Cluster Processes as Windows Services”
</a>
).
</p>
</div>
<p>
The type of restart required is indicated in the documentation
for each node configuration parameter. See
<a class="xref" href="mysql-cluster-config-file.html" title="25.4.3 NDB Cluster Configuration Files">
Section 25.4.3, “NDB Cluster Configuration Files”
</a>
.
</p>
</li>
<li class="listitem">
<p>
Stop, reconfigure, then restart each cluster SQL node
(
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
process) in turn.
</p>
</li>
</ol>
</div>
<a class="indexterm" name="idm46045092542352">
</a>
<p>
NDB Cluster supports a somewhat flexible order for upgrading
nodes. When upgrading an NDB Cluster, you may upgrade API nodes
(including SQL nodes) before upgrading the management nodes, data
nodes, or both. In other words, you are permitted to upgrade the
API and SQL nodes in any order. This is subject to the following
provisions:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
This functionality is intended for use as part of an online
upgrade only. A mix of node binaries from different NDB
Cluster releases is neither intended nor supported for
continuous, long-term use in a production setting.
</p>
</li>
<li class="listitem">
<p>
You must upgrade all nodes of the same type (management, data,
or API node) before upgrading any nodes of a different type.
This remains true regardless of the order in which the nodes
are upgraded.
</p>
</li>
<li class="listitem">
<p>
You must upgrade all management nodes before upgrading any
data nodes. This remains true regardless of the order in which
you upgrade the cluster's API and SQL nodes.
</p>
</li>
<li class="listitem">
<p>
Features specific to the
<span class="quote">
“
<span class="quote">
new
</span>
”
</span>
version must not
be used until all management nodes and data nodes have been
upgraded.
</p>
<p>
This also applies to any MySQL Server version change that may
apply, in addition to the NDB engine version change, so do not
forget to take this into account when planning the upgrade.
(This is true for online upgrades of NDB Cluster in general.)
</p>
</li>
</ul>
</div>
<p>
It is not possible for any API node to perform schema operations
(such as data definition statements) during a node restart. Due in
part to this limitation, schema operations are also not supported
during an online upgrade or downgrade. In addition, it is not
possible to perform native backups while an upgrade or downgrade
is ongoing.
</p>
<p>
<a name="mysql-cluster-rolling-restart-multiple-ndb-mgmd">
</a>
<b>
Rolling restarts with multiple management servers.
</b>
<a class="indexterm" name="idm46045092532384">
</a>
<a class="indexterm" name="idm46045092530864">
</a>
When performing a rolling restart of an NDB Cluster with
multiple management nodes, you should keep in mind that
<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>
checks to see if any other
management node is running, and, if so, tries to use that
node's configuration data. To keep this from occurring, and
to force
<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>
to re-read its
configuration file, perform the following steps:
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
Stop all NDB Cluster
<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>
processes.
</p>
</li>
<li class="listitem">
<p>
Update all
<code class="filename">
config.ini
</code>
files.
</p>
</li>
<li class="listitem">
<p>
Start a single
<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>
with
<a class="link" href="mysql-cluster-programs-ndb-mgmd.html#option_ndb_mgmd_reload">
<code class="option">
--reload
</code>
</a>
,
<a class="link" href="mysql-cluster-programs-ndb-mgmd.html#option_ndb_mgmd_initial">
<code class="option">
--initial
</code>
</a>
, or both options as
desired.
</p>
</li>
<li class="listitem">
<p>
If you started the first
<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>
with the
<a class="link" href="mysql-cluster-programs-ndb-mgmd.html#option_ndb_mgmd_initial">
<code class="option">
--initial
</code>
</a>
option, you must
also start any remaining
<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>
processes
using
<code class="option">
--initial
</code>
.
</p>
<p>
Regardless of any other options used when starting the first
<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>
, you should not start any
remaining
<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>
processes after the
first one using
<a class="link" href="mysql-cluster-programs-ndb-mgmd.html#option_ndb_mgmd_reload">
<code class="option">
--reload
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
Complete the rolling restarts of the data nodes and API nodes
as normal.
</p>
</li>
</ol>
</div>
<p>
When performing a rolling restart to update the cluster's
configuration, you can use the
<code class="literal">
config_generation
</code>
column of 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 to keep
track of which data nodes have been successfully restarted with
the new configuration. See
<a class="xref" href="mysql-cluster-ndbinfo-nodes.html" title="25.6.17.48 The ndbinfo nodes Table">
Section 25.6.17.48, “The ndbinfo nodes Table”
</a>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/sys-latest-file-io.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="sys-latest-file-io">
</a>
30.4.3.15 The latest_file_io and x$latest_file_io Views
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045062894000">
</a>
<a class="indexterm" name="idm46045062892544">
</a>
<a class="indexterm" name="idm46045062891056">
</a>
<a class="indexterm" name="idm46045062889568">
</a>
<p>
These views summarize file I/O activity, grouped by file and
thread. By default, rows are sorted with most recent I/O
first.
</p>
<p>
The
<a class="link" href="sys-latest-file-io.html" title="30.4.3.15 The latest_file_io and x$latest_file_io Views">
<code class="literal">
latest_file_io
</code>
</a>
and
<a class="link" href="sys-latest-file-io.html" title="30.4.3.15 The latest_file_io and x$latest_file_io Views">
<code class="literal">
x$latest_file_io
</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">
thread
</code>
</p>
<p>
For foreground threads, the account associated with the
thread (and port number for TCP/IP connections). For
background threads, the thread name and thread ID
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
file
</code>
</p>
<p>
The file path name.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
latency
</code>
</p>
<p>
The wait time of the file I/O event.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
operation
</code>
</p>
<p>
The type of operation.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
requested
</code>
</p>
<p>
The number of data bytes requested for the file I/O event.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/create-logfile-group.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="create-logfile-group">
</a>
15.1.16 CREATE LOGFILE GROUP Statement
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045187348880">
</a>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa63712911"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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> <em class="replaceable">logfile_group</em>
<span class="token keyword">ADD</span> <span class="token keyword">UNDOFILE</span> <span class="token string">'<em class="replaceable">undo_file</em>'</span>
<span class="token punctuation">[</span><span class="token keyword">INITIAL_SIZE</span> <span class="token punctuation">[</span><span class="token operator">=</span><span class="token punctuation">]</span> <span class="token keyword"><em class="replaceable">initial_size</em></span><span class="token punctuation">]</span>
<span class="token punctuation">[</span><span class="token keyword">UNDO_BUFFER_SIZE</span> <span class="token punctuation">[</span><span class="token operator">=</span><span class="token punctuation">]</span> <span class="token keyword"><em class="replaceable">undo_buffer_size</em></span><span class="token punctuation">]</span>
<span class="token punctuation">[</span><span class="token keyword">REDO_BUFFER_SIZE</span> <span class="token punctuation">[</span><span class="token operator">=</span><span class="token punctuation">]</span> <span class="token keyword"><em class="replaceable">redo_buffer_size</em></span><span class="token punctuation">]</span>
<span class="token punctuation">[</span><span class="token keyword">NODEGROUP</span> <span class="token punctuation">[</span><span class="token operator">=</span><span class="token punctuation">]</span> <em class="replaceable">nodegroup_id</em><span class="token punctuation">]</span>
<span class="token punctuation">[</span><span class="token keyword">WAIT</span><span class="token punctuation">]</span>
<span class="token punctuation">[</span><span class="token keyword">COMMENT</span> <span class="token punctuation">[</span><span class="token operator">=</span><span class="token punctuation">]</span> <span class="token string">'<em class="replaceable">string</em>'</span><span class="token punctuation">]</span>
<span class="token keyword">ENGINE</span> <span class="token punctuation">[</span><span class="token operator">=</span><span class="token punctuation">]</span> <em class="replaceable">engine_name</em></code></pre>
</div>
<p>
This statement creates a new log file group named
<em class="replaceable">
<code>
logfile_group
</code>
</em>
having a single undo file
named '
<em class="replaceable">
<code>
undo_file
</code>
</em>
'. 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>
statement has
one and only one
<code class="literal">
ADD UNDOFILE
</code>
clause. For rules
covering the naming of log file groups, see
<a class="xref" href="identifiers.html" title="11.2 Schema Object Names">
Section 11.2, “Schema Object Names”
</a>
.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
All NDB Cluster Disk Data objects share the same namespace. This
means that
<span class="emphasis">
<em>
each Disk Data object
</em>
</span>
must be
uniquely named (and not merely each Disk Data object of a given
type). For example, you cannot have a tablespace and a log file
group with the same name, or a tablespace and a data file with
the same name.
</p>
</div>
<p>
There can be only one log file group per NDB Cluster instance at
any given time.
</p>
<p>
The optional
<code class="literal">
INITIAL_SIZE
</code>
parameter sets the
undo file's initial size; if not specified, it defaults to
<code class="literal">
128M
</code>
(128 megabytes). The optional
<code class="literal">
UNDO_BUFFER_SIZE
</code>
parameter sets the size used
by the undo buffer for the log file group; The default value for
<code class="literal">
UNDO_BUFFER_SIZE
</code>
is
<code class="literal">
8M
</code>
(eight megabytes); this value cannot exceed the amount of system
memory available. Both of these parameters are specified in bytes.
You may optionally follow either or both of these with a
one-letter abbreviation for an order of magnitude, similar to
those used in
<code class="filename">
my.cnf
</code>
. Generally, this is one
of the letters
<code class="literal">
M
</code>
(for megabytes) or
<code class="literal">
G
</code>
(for gigabytes).
</p>
<p>
Memory used for
<code class="literal">
UNDO_BUFFER_SIZE
</code>
comes from the
global pool whose size is determined by the value of the
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-sharedglobalmemory">
<code class="literal">
SharedGlobalMemory
</code>
</a>
data
node configuration parameter. This includes any default value
implied for this option 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.
</p>
<p>
The maximum permitted for
<code class="literal">
UNDO_BUFFER_SIZE
</code>
is
629145600 (600 MB).
</p>
<p>
On 32-bit systems, the maximum supported value for
<code class="literal">
INITIAL_SIZE
</code>
is 4294967296 (4 GB). (Bug #29186)
</p>
<p>
The minimum allowed value for
<code class="literal">
INITIAL_SIZE
</code>
is
1048576 (1 MB).
</p>
<p>
The
<code class="literal">
ENGINE
</code>
option determines the storage engine
to be used by this log file group, with
<em class="replaceable">
<code>
engine_name
</code>
</em>
being the name of the
storage engine. This must be
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
(or
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDBCLUSTER
</code>
</a>
). If
<code class="literal">
ENGINE
</code>
is not set, MySQL tries to use the
engine specified by the
<a class="link" href="server-system-variables.html#sysvar_default_storage_engine">
<code class="literal">
default_storage_engine
</code>
</a>
server
system variable. In any case, if the engine is not specified as
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
or
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDBCLUSTER
</code>
</a>
, the
<code class="literal">
CREATE
LOGFILE GROUP
</code>
statement appears to succeed but actually
fails to create the log file group, as shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa364070"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">LOGFILE</span> <span class="token keyword">GROUP</span> lg1
<span class="token prompt"> -></span> <span class="token keyword">ADD</span> <span class="token keyword">UNDOFILE</span> <span class="token string">'undo.dat'</span> <span class="token keyword">INITIAL_SIZE</span> <span class="token operator">=</span> 10M<span class="token punctuation">;</span>
<span class="token output">Query OK, 0 rows affected, 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 class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> Level <span class="token punctuation">|</span> Code <span class="token punctuation">|</span> Message <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> Error <span class="token punctuation">|</span> 1478 <span class="token punctuation">|</span> Table storage engine 'InnoDB' does not support the create option 'TABLESPACE or LOGFILE GROUP' <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span 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">DROP</span> <span class="token keyword">LOGFILE</span> <span class="token keyword">GROUP</span> lg1 <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">ERROR 1529 (HY000)<span class="token punctuation">:</span> Failed to drop LOGFILE GROUP
</span>
<span class="token prompt">mysql></span> <span class="token keyword">CREATE</span> <span class="token keyword">LOGFILE</span> <span class="token keyword">GROUP</span> lg1
<span class="token prompt"> -></span> <span class="token keyword">ADD</span> <span class="token keyword">UNDOFILE</span> <span class="token string">'undo.dat'</span> <span class="token keyword">INITIAL_SIZE</span> <span class="token operator">=</span> 10M
<span class="token prompt"> -></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.97 sec)</span></code></pre>
</div>
<p>
The fact that the
<code class="literal">
CREATE LOGFILE GROUP
</code>
statement does not actually return an error when a storage engine
other than
<code class="literal">
NDB
</code>
is specified, but rather appears
to succeed, is a known issue which we hope to address in a future
version of NDB Cluster.
</p>
<p>
<em class="replaceable">
<code>
REDO_BUFFER_SIZE
</code>
</em>
,
<code class="literal">
NODEGROUP
</code>
,
<code class="literal">
WAIT
</code>
, and
<code class="literal">
COMMENT
</code>
are parsed but ignored, and so have no
effect in MySQL 8.4. These options are intended for
future expansion.
</p>
<p>
When used with
<code class="literal">
ENGINE [=] NDB
</code>
, a log file group
and associated undo log file are created on each Cluster data
node. You can verify that the undo files were created and obtain
information about them by querying 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. For example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa47575318"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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> LOGFILE_GROUP_NAME<span class="token punctuation">,</span> LOGFILE_GROUP_NUMBER<span class="token punctuation">,</span> EXTRA
<span class="token prompt"> -></span> <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">=</span> <span class="token string">'undo_10.dat'</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> LOGFILE_GROUP_NAME <span class="token punctuation">|</span> LOGFILE_GROUP_NUMBER <span class="token punctuation">|</span> EXTRA <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> lg_3 <span class="token punctuation">|</span> 11 <span class="token punctuation">|</span> CLUSTER_NODE=3 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> lg_3 <span class="token punctuation">|</span> 11 <span class="token punctuation">|</span> CLUSTER_NODE=4 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span 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.06 sec)</span></code></pre>
</div>
<p>
<a class="link" href="create-logfile-group.html" title="15.1.16 CREATE LOGFILE GROUP Statement">
<code class="literal">
CREATE LOGFILE GROUP
</code>
</a>
is useful only
with Disk Data storage for NDB Cluster. See
<a class="xref" href="mysql-cluster-disk-data.html" title="25.6.11 NDB Cluster Disk Data Tables">
Section 25.6.11, “NDB Cluster Disk Data Tables”
</a>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/optimize-blob.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="optimize-blob">
</a>
10.4.2.3 Optimizing for BLOB Types
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045226748016">
</a>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
When storing a large blob containing textual data,
consider compressing it first. Do not use this technique
when the entire table is compressed by
<code class="literal">
InnoDB
</code>
or
<code class="literal">
MyISAM
</code>
.
</p>
</li>
<li class="listitem">
<p>
For a table with several columns, to reduce memory
requirements for queries that do not use the BLOB column,
consider splitting the BLOB column into a separate table
and referencing it with a join query when needed.
</p>
</li>
<li class="listitem">
<p>
Since the performance requirements to retrieve and display
a BLOB value might be very different from other data
types, you could put the BLOB-specific table on a
different storage device or even a separate database
instance. For example, to retrieve a BLOB might require a
large sequential disk read that is better suited to a
traditional hard drive than to an
<a class="link" href="glossary.html#glos_ssd" title="SSD">
SSD device
</a>
.
</p>
</li>
<li class="listitem">
<p>
See
<a class="xref" href="optimize-character.html" title="10.4.2.2 Optimizing for Character and String Types">
Section 10.4.2.2, “Optimizing for Character and String Types”
</a>
for reasons why a
binary
<code class="literal">
VARCHAR
</code>
column is sometimes
preferable to an equivalent BLOB column.
</p>
</li>
<li class="listitem">
<p>
Rather than testing for equality against a very long text
string, you can store a hash of the column value in a
separate column, index that column, and test the hashed
value in queries. (Use the
<code class="literal">
MD5()
</code>
or
<code class="literal">
CRC32()
</code>
function to produce the hash
value.) Since hash functions can produce duplicate results
for different inputs, you still include a clause
<code class="literal">
AND
<em class="replaceable">
<code>
blob_column
</code>
</em>
=
<em class="replaceable">
<code>
long_string_value
</code>
</em>
</code>
in
the query to guard against false matches; the performance
benefit comes from the smaller, easily scanned index for
the hashed values.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/describe.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="describe">
</a>
15.8.1 DESCRIBE Statement
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045168208224">
</a>
<a class="indexterm" name="idm46045168207152">
</a>
<p>
The
<a class="link" href="describe.html" title="15.8.1 DESCRIBE Statement">
<code class="literal">
DESCRIBE
</code>
</a>
and
<a class="link" href="explain.html" title="15.8.2 EXPLAIN Statement">
<code class="literal">
EXPLAIN
</code>
</a>
statements are synonyms,
used either to obtain information about table structure or query
execution plans. For more information, 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>
, and
<a class="xref" href="explain.html" title="15.8.2 EXPLAIN Statement">
Section 15.8.2, “EXPLAIN Statement”
</a>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/group-replication-operations.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title">
<a name="group-replication-operations">
</a>
20.5 Group Replication Operations
</h2>
</div>
</div>
</div>
<div class="toc">
<dl class="toc">
<dt>
<span class="section">
<a href="group-replication-configuring-online-group.html">
20.5.1 Configuring an Online Group
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="group-replication-restarting-group.html">
20.5.2 Restarting a Group
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="group-replication-consistency-guarantees.html">
20.5.3 Transaction Consistency Guarantees
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="group-replication-distributed-recovery.html">
20.5.4 Distributed Recovery
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="group-replication-ipv6.html">
20.5.5 Support For IPv6 And For Mixed IPv6 And IPv4 Groups
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="group-replication-enterprise-backup.html">
20.5.6 Using MySQL Enterprise Backup with Group Replication
</a>
</span>
</dt>
</dl>
</div>
<a class="indexterm" name="idm46045133625440">
</a>
<p>
This section explains common operations for managing groups.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/telemetry-trace.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title">
<a name="telemetry-trace">
</a>
35.3 OpenTelemetry Trace
</h2>
</div>
</div>
</div>
<div class="toc">
<dl class="toc">
<dt>
<span class="section">
<a href="telemetry-trace-configuration.html">
35.3.1 Configuring Trace Telemetry
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="telemetry-trace-format.html">
35.3.2 Trace Format
</a>
</span>
</dt>
</dl>
</div>
<p>
Tracing telemetry enables you to visualize the flow of any
processing action as it is processed through your server. The data
for each action, a span, includes possible error information and
timing data. Traces are generated for
<code class="literal">
COM_QUERY
</code>
commands executed, including non-query commands such as
<code class="literal">
COM_PING
</code>
, or
<code class="literal">
COM_STMT_CLOSE
</code>
.
Query statement traces also have an associated SQL text attribute.
</p>
<p>
Telemetry tracing is implemented in:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
MySQL Enterprise Edition Telemetry Component
</p>
</li>
<li class="listitem">
<p>
MySQL Enterprise Edition Client
</p>
</li>
<li class="listitem">
<p>
MySQL Connectors
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/optimizing-memory-tables.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title">
<a name="optimizing-memory-tables">
</a>
10.7 Optimizing for MEMORY Tables
</h2>
</div>
</div>
</div>
<a class="indexterm" name="idm46045225633552">
</a>
<p>
Consider using
<code class="literal">
MEMORY
</code>
tables for noncritical
data that is accessed often, and is read-only or rarely updated.
Benchmark your application against equivalent
<code class="literal">
InnoDB
</code>
or
<code class="literal">
MyISAM
</code>
tables
under a realistic workload, to confirm that any additional
performance is worth the risk of losing data, or the overhead of
copying data from a disk-based table at application start.
</p>
<p>
For best performance with
<code class="literal">
MEMORY
</code>
tables,
examine the kinds of queries against each table, and specify the
type to use for each associated index, either a B-tree index or a
hash index. On the
<a class="link" href="create-index.html" title="15.1.15 CREATE INDEX Statement">
<code class="literal">
CREATE INDEX
</code>
</a>
statement, use the clause
<code class="literal">
USING BTREE
</code>
or
<code class="literal">
USING HASH
</code>
. B-tree indexes are fast for queries
that do greater-than or less-than comparisons through operators
such as
<code class="literal">
>
</code>
or
<code class="literal">
BETWEEN
</code>
.
Hash indexes are only fast for queries that look up single values
through the
<code class="literal">
=
</code>
operator, or a restricted set of
values through the
<code class="literal">
IN
</code>
operator. For why
<code class="literal">
USING BTREE
</code>
is often a better choice than the
default
<code class="literal">
USING HASH
</code>
, 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 implementation details
of the different types of
<code class="literal">
MEMORY
</code>
indexes, see
<a class="xref" href="index-btree-hash.html" title="10.3.9 Comparison of B-Tree and Hash Indexes">
Section 10.3.9, “Comparison of B-Tree and Hash Indexes”
</a>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/replication-threads-monitor-main.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="replication-threads-monitor-main">
</a>
19.2.3.1 Monitoring Replication Main Threads
</h4>
</div>
</div>
</div>
<p>
The
<a class="link" href="show-processlist.html" title="15.7.7.31 SHOW PROCESSLIST Statement">
<code class="literal">
SHOW PROCESSLIST
</code>
</a>
statement
provides information that tells you what is happening on the
source and on the replica regarding replication. For information
on source states, see
<a class="xref" href="source-thread-states.html" title="10.14.4 Replication Source Thread States">
Section 10.14.4, “Replication Source Thread States”
</a>
.
For replica states, see
<a class="xref" href="replica-io-thread-states.html" title="10.14.5 Replication I/O (Receiver) Thread States">
Section 10.14.5, “Replication I/O (Receiver) Thread States”
</a>
, and
<a class="xref" href="replica-sql-thread-states.html" title="10.14.6 Replication SQL Thread States">
Section 10.14.6, “Replication SQL Thread States”
</a>
.
</p>
<p>
The following example illustrates how the three main replication
threads, the binary log dump thread, replication I/O (receiver)
thread, and replication SQL (applier) thread, show up in the
output from
<a class="link" href="show-processlist.html" title="15.7.7.31 SHOW PROCESSLIST Statement">
<code class="literal">
SHOW PROCESSLIST
</code>
</a>
.
</p>
<p>
On the source server, the output from
<a class="link" href="show-processlist.html" title="15.7.7.31 SHOW PROCESSLIST Statement">
<code class="literal">
SHOW
PROCESSLIST
</code>
</a>
looks like this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa53453033"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">PROCESSLIST</span>\G
<span class="token output"><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span> 1. row <span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span>
Id<span class="token punctuation">:</span> 2
User<span class="token punctuation">:</span> root
Host<span class="token punctuation">:</span> localhost<span class="token punctuation">:</span>32931
db<span class="token punctuation">:</span> NULL
Command<span class="token punctuation">:</span> Binlog Dump
Time<span class="token punctuation">:</span> 94
State<span class="token punctuation">:</span> Has sent all binlog to slave; waiting for binlog to
be updated
Info<span class="token punctuation">:</span> NULL</span></code></pre>
</div>
<p>
Here, thread 2 is a
<code class="literal">
Binlog Dump
</code>
thread that
services a connected replica. The
<code class="literal">
State
</code>
information indicates that all outstanding updates have been
sent to the replica and that the source is waiting for more
updates to occur. If you see no
<code class="literal">
Binlog Dump
</code>
threads on a source server, this means that replication is not
running; that is, no replicas are currently connected.
</p>
<p>
On a replica server, the output from
<a class="link" href="show-processlist.html" title="15.7.7.31 SHOW PROCESSLIST Statement">
<code class="literal">
SHOW
PROCESSLIST
</code>
</a>
looks like this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa82414362"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">PROCESSLIST</span>\G
<span class="token output"><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span> 1. row <span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span>
Id<span class="token punctuation">:</span> 10
User<span class="token punctuation">:</span> system user
Host<span class="token punctuation">:</span>
db<span class="token punctuation">:</span> NULL
Command<span class="token punctuation">:</span> Connect
Time<span class="token punctuation">:</span> 11
State<span class="token punctuation">:</span> Waiting for master to send event
Info<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>
Id<span class="token punctuation">:</span> 11
User<span class="token punctuation">:</span> system user
Host<span class="token punctuation">:</span>
db<span class="token punctuation">:</span> NULL
Command<span class="token punctuation">:</span> Connect
Time<span class="token punctuation">:</span> 11
State<span class="token punctuation">:</span> Has read all relay log; waiting for the slave I/O
thread to update it
Info<span class="token punctuation">:</span> NULL</span></code></pre>
</div>
<p>
The
<code class="literal">
State
</code>
information indicates that thread
10 is the replication I/O (receiver) thread that is
communicating with the source server, and thread 11 is the
replication SQL (applier) thread that is processing the updates
stored in the relay logs. At the time that
<a class="link" href="show-processlist.html" title="15.7.7.31 SHOW PROCESSLIST Statement">
<code class="literal">
SHOW PROCESSLIST
</code>
</a>
was run, both
threads were idle, waiting for further updates.
</p>
<p>
The value in the
<code class="literal">
Time
</code>
column can show how
late the replica is compared to the source. See
<a class="xref" href="faqs-replication.html" title="A.14 MySQL 8.4 FAQ: Replication">
Section A.14, “MySQL 8.4 FAQ: Replication”
</a>
. If sufficient time elapses
on the source side without activity on the
<code class="literal">
Binlog
Dump
</code>
thread, the source determines that the replica is
no longer connected. As for any other client connection, the
timeouts for this depend on the values of
<code class="option">
net_write_timeout
</code>
and
<code class="option">
net_retry_count
</code>
; for more information about
these, see
<a class="xref" href="server-system-variables.html" title="7.1.8 Server System Variables">
Section 7.1.8, “Server System Variables”
</a>
.
</p>
<p>
The
<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>
statement
provides additional information about replication processing on
a replica server. See
<a class="xref" href="replication-administration-status.html" title="19.1.7.1 Checking Replication Status">
Section 19.1.7.1, “Checking Replication Status”
</a>
.
</p>
<p>
You can also retrieve information on the source's
<code class="literal">
Binlog Dump
</code>
threads with the following:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa2700930"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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> performance_schema<span class="token punctuation">.</span>threads <span class="token keyword">WHERE</span> PROCESSLIST_COMMAND <span class="token operator">LIKE</span> <span class="token string">"Binlog Dump%"</span></code></pre>
</div>
<p>
<code class="literal">
Binlog Dump%
</code>
is used to retrieve either
<code class="literal">
Binlog Dump
</code>
or
<code class="literal">
Binlog Dump
GTID
</code>
, depending on which mode binlog dumping is in.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/partitioning-management-hash-key.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="partitioning-management-hash-key">
</a>
26.3.2 Management of HASH and KEY Partitions
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045083734704">
</a>
<a class="indexterm" name="idm46045083733216">
</a>
<a class="indexterm" name="idm46045083731728">
</a>
<a class="indexterm" name="idm46045083730240">
</a>
<p>
Tables which are partitioned by hash or by key are very similar
to one another with regard to making changes in a partitioning
setup, and both differ in a number of ways from tables which
have been partitioned by range or list. For that reason, this
section addresses the modification of tables partitioned by hash
or by key only. For a discussion of adding and dropping of
partitions of tables that are partitioned by range or list, see
<a class="xref" href="partitioning-management-range-list.html" title="26.3.1 Management of RANGE and LIST Partitions">
Section 26.3.1, “Management of RANGE and LIST Partitions”
</a>
.
</p>
<p>
You cannot drop partitions from tables that are partitioned by
<code class="literal">
HASH
</code>
or
<code class="literal">
KEY
</code>
in the same
way that you can from tables that are partitioned by
<code class="literal">
RANGE
</code>
or
<code class="literal">
LIST
</code>
. However,
you can merge
<code class="literal">
HASH
</code>
or
<code class="literal">
KEY
</code>
partitions using
<code class="literal">
ALTER TABLE ... COALESCE
PARTITION
</code>
. Suppose that a
<code class="literal">
clients
</code>
table containing data about clients is divided into 12
partitions, created as shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa79414721"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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> clients <span class="token punctuation">(</span>
id <span class="token datatype">INT</span><span class="token punctuation">,</span>
fname <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">30</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
lname <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">30</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">signed</span> <span class="token datatype">DATE</span>
<span class="token punctuation">)</span>
<span class="token keyword">PARTITION</span> <span class="token keyword">BY</span> <span class="token keyword">HASH</span><span class="token punctuation">(</span> <span class="token function">MONTH</span><span class="token punctuation">(</span><span class="token keyword">signed</span><span class="token punctuation">)</span> <span class="token punctuation">)</span>
<span class="token keyword">PARTITIONS</span> <span class="token number">12</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
To reduce the number of partitions from 12 to 8, execute the
following
<a class="link" href="alter-table-partition-operations.html" title="15.1.9.1 ALTER TABLE Partition Operations">
<code class="literal">
ALTER
TABLE
</code>
</a>
statement:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa47927222"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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> clients <span class="token keyword">COALESCE</span> <span class="token keyword">PARTITION</span> <span class="token number">4</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 0 rows affected (0.02 sec)</span></code></pre>
</div>
<p>
<code class="literal">
COALESCE
</code>
works equally well with tables that
are partitioned by
<code class="literal">
HASH
</code>
,
<code class="literal">
KEY
</code>
,
<code class="literal">
LINEAR HASH
</code>
, or
<code class="literal">
LINEAR KEY
</code>
. Here is an example similar to the
previous one, differing only in that the table is partitioned by
<code class="literal">
LINEAR KEY
</code>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa81483131"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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> clients_lk <span class="token punctuation">(</span>
<span class="token prompt"> -></span> id <span class="token datatype">INT</span><span class="token punctuation">,</span>
<span class="token prompt"> -></span> fname <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">30</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token prompt"> -></span> lname <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">30</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token prompt"> -></span> <span class="token keyword">signed</span> <span class="token datatype">DATE</span>
<span class="token prompt"> -></span> <span class="token punctuation">)</span>
<span class="token prompt"> -></span> <span class="token keyword">PARTITION</span> <span class="token keyword">BY</span> <span class="token keyword">LINEAR</span> <span class="token keyword">KEY</span><span class="token punctuation">(</span><span class="token keyword">signed</span><span class="token punctuation">)</span>
<span class="token prompt"> -></span> <span class="token keyword">PARTITIONS</span> <span class="token number">12</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 0 rows affected (0.03 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">ALTER</span> <span class="token keyword">TABLE</span> clients_lk <span class="token keyword">COALESCE</span> <span class="token keyword">PARTITION</span> <span class="token number">4</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 0 rows affected (0.06 sec)</span>
<span class="token output">Records: 0 Duplicates: 0 Warnings: 0</span></code></pre>
</div>
<p>
The number following
<code class="literal">
COALESCE PARTITION
</code>
is
the number of partitions to merge into the remainder—in
other words, it is the number of partitions to remove from the
table.
</p>
<p>
Attempting to remove more partitions than are in the table
results in an error like this one:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa14288683"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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> clients <span class="token keyword">COALESCE</span> <span class="token keyword">PARTITION</span> <span class="token number">18</span><span class="token punctuation">;</span>
<span class="token output">ERROR 1478 (HY000)<span class="token punctuation">:</span> Cannot remove all partitions, use DROP TABLE instead</span></code></pre>
</div>
<p>
To increase the number of partitions for the
<code class="literal">
clients
</code>
table from 12 to 18, use
<code class="literal">
ALTER TABLE ... ADD PARTITION
</code>
as shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa48382134"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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> clients <span class="token keyword">ADD</span> <span class="token keyword">PARTITION</span> <span class="token keyword">PARTITIONS</span> <span class="token number">6</span><span class="token punctuation">;</span></code></pre>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/group-replication-functions-for-communication-protocol.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="group-replication-functions-for-communication-protocol">
</a>
14.18.1.4 Functions to Inspect and Set the Group Replication Communication
Protocol Version
</h4>
</div>
</div>
</div>
<p>
The following functions enable you to inspect and configure
the Group Replication communication protocol version that is
used by a replication group.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="xref" href="group-replication-message-compression.html" title="20.7.4 Message Compression">
Section 20.7.4, “Message Compression”
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="group-replication-performance-message-fragmentation.html" title="20.7.5 Message Fragmentation">
Section 20.7.5, “Message Fragmentation”
</a>
</p>
</li>
<li class="listitem">
<p>
<a class="xref" href="group-replication-single-consensus-leader.html" title="20.7.3 Single Consensus Leader">
Section 20.7.3, “Single Consensus Leader”
</a>
</p>
</li>
</ul>
</div>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a name="function_group-replication-get-communication-protocol">
</a>
<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>
</p>
<a class="indexterm" name="idm46045193806336">
</a>
<a class="indexterm" name="idm46045193805232">
</a>
<p>
Inspect the Group Replication communication protocol
version that is currently in use for a group.
</p>
<p>
Syntax:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-clike"><div class="docs-select-all right" id="sa80884479"><div class="copy-help left">Press ⌘+C to 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_get_communication_protocol</span><span class="token punctuation">(</span><span class="token punctuation">)</span></code></pre>
</div>
<p>
This function has no parameters.
</p>
<p>
Return value:
</p>
<p>
The oldest MySQL Server version that can join this group
and use the group's communication protocol. Note that
the
<a class="link" href="group-replication-functions-for-communication-protocol.html#function_group-replication-get-communication-protocol">
<code class="literal">
group_replication_get_communication_protocol()
</code>
</a>
function returns the minimum MySQL version that the group
supports, which might differ from the version number that
was passed to
<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>
,
and from the MySQL Server version that is installed on the
member where you use the function.
</p>
<p>
If the protocol cannot be inspected because this server
instance does not belong to a replication group, an error
is returned as a string.
</p>
<p>
Example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa13525648"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SELECT</span> group_replication_get_communication_protocol<span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> group_replication_get_communication_protocol() <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 8.4.3 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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, 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>
<li class="listitem">
<p>
<a name="function_group-replication-set-communication-protocol">
</a>
<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>
</p>
<a class="indexterm" name="idm46045193790576">
</a>
<a class="indexterm" name="idm46045193789472">
</a>
<p>
Downgrade the Group Replication communication protocol
version of a group so that members at earlier releases can
join, or upgrade the Group Replication communication
protocol version of a group after upgrading MySQL Server
on all members. The
<a class="link" href="privileges-provided.html#priv_group-replication-admin">
<code class="literal">
GROUP_REPLICATION_ADMIN
</code>
</a>
privilege is required to use this function, and all
existing group members must be online when you issue the
statement, with no loss of majority.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
For MySQL InnoDB cluster, the communication protocol
version is managed automatically whenever the cluster
topology is changed using AdminAPI operations. You do
not have to use these functions yourself for an InnoDB
cluster.
</p>
</div>
<p>
Syntax:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-clike"><div class="docs-select-all right" id="sa88979436"><div class="copy-help left">Press ⌘+C to 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_set_communication_protocol</span><span class="token punctuation">(</span><em class="replaceable">version</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>
version
</code>
</em>
: For a downgrade,
specify the MySQL Server version of the prospective
group member that has the oldest installed server
version. In this case, the command makes the group
fall back to a communication protocol compatible with
that server version if possible. The minimum server
version that you can specify is MySQL 5.7.14. For an
upgrade, specify the new MySQL Server version to which
the existing group members have been upgraded.
</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="sa38721772"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SELECT</span> group_replication_set_communication_protocol<span class="token punctuation">(</span><span class="token string">"5.7.25"</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
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>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/window-functions-named-windows.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="window-functions-named-windows">
</a>
14.20.4 Named Windows
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045191776896">
</a>
<a class="indexterm" name="idm46045191775408">
</a>
<p>
Windows can be defined and given names by which to refer to them
in
<code class="literal">
OVER
</code>
clauses. To do this, use a
<code class="literal">
WINDOW
</code>
clause. If present in a query, the
<code class="literal">
WINDOW
</code>
clause falls between the positions of
the
<code class="literal">
HAVING
</code>
and
<code class="literal">
ORDER BY
</code>
clauses, and has this syntax:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa32405680"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">WINDOW</span> <em class="replaceable">window_name</em> <span class="token keyword">AS</span> <span class="token punctuation">(</span><em class="replaceable">window_spec</em><span class="token punctuation">)</span>
<span class="token punctuation">[</span><span class="token punctuation">,</span> <em class="replaceable">window_name</em> <span class="token keyword">AS</span> <span class="token punctuation">(</span><em class="replaceable">window_spec</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>
For each window definition,
<em class="replaceable">
<code>
window_name
</code>
</em>
is the window name, and
<em class="replaceable">
<code>
window_spec
</code>
</em>
is the same type of
window specification as given between the parentheses of an
<code class="literal">
OVER
</code>
clause, as described in
<a class="xref" href="window-functions-usage.html" title="14.20.2 Window Function Concepts and Syntax">
Section 14.20.2, “Window Function Concepts and Syntax”
</a>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa18744139"><div class="copy-help left">Press ⌘+C to copy</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">window_spec</em>:
<span class="token punctuation">[</span><em class="replaceable">window_name</em><span class="token punctuation">]</span> <span class="token punctuation">[</span><em class="replaceable">partition_clause</em><span class="token punctuation">]</span> <span class="token punctuation">[</span><em class="replaceable">order_clause</em><span class="token punctuation">]</span> <span class="token punctuation">[</span><em class="replaceable">frame_clause</em><span class="token punctuation">]</span></code></pre>
</div>
<p>
A
<code class="literal">
WINDOW
</code>
clause is useful for queries in
which multiple
<code class="literal">
OVER
</code>
clauses would otherwise
define the same window. Instead, you can define the window once,
give it a name, and refer to the name in the
<code class="literal">
OVER
</code>
clauses. Consider this query, which
defines the same window multiple times:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa75536678"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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>
val<span class="token punctuation">,</span>
<span class="token function">ROW_NUMBER</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token keyword">OVER</span> <span class="token punctuation">(</span><span class="token keyword">ORDER</span> <span class="token keyword">BY</span> val<span class="token punctuation">)</span> <span class="token keyword">AS</span> <span class="token string">'row_number'</span><span class="token punctuation">,</span>
<span class="token function">RANK</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token keyword">OVER</span> <span class="token punctuation">(</span><span class="token keyword">ORDER</span> <span class="token keyword">BY</span> val<span class="token punctuation">)</span> <span class="token keyword">AS</span> <span class="token string">'rank'</span><span class="token punctuation">,</span>
<span class="token function">DENSE_RANK</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token keyword">OVER</span> <span class="token punctuation">(</span><span class="token keyword">ORDER</span> <span class="token keyword">BY</span> val<span class="token punctuation">)</span> <span class="token keyword">AS</span> <span class="token string">'dense_rank'</span>
<span class="token keyword">FROM</span> numbers<span class="token punctuation">;</span></code></pre>
</div>
<p>
The query can be written more simply by using
<code class="literal">
WINDOW
</code>
to define the window once and
referring to the window by name in the
<code class="literal">
OVER
</code>
clauses:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa66633455"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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>
val<span class="token punctuation">,</span>
<span class="token function">ROW_NUMBER</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token keyword">OVER</span> w <span class="token keyword">AS</span> <span class="token string">'row_number'</span><span class="token punctuation">,</span>
<span class="token function">RANK</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token keyword">OVER</span> w <span class="token keyword">AS</span> <span class="token string">'rank'</span><span class="token punctuation">,</span>
<span class="token function">DENSE_RANK</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token keyword">OVER</span> w <span class="token keyword">AS</span> <span class="token string">'dense_rank'</span>
<span class="token keyword">FROM</span> numbers
<span class="token keyword">WINDOW</span> w <span class="token keyword">AS</span> <span class="token punctuation">(</span><span class="token keyword">ORDER</span> <span class="token keyword">BY</span> val<span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
A named window also makes it easier to experiment with the
window definition to see the effect on query results. You need
only modify the window definition in the
<code class="literal">
WINDOW
</code>
clause, rather than multiple
<code class="literal">
OVER
</code>
clause definitions.
</p>
<p>
If an
<code class="literal">
OVER
</code>
clause uses
<code class="literal">
OVER
(
<em class="replaceable">
<code>
window_name
</code>
</em>
...)
</code>
rather
than
<code class="literal">
OVER
<em class="replaceable">
<code>
window_name
</code>
</em>
</code>
, the named
window can be modified by the addition of other clauses. For
example, this query defines a window that includes partitioning,
and uses
<code class="literal">
ORDER BY
</code>
in the
<code class="literal">
OVER
</code>
clauses to modify the window in
different ways:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa21721618"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SELECT</span>
<span class="token keyword">DISTINCT</span> <span class="token datatype">year</span><span class="token punctuation">,</span> country<span class="token punctuation">,</span>
<span class="token function">FIRST_VALUE</span><span class="token punctuation">(</span><span class="token datatype">year</span><span class="token punctuation">)</span> <span class="token keyword">OVER</span> <span class="token punctuation">(</span>w <span class="token keyword">ORDER</span> <span class="token keyword">BY</span> <span class="token datatype">year</span> <span class="token keyword">ASC</span><span class="token punctuation">)</span> <span class="token keyword">AS</span> <span class="token keyword">first</span><span class="token punctuation">,</span>
<span class="token function">FIRST_VALUE</span><span class="token punctuation">(</span><span class="token datatype">year</span><span class="token punctuation">)</span> <span class="token keyword">OVER</span> <span class="token punctuation">(</span>w <span class="token keyword">ORDER</span> <span class="token keyword">BY</span> <span class="token datatype">year</span> <span class="token keyword">DESC</span><span class="token punctuation">)</span> <span class="token keyword">AS</span> <span class="token keyword">last</span>
<span class="token keyword">FROM</span> sales
<span class="token keyword">WINDOW</span> w <span class="token keyword">AS</span> <span class="token punctuation">(</span><span class="token keyword">PARTITION</span> <span class="token keyword">BY</span> country<span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
An
<code class="literal">
OVER
</code>
clause can only add properties to a
named window, not modify them. If the named window definition
includes a partitioning, ordering, or framing property, the
<code class="literal">
OVER
</code>
clause that refers to the window name
cannot also include the same kind of property or an error
occurs:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
This construct is permitted because the window definition
and the referring
<code class="literal">
OVER
</code>
clause do not
contain the same kind of properties:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa42050195"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">OVER</span> <span class="token punctuation">(</span>w <span class="token keyword">ORDER</span> <span class="token keyword">BY</span> country<span class="token punctuation">)</span>
<span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span> <span class="token keyword">WINDOW</span> w <span class="token keyword">AS</span> <span class="token punctuation">(</span><span class="token keyword">PARTITION</span> <span class="token keyword">BY</span> country<span class="token punctuation">)</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
This construct is not permitted because the
<code class="literal">
OVER
</code>
clause specifies
<code class="literal">
PARTITION
BY
</code>
for a named window that already has
<code class="literal">
PARTITION BY
</code>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa7991103"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">OVER</span> <span class="token punctuation">(</span>w <span class="token keyword">PARTITION</span> <span class="token keyword">BY</span> <span class="token datatype">year</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">WINDOW</span> w <span class="token keyword">AS</span> <span class="token punctuation">(</span><span class="token keyword">PARTITION</span> <span class="token keyword">BY</span> country<span class="token punctuation">)</span></code></pre>
</div>
</li>
</ul>
</div>
<p>
The definition of a named window can itself begin with a
<em class="replaceable">
<code>
window_name
</code>
</em>
. In such cases, forward
and backward references are permitted, but not cycles:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
This is permitted; it contains forward and backward
references but no cycles:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa61675262"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">WINDOW</span> w1 <span class="token keyword">AS</span> <span class="token punctuation">(</span>w2<span class="token punctuation">)</span><span class="token punctuation">,</span> w2 <span class="token keyword">AS</span> <span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">,</span> w3 <span class="token keyword">AS</span> <span class="token punctuation">(</span>w1<span class="token punctuation">)</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
This is not permitted because it contains a cycle:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa94529933"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">WINDOW</span> w1 <span class="token keyword">AS</span> <span class="token punctuation">(</span>w2<span class="token punctuation">)</span><span class="token punctuation">,</span> w2 <span class="token keyword">AS</span> <span class="token punctuation">(</span>w3<span class="token punctuation">)</span><span class="token punctuation">,</span> w3 <span class="token keyword">AS</span> <span class="token punctuation">(</span>w1<span class="token punctuation">)</span></code></pre>
</div>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/permission-optimization.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="permission-optimization">
</a>
10.2.6 Optimizing Database Privileges
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045227611008">
</a>
<a class="indexterm" name="idm46045227609552">
</a>
<p>
The more complex your privilege setup, the more overhead applies
to all SQL statements. Simplifying the privileges established by
<a class="link" href="grant.html" title="15.7.1.6 GRANT Statement">
<code class="literal">
GRANT
</code>
</a>
statements enables MySQL to
reduce permission-checking overhead when clients execute
statements. For example, if you do not grant any table-level or
column-level privileges, the server need not ever check the
contents of the
<code class="literal">
tables_priv
</code>
and
<code class="literal">
columns_priv
</code>
tables. Similarly, if you place
no resource limits on any accounts, the server does not have to
perform resource counting. If you have a very high
statement-processing load, consider using a simplified grant
structure to reduce permission-checking overhead.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/show-procedure-status.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="show-procedure-status">
</a>
15.7.7.30 SHOW PROCEDURE STATUS Statement
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045169953648">
</a>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa34616638"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">STATUS</span>
<span class="token punctuation">[</span><span class="token operator">LIKE</span> <span class="token string">'<em class="replaceable">pattern</em>'</span> <span class="token operator">|</span> <span class="token keyword">WHERE</span> <em class="replaceable">expr</em><span class="token punctuation">]</span></code></pre>
</div>
<p>
This statement is a MySQL extension. It returns characteristics
of a stored procedure, such as the database, name, type,
creator, creation and modification dates, and character set
information. A similar statement,
<a class="link" href="show-function-status.html" title="15.7.7.21 SHOW FUNCTION STATUS Statement">
<code class="literal">
SHOW
FUNCTION STATUS
</code>
</a>
, displays information about stored
functions (see
<a class="xref" href="show-function-status.html" title="15.7.7.21 SHOW FUNCTION STATUS Statement">
Section 15.7.7.21, “SHOW FUNCTION STATUS 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, have the
<a class="link" href="privileges-provided.html#priv_select">
<code class="literal">
SELECT
</code>
</a>
privilege at the global
level, or have the
<a class="link" href="privileges-provided.html#priv_create-routine">
<code class="literal">
CREATE
ROUTINE
</code>
</a>
,
<a class="link" href="privileges-provided.html#priv_alter-routine">
<code class="literal">
ALTER ROUTINE
</code>
</a>
,
or
<a class="link" href="privileges-provided.html#priv_execute">
<code class="literal">
EXECUTE
</code>
</a>
privilege granted at a
scope that includes the routine.
</p>
<p>
The
<a class="link" href="string-comparison-functions.html#operator_like">
<code class="literal">
LIKE
</code>
</a>
clause, if present,
indicates which procedure or function names to match. The
<code class="literal">
WHERE
</code>
clause can be given to select rows
using more general conditions, as discussed in
<a class="xref" href="extended-show.html" title="28.8 Extensions to SHOW Statements">
Section 28.8, “Extensions to SHOW Statements”
</a>
.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa16724578"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">PROCEDURE</span> <span class="token keyword">STATUS</span> <span class="token operator">LIKE</span> <span class="token string">'sp1'</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>
Db<span class="token punctuation">:</span> test
Name<span class="token punctuation">:</span> sp1
Type<span class="token punctuation">:</span> PROCEDURE
Definer<span class="token punctuation">:</span> testuser@localhost
Modified<span class="token punctuation">:</span> 2018-08-08 13<span class="token punctuation">:</span>54<span class="token punctuation">:</span>11
Created<span class="token punctuation">:</span> 2018-08-08 13<span class="token punctuation">:</span>54<span class="token punctuation">:</span>11
Security_type<span class="token punctuation">:</span> DEFINER
Comment<span class="token punctuation">:</span>
character_set_client<span class="token punctuation">:</span> utf8mb4
collation_connection<span class="token punctuation">:</span> utf8mb4_0900_ai_ci
Database Collation<span class="token punctuation">:</span> utf8mb4_0900_ai_ci
</span>
<span class="token prompt">mysql></span> <span class="token keyword">SHOW</span> <span class="token keyword">FUNCTION</span> <span class="token keyword">STATUS</span> <span class="token operator">LIKE</span> <span class="token string">'hello'</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>
Db<span class="token punctuation">:</span> test
Name<span class="token punctuation">:</span> hello
Type<span class="token punctuation">:</span> FUNCTION
Definer<span class="token punctuation">:</span> testuser@localhost
Modified<span class="token punctuation">:</span> 2020-03-10 11<span class="token punctuation">:</span>10<span class="token punctuation">:</span>03
Created<span class="token punctuation">:</span> 2020-03-10 11<span class="token punctuation">:</span>10<span class="token punctuation">:</span>03
Security_type<span class="token punctuation">:</span> DEFINER
Comment<span class="token punctuation">:</span>
character_set_client<span class="token punctuation">:</span> utf8mb4
collation_connection<span class="token punctuation">:</span> utf8mb4_0900_ai_ci
Database Collation<span class="token punctuation">:</span> utf8mb4_0900_ai_ci</span></code></pre>
</div>
<p>
<code class="literal">
character_set_client
</code>
is the session value of
the
<a class="link" href="server-system-variables.html#sysvar_character_set_client">
<code class="literal">
character_set_client
</code>
</a>
system
variable when the routine was created.
<code class="literal">
collation_connection
</code>
is the session value of
the
<a class="link" href="server-system-variables.html#sysvar_collation_connection">
<code class="literal">
collation_connection
</code>
</a>
system
variable when the routine was created.
<code class="literal">
Database
Collation
</code>
is the collation of the database with which
the routine is associated.
</p>
<p>
Stored routine information is also available from the
<code class="literal">
INFORMATION_SCHEMA
</code>
<a class="link" href="information-schema-parameters-table.html" title="28.3.20 The INFORMATION_SCHEMA PARAMETERS Table">
<code class="literal">
PARAMETERS
</code>
</a>
and
<a class="link" href="information-schema-routines-table.html" title="28.3.30 The INFORMATION_SCHEMA ROUTINES Table">
<code class="literal">
ROUTINES
</code>
</a>
tables. See
<a class="xref" href="information-schema-parameters-table.html" title="28.3.20 The INFORMATION_SCHEMA PARAMETERS Table">
Section 28.3.20, “The INFORMATION_SCHEMA PARAMETERS Table”
</a>
, and
<a class="xref" href="information-schema-routines-table.html" title="28.3.30 The INFORMATION_SCHEMA ROUTINES Table">
Section 28.3.30, “The INFORMATION_SCHEMA ROUTINES Table”
</a>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/performance-schema-statement-summary-tables.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="performance-schema-statement-summary-tables">
</a>
29.12.20.3 Statement Summary Tables
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045068967088">
</a>
<a class="indexterm" name="idm46045068965552">
</a>
<a class="indexterm" name="idm46045068964016">
</a>
<a class="indexterm" name="idm46045068962560">
</a>
<a class="indexterm" name="idm46045068961040">
</a>
<a class="indexterm" name="idm46045068959520">
</a>
<a class="indexterm" name="idm46045068958000">
</a>
<a class="indexterm" name="idm46045068956480">
</a>
<a class="indexterm" name="idm46045068954960">
</a>
<a class="indexterm" name="idm46045068953440">
</a>
<a class="indexterm" name="idm46045068951920">
</a>
<a class="indexterm" name="idm46045068950400">
</a>
<a class="indexterm" name="idm46045068948880">
</a>
<a class="indexterm" name="idm46045068947360">
</a>
<a class="indexterm" name="idm46045068945840">
</a>
<a class="indexterm" name="idm46045068944336">
</a>
<p>
The Performance Schema maintains tables for collecting current
and recent statement events, and aggregates that information
in summary tables.
<a class="xref" href="performance-schema-statement-tables.html" title="29.12.6 Performance Schema Statement Event Tables">
Section 29.12.6, “Performance Schema Statement Event Tables”
</a>
describes the events on which statement summaries are based.
See that discussion for information about the content of
statement events, the current and historical statement event
tables, and how to control statement event collection, which
is partially disabled by default.
</p>
<p>
Example statement event summary information:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa525453"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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>events_statements_summary_global_by_event_name\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>
EVENT_NAME<span class="token punctuation">:</span> statement/sql/select
COUNT_STAR<span class="token punctuation">:</span> 54
SUM_TIMER_WAIT<span class="token punctuation">:</span> 38860400000
MIN_TIMER_WAIT<span class="token punctuation">:</span> 52400000
AVG_TIMER_WAIT<span class="token punctuation">:</span> 719600000
MAX_TIMER_WAIT<span class="token punctuation">:</span> 12631800000
SUM_LOCK_TIME<span class="token punctuation">:</span> 88000000
SUM_ERRORS<span class="token punctuation">:</span> 0
SUM_WARNINGS<span class="token punctuation">:</span> 0
SUM_ROWS_AFFECTED<span class="token punctuation">:</span> 0
SUM_ROWS_SENT<span class="token punctuation">:</span> 60
SUM_ROWS_EXAMINED<span class="token punctuation">:</span> 120
SUM_CREATED_TMP_DISK_TABLES<span class="token punctuation">:</span> 0
SUM_CREATED_TMP_TABLES<span class="token punctuation">:</span> 21
SUM_SELECT_FULL_JOIN<span class="token punctuation">:</span> 16
SUM_SELECT_FULL_RANGE_JOIN<span class="token punctuation">:</span> 0
SUM_SELECT_RANGE<span class="token punctuation">:</span> 0
SUM_SELECT_RANGE_CHECK<span class="token punctuation">:</span> 0
SUM_SELECT_SCAN<span class="token punctuation">:</span> 41
SUM_SORT_MERGE_PASSES<span class="token punctuation">:</span> 0
SUM_SORT_RANGE<span class="token punctuation">:</span> 0
SUM_SORT_ROWS<span class="token punctuation">:</span> 0
SUM_SORT_SCAN<span class="token punctuation">:</span> 0
SUM_NO_INDEX_USED<span class="token punctuation">:</span> 22
SUM_NO_GOOD_INDEX_USED<span class="token punctuation">:</span> 0
SUM_CPU_TIME<span class="token punctuation">:</span> 0
MAX_CONTROLLED_MEMORY<span class="token punctuation">:</span> 2028360
MAX_TOTAL_MEMORY<span class="token punctuation">:</span> 2853429
COUNT_SECONDARY<span class="token punctuation">:</span> 0
...</span></code></pre>
</div>
<p>
Each statement summary table has one or more grouping columns
to indicate how the table aggregates events. Event names refer
to names of event instruments in the
<a class="link" href="performance-schema-setup-instruments-table.html" title="29.12.2.3 The setup_instruments Table">
<code class="literal">
setup_instruments
</code>
</a>
table:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="link" href="performance-schema-statement-summary-tables.html" title="29.12.20.3 Statement Summary Tables">
<code class="literal">
events_statements_summary_by_account_by_event_name
</code>
</a>
has
<code class="literal">
EVENT_NAME
</code>
,
<code class="literal">
USER
</code>
, and
<code class="literal">
HOST
</code>
columns. Each row summarizes events for a given account
(user and host combination) and event name.
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="performance-schema-statement-summary-tables.html" title="29.12.20.3 Statement Summary Tables">
<code class="literal">
events_statements_summary_by_digest
</code>
</a>
has
<code class="literal">
SCHEMA_NAME
</code>
and
<code class="literal">
DIGEST
</code>
columns. Each row summarizes
events per schema and digest value. (The
<code class="literal">
DIGEST_TEXT
</code>
column contains the
corresponding normalized statement digest text, but is
neither a grouping nor a summary column. The
<code class="literal">
QUERY_SAMPLE_TEXT
</code>
,
<code class="literal">
QUERY_SAMPLE_SEEN
</code>
, and
<code class="literal">
QUERY_SAMPLE_TIMER_WAIT
</code>
columns also
are neither grouping nor summary columns; they support
statement sampling.)
</p>
<p>
The maximum number of rows in the table is autosized at
server startup. To set this maximum explicitly, set the
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_digests_size">
<code class="literal">
performance_schema_digests_size
</code>
</a>
system variable at server startup.
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="performance-schema-statement-summary-tables.html" title="29.12.20.3 Statement Summary Tables">
<code class="literal">
events_statements_summary_by_host_by_event_name
</code>
</a>
has
<code class="literal">
EVENT_NAME
</code>
and
<code class="literal">
HOST
</code>
columns. Each row summarizes
events for a given host and event name.
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="performance-schema-statement-summary-tables.html" title="29.12.20.3 Statement Summary Tables">
<code class="literal">
events_statements_summary_by_program
</code>
</a>
has
<code class="literal">
OBJECT_TYPE
</code>
,
<code class="literal">
OBJECT_SCHEMA
</code>
, and
<code class="literal">
OBJECT_NAME
</code>
columns. Each row
summarizes events for a given stored program (stored
procedure or function, trigger, or event).
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="performance-schema-statement-summary-tables.html" title="29.12.20.3 Statement Summary Tables">
<code class="literal">
events_statements_summary_by_thread_by_event_name
</code>
</a>
has
<code class="literal">
THREAD_ID
</code>
and
<code class="literal">
EVENT_NAME
</code>
columns. Each row summarizes
events for a given thread and event name.
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="performance-schema-statement-summary-tables.html" title="29.12.20.3 Statement Summary Tables">
<code class="literal">
events_statements_summary_by_user_by_event_name
</code>
</a>
has
<code class="literal">
EVENT_NAME
</code>
and
<code class="literal">
USER
</code>
columns. Each row summarizes
events for a given user and event name.
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="performance-schema-statement-summary-tables.html" title="29.12.20.3 Statement Summary Tables">
<code class="literal">
events_statements_summary_global_by_event_name
</code>
</a>
has an
<code class="literal">
EVENT_NAME
</code>
column. Each row
summarizes events for a given event name.
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="performance-schema-prepared-statements-instances-table.html" title="29.12.6.4 The prepared_statements_instances Table">
<code class="literal">
prepared_statements_instances
</code>
</a>
has an
<code class="literal">
OBJECT_INSTANCE_BEGIN
</code>
column.
Each row summarizes events for a given prepared statement.
</p>
</li>
</ul>
</div>
<p>
Each statement summary table has these summary columns
containing aggregated values (with exceptions as noted):
</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 are analogous to the columns of the same
names in the wait event summary tables (see
<a class="xref" href="performance-schema-wait-summary-tables.html" title="29.12.20.1 Wait Event Summary Tables">
Section 29.12.20.1, “Wait Event Summary Tables”
</a>
),
except that the statement summary tables aggregate events
from
<a class="link" href="performance-schema-events-statements-current-table.html" title="29.12.6.1 The events_statements_current Table">
<code class="literal">
events_statements_current
</code>
</a>
rather than
<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>
.
</p>
<p>
The
<a class="link" href="performance-schema-prepared-statements-instances-table.html" title="29.12.6.4 The prepared_statements_instances Table">
<code class="literal">
prepared_statements_instances
</code>
</a>
table does not have these columns.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
SUM_
<em class="replaceable">
<code>
xxx
</code>
</em>
</code>
</p>
<p>
The aggregate of the corresponding
<em class="replaceable">
<code>
xxx
</code>
</em>
column in the
<a class="link" href="performance-schema-events-statements-current-table.html" title="29.12.6.1 The events_statements_current Table">
<code class="literal">
events_statements_current
</code>
</a>
table. For example, the
<code class="literal">
SUM_LOCK_TIME
</code>
and
<code class="literal">
SUM_ERRORS
</code>
columns in statement
summary tables are the aggregates of the
<code class="literal">
LOCK_TIME
</code>
and
<code class="literal">
ERRORS
</code>
columns in
<a class="link" href="performance-schema-events-statements-current-table.html" title="29.12.6.1 The events_statements_current Table">
<code class="literal">
events_statements_current
</code>
</a>
table.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
MAX_CONTROLLED_MEMORY
</code>
</p>
<p>
Reports the maximum amount of controlled memory used by a
statement during execution.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
MAX_TOTAL_MEMORY
</code>
</p>
<p>
Reports the maximum amount of memory used by a statement
during execution.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
COUNT_SECONDARY
</code>
</p>
<p>
The number of times a query was processed on the
<code class="literal">
SECONDARY
</code>
engine. For use with HeatWave Service
and HeatWave, where the
<code class="literal">
PRIMARY
</code>
engine
is
<code class="literal">
InnoDB
</code>
and the
<code class="literal">
SECONDARY
</code>
engine is HeatWave
(
<code class="literal">
RAPID
</code>
). For MySQL Community Edition Server, MySQL Enterprise Edition Server
(on-premise), and HeatWave Service without HeatWave, queries are
always processed on the
<code class="literal">
PRIMARY
</code>
engine,
which means the value is always 0 on these MySQL Servers.
</p>
</li>
</ul>
</div>
<p>
The
<a class="link" href="performance-schema-statement-summary-tables.html" title="29.12.20.3 Statement Summary Tables">
<code class="literal">
events_statements_summary_by_digest
</code>
</a>
table has these additional summary columns:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
FIRST_SEEN
</code>
,
<code class="literal">
LAST_SEEN
</code>
</p>
<p>
Timestamps indicating when statements with the given
digest value were first seen and most recently seen.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
QUANTILE_95
</code>
: The 95th percentile of the
statement latency, in picoseconds. This percentile is a
high estimate, computed from the histogram data collected.
In other words, for a given digest, 95% of the statements
measured have a latency lower than
<code class="literal">
QUANTILE_95
</code>
.
</p>
<p>
For access to the histogram data, use the tables described
in
<a class="xref" href="performance-schema-statement-histogram-summary-tables.html" title="29.12.20.4 Statement Histogram Summary Tables">
Section 29.12.20.4, “Statement Histogram Summary Tables”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
QUANTILE_99
</code>
: Similar to
<code class="literal">
QUANTILE_95
</code>
, but for the 99th
percentile.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
QUANTILE_999
</code>
: Similar to
<code class="literal">
QUANTILE_95
</code>
, but for the 99.9th
percentile.
</p>
</li>
</ul>
</div>
<p>
The
<a class="link" href="performance-schema-statement-summary-tables.html" title="29.12.20.3 Statement Summary Tables">
<code class="literal">
events_statements_summary_by_digest
</code>
</a>
table contains the following columns. These are neither
grouping nor summary columns; they support statement sampling:
</p>
<a class="indexterm" name="idm46045068856048">
</a>
<a class="indexterm" name="idm46045068854976">
</a>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
QUERY_SAMPLE_TEXT
</code>
</p>
<p>
A sample SQL statement that produces the digest value in
the row. This column enables applications to access, for a
given digest value, a statement actually seen by the
server that produces that digest. One use for this might
be to run
<a class="link" href="explain.html" title="15.8.2 EXPLAIN Statement">
<code class="literal">
EXPLAIN
</code>
</a>
on the
statement to examine the execution plan for a
representative statement associated with a frequently
occurring digest.
</p>
<p>
When the
<code class="literal">
QUERY_SAMPLE_TEXT
</code>
column is
assigned a value, the
<code class="literal">
QUERY_SAMPLE_SEEN
</code>
and
<code class="literal">
QUERY_SAMPLE_TIMER_WAIT
</code>
columns are
assigned values as well.
</p>
<p>
The maximum space available for statement display is 1024
bytes by default. To change this value, set the
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_max_sql_text_length">
<code class="literal">
performance_schema_max_sql_text_length
</code>
</a>
system variable at server startup. (Changing this value
affects columns in other Performance Schema tables as
well. See
<a class="xref" href="performance-schema-statement-digests.html" title="29.10 Performance Schema Statement Digests and Sampling">
Section 29.10, “Performance Schema Statement Digests and Sampling”
</a>
.)
</p>
<p>
For information about statement sampling, see
<a class="xref" href="performance-schema-statement-digests.html" title="29.10 Performance Schema Statement Digests and Sampling">
Section 29.10, “Performance Schema Statement Digests and Sampling”
</a>
.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
QUERY_SAMPLE_SEEN
</code>
</p>
<p>
A timestamp indicating when the statement in the
<code class="literal">
QUERY_SAMPLE_TEXT
</code>
column was seen.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
QUERY_SAMPLE_TIMER_WAIT
</code>
</p>
<p>
The wait time for the sample statement in the
<code class="literal">
QUERY_SAMPLE_TEXT
</code>
column.
</p>
</li>
</ul>
</div>
<p>
The
<a class="link" href="performance-schema-statement-summary-tables.html" title="29.12.20.3 Statement Summary Tables">
<code class="literal">
events_statements_summary_by_program
</code>
</a>
table has these additional summary columns:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
COUNT_STATEMENTS
</code>
,
<code class="literal">
SUM_STATEMENTS_WAIT
</code>
,
<code class="literal">
MIN_STATEMENTS_WAIT
</code>
,
<code class="literal">
AVG_STATEMENTS_WAIT
</code>
,
<code class="literal">
MAX_STATEMENTS_WAIT
</code>
</p>
<p>
Statistics about nested statements invoked during stored
program execution.
</p>
</li>
</ul>
</div>
<p>
The
<a class="link" href="performance-schema-prepared-statements-instances-table.html" title="29.12.6.4 The prepared_statements_instances Table">
<code class="literal">
prepared_statements_instances
</code>
</a>
table has these additional summary columns:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
COUNT_EXECUTE
</code>
,
<code class="literal">
SUM_TIMER_EXECUTE
</code>
,
<code class="literal">
MIN_TIMER_EXECUTE
</code>
,
<code class="literal">
AVG_TIMER_EXECUTE
</code>
,
<code class="literal">
MAX_TIMER_EXECUTE
</code>
</p>
<p>
Aggregated statistics for executions of the prepared
statement.
</p>
</li>
</ul>
</div>
<p>
The statement summary tables have these indexes:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="link" href="performance-schema-transaction-summary-tables.html" title="29.12.20.5 Transaction Summary Tables">
<code class="literal">
events_transactions_summary_by_account_by_event_name
</code>
</a>
:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
Primary key on (
<code class="literal">
USER
</code>
,
<code class="literal">
HOST
</code>
,
<code class="literal">
EVENT_NAME
</code>
)
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
<a class="link" href="performance-schema-statement-summary-tables.html" title="29.12.20.3 Statement Summary Tables">
<code class="literal">
events_statements_summary_by_digest
</code>
</a>
:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
Primary key on (
<code class="literal">
SCHEMA_NAME
</code>
,
<code class="literal">
DIGEST
</code>
)
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
<a class="link" href="performance-schema-transaction-summary-tables.html" title="29.12.20.5 Transaction Summary Tables">
<code class="literal">
events_transactions_summary_by_host_by_event_name
</code>
</a>
:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
Primary key on (
<code class="literal">
HOST
</code>
,
<code class="literal">
EVENT_NAME
</code>
)
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
<a class="link" href="performance-schema-statement-summary-tables.html" title="29.12.20.3 Statement Summary Tables">
<code class="literal">
events_statements_summary_by_program
</code>
</a>
:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
Primary key on (
<code class="literal">
OBJECT_TYPE
</code>
,
<code class="literal">
OBJECT_SCHEMA
</code>
,
<code class="literal">
OBJECT_NAME
</code>
)
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
<a class="link" href="performance-schema-statement-summary-tables.html" title="29.12.20.3 Statement Summary Tables">
<code class="literal">
events_statements_summary_by_thread_by_event_name
</code>
</a>
:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
Primary key on (
<code class="literal">
THREAD_ID
</code>
,
<code class="literal">
EVENT_NAME
</code>
)
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
<a class="link" href="performance-schema-transaction-summary-tables.html" title="29.12.20.5 Transaction Summary Tables">
<code class="literal">
events_transactions_summary_by_user_by_event_name
</code>
</a>
:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
Primary key on (
<code class="literal">
USER
</code>
,
<code class="literal">
EVENT_NAME
</code>
)
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
<a class="link" href="performance-schema-statement-summary-tables.html" title="29.12.20.3 Statement Summary Tables">
<code class="literal">
events_statements_summary_global_by_event_name
</code>
</a>
:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
Primary key on (
<code class="literal">
EVENT_NAME
</code>
)
</p>
</li>
</ul>
</div>
</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
statement summary tables. It has these effects:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
For
<a class="link" href="performance-schema-statement-summary-tables.html" title="29.12.20.3 Statement Summary Tables">
<code class="literal">
events_statements_summary_by_digest
</code>
</a>
,
it removes the rows.
</p>
</li>
<li class="listitem">
<p>
For other summary tables not aggregated by account, host,
or user, truncation resets the summary columns to zero
rather than removing rows.
</p>
</li>
<li class="listitem">
<p>
For other summary tables aggregated by account, host, or
user, truncation removes rows for accounts, hosts, or
users with no connections, and resets the summary columns
to zero for the remaining rows.
</p>
</li>
</ul>
</div>
<p>
In addition, each statement summary table that is aggregated
by account, host, user, or thread is implicitly truncated by
truncation of the connection table on which it depends, or
truncation of
<a class="link" href="performance-schema-statement-summary-tables.html" title="29.12.20.3 Statement Summary Tables">
<code class="literal">
events_statements_summary_global_by_event_name
</code>
</a>
.
For details, see
<a class="xref" href="performance-schema-connection-tables.html" title="29.12.8 Performance Schema Connection Tables">
Section 29.12.8, “Performance Schema Connection Tables”
</a>
.
</p>
<p>
In addition, truncating
<a class="link" href="performance-schema-statement-summary-tables.html" title="29.12.20.3 Statement Summary Tables">
<code class="literal">
events_statements_summary_by_digest
</code>
</a>
implicitly truncates
<a class="link" href="performance-schema-statement-histogram-summary-tables.html" title="29.12.20.4 Statement Histogram Summary Tables">
<code class="literal">
events_statements_histogram_by_digest
</code>
</a>
,
and truncating
<a class="link" href="performance-schema-statement-summary-tables.html" title="29.12.20.3 Statement Summary Tables">
<code class="literal">
events_statements_summary_global_by_event_name
</code>
</a>
implicitly truncates
<a class="link" href="performance-schema-statement-histogram-summary-tables.html" title="29.12.20.4 Statement Histogram Summary Tables">
<code class="literal">
events_statements_histogram_global
</code>
</a>
.
</p>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="statement-summary-tables-aggregation">
</a>
Statement Digest Aggregation Rules
</h5>
</div>
</div>
</div>
<p>
If the
<code class="literal">
statements_digest
</code>
consumer is
enabled, aggregation into
<a class="link" href="performance-schema-statement-summary-tables.html" title="29.12.20.3 Statement Summary Tables">
<code class="literal">
events_statements_summary_by_digest
</code>
</a>
occurs as follows when a statement completes. Aggregation is
based on the
<code class="literal">
DIGEST
</code>
value computed for
the statement.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
If a
<a class="link" href="performance-schema-statement-summary-tables.html" title="29.12.20.3 Statement Summary Tables">
<code class="literal">
events_statements_summary_by_digest
</code>
</a>
row already exists with the digest value for the
statement that just completed, statistics for the
statement are aggregated to that row. The
<code class="literal">
LAST_SEEN
</code>
column is updated to the
current time.
</p>
</li>
<li class="listitem">
<p>
If no row has the digest value for the statement that
just completed, and the table is not full, a new row is
created for the statement. The
<code class="literal">
FIRST_SEEN
</code>
and
<code class="literal">
LAST_SEEN
</code>
columns are initialized
with the current time.
</p>
</li>
<li class="listitem">
<p>
If no row has the statement digest value for the
statement that just completed, and the table is full,
the statistics for the statement that just completed are
added to a special
<span class="quote">
“
<span class="quote">
catch-all
</span>
”
</span>
row with
<code class="literal">
DIGEST
</code>
=
<code class="literal">
NULL
</code>
,
which is created if necessary. If the row is created,
the
<code class="literal">
FIRST_SEEN
</code>
and
<code class="literal">
LAST_SEEN
</code>
columns are initialized
with the current time. Otherwise, the
<code class="literal">
LAST_SEEN
</code>
column is updated with the
current time.
</p>
</li>
</ul>
</div>
<p>
The row with
<code class="literal">
DIGEST
</code>
=
<code class="literal">
NULL
</code>
is maintained because Performance
Schema tables have a maximum size due to memory constraints.
The
<code class="literal">
DIGEST
</code>
=
<code class="literal">
NULL
</code>
row
permits digests that do not match other rows to be counted
even if the summary table is full, using a common
<span class="quote">
“
<span class="quote">
other
</span>
”
</span>
bucket. This row helps you estimate
whether the digest summary is representative:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
A
<code class="literal">
DIGEST
</code>
=
<code class="literal">
NULL
</code>
row that has a
<code class="literal">
COUNT_STAR
</code>
value that
represents 5% of all digests shows that the digest
summary table is very representative; the other rows
cover 95% of the statements seen.
</p>
</li>
<li class="listitem">
<p>
A
<code class="literal">
DIGEST
</code>
=
<code class="literal">
NULL
</code>
row that has a
<code class="literal">
COUNT_STAR
</code>
value that
represents 50% of all digests shows that the digest
summary table is not very representative; the other rows
cover only half the statements seen. Most likely the DBA
should increase the maximum table size so that more of
the rows counted in the
<code class="literal">
DIGEST
</code>
=
<code class="literal">
NULL
</code>
row would be counted using more
specific rows instead. By default, the table is
autosized, but if this size is too small, set the
<a class="link" href="performance-schema-system-variables.html#sysvar_performance_schema_digests_size">
<code class="literal">
performance_schema_digests_size
</code>
</a>
system variable to a larger value at server startup.
</p>
</li>
</ul>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="statement-summary-tables-stored-programs">
</a>
Stored Program Instrumentation Behavior
</h5>
</div>
</div>
</div>
<p>
For stored program types for which instrumentation is
enabled in the
<a class="link" href="performance-schema-setup-objects-table.html" title="29.12.2.4 The setup_objects Table">
<code class="literal">
setup_objects
</code>
</a>
table,
<a class="link" href="performance-schema-statement-summary-tables.html" title="29.12.20.3 Statement Summary Tables">
<code class="literal">
events_statements_summary_by_program
</code>
</a>
maintains statistics for stored programs as follows:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
A row is added for an object when it is first used in
the server.
</p>
</li>
<li class="listitem">
<p>
The row for an object is removed when the object is
dropped.
</p>
</li>
<li class="listitem">
<p>
Statistics are aggregated in the row for an object as it
executes.
</p>
</li>
</ul>
</div>
<p>
See also
<a class="xref" href="performance-schema-pre-filtering.html" title="29.4.3 Event Pre-Filtering">
Section 29.4.3, “Event Pre-Filtering”
</a>
.
</p>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/mysql-cluster-backup-troubleshooting.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="mysql-cluster-backup-troubleshooting">
</a>
25.6.8.4 NDB Cluster Backup Troubleshooting
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045091920160">
</a>
<a class="indexterm" name="idm46045091918672">
</a>
<a class="indexterm" name="idm46045091917184">
</a>
<p>
If an error code is returned when issuing a backup request, the
most likely cause is insufficient memory or disk space. You
should check that there is enough memory allocated for the
backup.
</p>
<div class="important" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Important
</div>
<p>
If you have set
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-backupdatabuffersize">
<code class="literal">
BackupDataBufferSize
</code>
</a>
and
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-backuplogbuffersize">
<code class="literal">
BackupLogBufferSize
</code>
</a>
and their sum is greater than 4MB, then you must also set
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-backupmemory">
<code class="literal">
BackupMemory
</code>
</a>
as well.
</p>
</div>
<p>
You should also make sure that there is sufficient space on the
hard drive partition of the backup target.
</p>
<p>
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
does not support repeatable
reads, which can cause problems with the restoration process.
Although the backup process is
<span class="quote">
“
<span class="quote">
hot
</span>
”
</span>
, restoring an
NDB Cluster from backup is not a 100%
<span class="quote">
“
<span class="quote">
hot
</span>
”
</span>
process. This is due to the fact that, for the duration of the
restore process, running transactions get nonrepeatable reads
from the restored data. This means that the state of the data is
inconsistent while the restore is in progress.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/fetching-spatial-data.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="fetching-spatial-data">
</a>
13.4.8 Fetching Spatial Data
</h3>
</div>
</div>
</div>
<p>
Geometry values stored in a table can be fetched in internal
format. You can also convert them to WKT or WKB format.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Fetching spatial data in internal format:
</p>
<p>
Fetching geometry values using internal format can be useful
in table-to-table transfers:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa34993663"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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> geom2 <span class="token punctuation">(</span>g <span class="token keyword">GEOMETRY</span><span class="token punctuation">)</span> <span class="token keyword">SELECT</span> g <span class="token keyword">FROM</span> geom<span class="token punctuation">;</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
Fetching spatial data in WKT format:
</p>
<p>
The
<a class="link" href="gis-format-conversion-functions.html#function_st-astext">
<code class="literal">
ST_AsText()
</code>
</a>
function
converts a geometry from internal format to a WKT string.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa49038250"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">ST_AsText</span><span class="token punctuation">(</span>g<span class="token punctuation">)</span> <span class="token keyword">FROM</span> geom<span class="token punctuation">;</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
Fetching spatial data in WKB format:
</p>
<p>
The
<a class="link" href="gis-format-conversion-functions.html#function_st-asbinary">
<code class="literal">
ST_AsBinary()
</code>
</a>
function
converts a geometry from internal format to a
<a class="link" href="blob.html" title="13.3.4 The BLOB and TEXT Types">
<code class="literal">
BLOB
</code>
</a>
containing the WKB
value.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa39383153"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">ST_AsBinary</span><span class="token punctuation">(</span>g<span class="token punctuation">)</span> <span class="token keyword">FROM</span> geom<span class="token punctuation">;</span></code></pre>
</div>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/mysql-cluster-replication-issues.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="mysql-cluster-replication-issues">
</a>
25.7.3 Known Issues in NDB Cluster Replication
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045086732400">
</a>
<p>
This section discusses known problems or issues when using
replication with NDB Cluster.
</p>
<p>
<b>
Loss of connection between source and replica.
</b>
<a class="indexterm" name="idm46045086729472">
</a>
A loss of connection can occur either between the source cluster
SQL node and the replica cluster SQL node, or between the source
SQL node and the data nodes of the source cluster. In the latter
case, this can occur not only as a result of loss of physical
connection (for example, a broken network cable), but due to the
overflow of data node event buffers; if the SQL node is too slow
to respond, it may be dropped by the cluster (this is
controllable to some degree by adjusting the
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-maxbufferedepochs">
<code class="literal">
MaxBufferedEpochs
</code>
</a>
and
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-timebetweenepochs">
<code class="literal">
TimeBetweenEpochs
</code>
</a>
configuration parameters). If this occurs,
<span class="emphasis">
<em>
it is
entirely possible for new data to be inserted into the source
cluster without being recorded in the source SQL node's
binary log
</em>
</span>
. For this reason, to guarantee high
availability, it is extremely important to maintain a backup
replication channel, to monitor the primary channel, and to fail
over to the secondary replication channel when necessary to keep
the replica cluster synchronized with the source. NDB Cluster is
not designed to perform such monitoring on its own; for this, an
external application is required.
</p>
<p>
<a class="indexterm" name="idm46045086723264">
</a>
<a class="indexterm" name="idm46045086721776">
</a>
The source SQL node issues a
<span class="quote">
“
<span class="quote">
gap
</span>
”
</span>
event when
connecting or reconnecting to the source cluster. (A gap event is
a type of
<span class="quote">
“
<span class="quote">
incident event,
</span>
”
</span>
which indicates an
incident that occurs that affects the contents of the database but
that cannot easily be represented as a set of changes. Examples of
incidents are server failures, database resynchronization, some
software updates, and some hardware changes.) When the replica
encounters a gap in the replication log, it stops with an error
message. This message is available in the output of
<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>
, and indicates
that the SQL thread has stopped due to an incident registered in
the replication stream, and that manual intervention is required.
See
<a class="xref" href="mysql-cluster-replication-failover.html" title="25.7.8 Implementing Failover with NDB Cluster Replication">
Section 25.7.8, “Implementing Failover with NDB Cluster Replication”
</a>
, for more
information about what to do in such circumstances.
</p>
<div class="important" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Important
</div>
<p>
Because NDB Cluster is not designed on its own to monitor
replication status or provide failover, if high availability is
a requirement for the replica server or cluster, then you must
set up multiple replication lines, monitor the source
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
on the primary replication line, and
be prepared fail over to a secondary line if and as necessary.
This must be done manually, or possibly by means of a
third-party application. For information about implementing this
type of setup, see
<a class="xref" href="mysql-cluster-replication-two-channels.html" title="25.7.7 Using Two Replication Channels for NDB Cluster Replication">
Section 25.7.7, “Using Two Replication Channels for NDB Cluster Replication”
</a>
, and
<a class="xref" href="mysql-cluster-replication-failover.html" title="25.7.8 Implementing Failover with NDB Cluster Replication">
Section 25.7.8, “Implementing Failover with NDB Cluster Replication”
</a>
.
</p>
<p>
If you are replicating from a standalone MySQL server to an NDB
Cluster, one channel is usually sufficient.
</p>
</div>
<p>
<b>
Circular replication.
</b>
<a class="indexterm" name="idm46045086710848">
</a>
<a class="indexterm" name="idm46045086709360">
</a>
<a class="indexterm" name="idm46045086707872">
</a>
NDB Cluster Replication supports circular replication, as shown
in the next example. The replication setup involves three NDB
Clusters numbered 1, 2, and 3, in which Cluster 1 acts as the
replication source for Cluster 2, Cluster 2 acts as the source
for Cluster 3, and Cluster 3 acts as the source for Cluster 1,
thus completing the circle. Each NDB Cluster has two SQL nodes,
with SQL nodes A and B belonging to Cluster 1, SQL nodes C and D
belonging to Cluster 2, and SQL nodes E and F belonging to
Cluster 3.
</p>
<p>
Circular replication using these clusters is supported as long as
the following conditions are met:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
The SQL nodes on all source and replica clusters are the same.
</p>
</li>
<li class="listitem">
<p>
All SQL nodes acting as sources and replicas are started with
the system variable
<a class="link" href="replication-options-binary-log.html#sysvar_log_replica_updates">
<code class="literal">
log_replica_updates
</code>
</a>
enabled.
</p>
</li>
</ul>
</div>
<p>
This type of circular replication setup is shown in the following
diagram:
</p>
<div class="figure">
<a name="fig-mysql-cluster-circular-all-sources-replicas">
</a>
<p class="title">
<b>
Figure 25.11 NDB Cluster Circular Replication With All Sources As Replicas
</b>
</p>
<div class="figure-contents">
<div class="mediaobject">
<img alt="Some content is described in the surrounding text. The diagram shows three clusters, each with two nodes. Arrows connecting SQL nodes in different clusters illustrate that all sources are also replicas." src="images/cluster-circular-replication-1.png" style="width: 100%; max-width: 557px;"/>
</div>
</div>
</div>
<br class="figure-break"/>
<p>
In this scenario, SQL node A in Cluster 1 replicates to SQL node C
in Cluster 2; SQL node C replicates to SQL node E in Cluster 3;
SQL node E replicates to SQL node A. In other words, the
replication line (indicated by the curved arrows in the diagram)
directly connects all SQL nodes used as sources and replicas.
</p>
<p>
It should also be possible to set up circular replication in which
not all source SQL nodes are also replicas, as shown here:
</p>
<div class="figure">
<a name="fig-mysql-cluster-circular-not-all-sources-replicas">
</a>
<p class="title">
<b>
Figure 25.12 NDB Cluster Circular Replication Where Not All Sources Are Replicas
</b>
</p>
<div class="figure-contents">
<div class="mediaobject">
<img alt="Some content is described in the surrounding text. The diagram shows three clusters, each with two nodes. Arrows connecting SQL nodes in different clusters illustrate that not all sources are replicas." src="images/cluster-circular-replication-2.png" style="width: 100%; max-width: 542px;"/>
</div>
</div>
</div>
<br class="figure-break"/>
<p>
In this case, different SQL nodes in each cluster are used as
sources and replicas. However, you must
<span class="emphasis">
<em>
not
</em>
</span>
start any of the SQL nodes with the
<a class="link" href="replication-options-binary-log.html#sysvar_log_replica_updates">
<code class="literal">
log_replica_updates
</code>
</a>
system
variable enabled. This type of circular replication scheme for NDB
Cluster, in which the line of replication (again indicated by the
curved arrows in the diagram) is discontinuous, should be
possible, but it should be noted that it has not yet been
thoroughly tested and must therefore still be considered
experimental.
</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="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
storage engine uses
<span class="firstterm">
idempotent execution mode
</span>
,
which suppresses duplicate-key and other errors that otherwise
break circular replication of NDB Cluster. This is equivalent to
setting the global value of the system variable
<a class="link" href="replication-options-replica.html#sysvar_replica_exec_mode">
<code class="literal">
replica_exec_mode
</code>
</a>
to
<code class="literal">
IDEMPOTENT
</code>
, although this is not necessary in
NDB Cluster replication, since NDB Cluster sets this variable
automatically and ignores any attempts to set it explicitly.
</p>
</div>
<p>
<b>
NDB Cluster replication and primary keys.
</b>
<a class="indexterm" name="idm46045086677184">
</a>
In the event of a node failure, errors in replication of
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
tables without primary keys can
still occur, due to the possibility of duplicate rows being
inserted in such cases. For this reason, it is highly
recommended that all
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
tables
being replicated have explicit primary keys.
</p>
<p>
<b>
NDB Cluster Replication and Unique Keys.
</b>
<a class="indexterm" name="idm46045086671824">
</a>
In older versions of NDB Cluster, operations that updated values
of unique key columns of
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
tables
could result in duplicate-key errors when replicated. This issue
is solved for replication between
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
tables by deferring unique key
checks until after all table row updates have been performed.
</p>
<p>
Deferring constraints in this way is currently supported only by
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
. Thus, updates of unique keys
when replicating from
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
to a
different storage engine such as
<a class="link" href="innodb-storage-engine.html" title="Chapter 17 The InnoDB Storage Engine">
<code class="literal">
InnoDB
</code>
</a>
or
<a class="link" href="myisam-storage-engine.html" title="18.2 The MyISAM Storage Engine">
<code class="literal">
MyISAM
</code>
</a>
are still not supported.
</p>
<p>
The problem encountered when replicating without deferred checking
of unique key updates can be illustrated using
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
table such as
<code class="literal">
t
</code>
, is created and populated on the source (and
transmitted to a replica that does not support deferred unique key
updates) as shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa22455322"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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>
p <span class="token datatype">INT</span> <span class="token keyword">PRIMARY</span> <span class="token keyword">KEY</span><span class="token punctuation">,</span>
c <span class="token datatype">INT</span><span class="token punctuation">,</span>
<span class="token keyword">UNIQUE</span> <span class="token keyword">KEY</span> u <span class="token punctuation">(</span>c<span class="token punctuation">)</span>
<span class="token punctuation">)</span> <span class="token keyword">ENGINE</span> <span class="token keyword">NDB</span><span class="token punctuation">;</span>
<span class="token keyword">INSERT</span> <span class="token keyword">INTO</span> t
<span class="token keyword">VALUES</span> <span class="token punctuation">(</span><span class="token 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">2</span><span class="token punctuation">,</span><span class="token number">2</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token number">3</span><span class="token punctuation">,</span><span class="token number">3</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token number">4</span><span class="token punctuation">,</span><span class="token number">4</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token number">5</span><span class="token punctuation">,</span><span class="token number">5</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
The following
<a class="link" href="update.html" title="15.2.17 UPDATE Statement">
<code class="literal">
UPDATE
</code>
</a>
statement on
<code class="literal">
t
</code>
succeeds on the source, since the rows
affected are processed in the order determined by the
<code class="literal">
ORDER BY
</code>
option, performed over the entire
table:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa24553388"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">UPDATE</span> t <span class="token keyword">SET</span> c <span class="token operator">=</span> c <span class="token operator">-</span> <span class="token number">1</span> <span class="token keyword">ORDER</span> <span class="token keyword">BY</span> p<span class="token punctuation">;</span></code></pre>
</div>
<p>
The same statement fails with a duplicate key error or other
constraint violation on the replica, because the ordering of the
row updates is performed for one partition at a time, rather than
for the table as a whole.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
Every
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
table is implicitly
partitioned by key when it is created. See
<a class="xref" href="partitioning-key.html" title="26.2.5 KEY Partitioning">
Section 26.2.5, “KEY Partitioning”
</a>
, for more information.
</p>
</div>
<p>
<b>
GTIDs not supported.
</b>
Replication using global transaction IDs is not compatible with
the
<code class="literal">
NDB
</code>
storage engine, and is not supported.
Enabling GTIDs is likely to cause NDB Cluster Replication to
fail.
</p>
<p>
<b>
Restarting with --initial.
</b>
<a class="indexterm" name="idm46045086647744">
</a>
Restarting the cluster with the
<a class="link" href="mysql-cluster-programs-ndbd.html#option_ndbd_initial">
<code class="option">
--initial
</code>
</a>
option causes the
sequence of GCI and epoch numbers to start over from
<code class="literal">
0
</code>
. (This is generally true of NDB Cluster and
not limited to replication scenarios involving Cluster.) The
MySQL servers involved in replication should in this case be
restarted. After this, you should use the
<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>
and
<a class="link" href="reset-replica.html" title="15.4.2.3 RESET REPLICA Statement">
<code class="literal">
RESET REPLICA
</code>
</a>
statements to clear
the invalid
<code class="literal">
ndb_binlog_index
</code>
and
<code class="literal">
ndb_apply_status
</code>
tables, respectively.
</p>
<p>
<a name="mysql-cluster-replication-ndb-to-non-ndb">
</a>
<b>
Replication from NDB to other storage engines.
</b>
It is possible to replicate an
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
table on the source to a table using a different storage engine
on the replica, taking into account the restrictions listed
here:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Multi-source and circular replication are not supported
(tables on both the source and the replica must use the
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
storage engine for this to
work).
</p>
</li>
<li class="listitem">
<p>
Using a storage engine which does not perform binary logging
for tables on the replica requires special handling.
</p>
</li>
<li class="listitem">
<p>
Use of a nontransactional storage engine for tables on the
replica also requires special handling.
</p>
</li>
<li class="listitem">
<p>
The source
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
must be started with
<a class="link" href="mysql-cluster-options-variables.html#option_mysqld_ndb-log-update-as-write">
<code class="option">
--ndb-log-update-as-write=0
</code>
</a>
or
<code class="option">
--ndb-log-update-as-write=OFF
</code>
.
</p>
</li>
</ul>
</div>
<p>
The next few paragraphs provide additional information about each
of the issues just described.
</p>
<p>
<b>
Multiple sources not supported when replicating NDB to other storage
engines.
</b>
For replication from
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
to a
different storage engine, the relationship between the two
databases must be one-to-one. This means that bidirectional or
circular replication is not supported between NDB Cluster and
other storage engines.
</p>
<p>
In addition, it is not possible to configure more than one
replication channel when replicating between
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
and a different storage engine.
(An NDB Cluster database
<span class="emphasis">
<em>
can
</em>
</span>
simultaneously
replicate to multiple NDB Cluster databases.) If the source uses
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
tables, it is still possible to
have more than one MySQL Server maintain a binary log of all
changes, but for the replica to change sources (fail over), the
new source-replica relationship must be explicitly defined on the
replica.
</p>
<p>
<b>
Replicating NDB tables to a storage engine that does not perform binary
logging.
</b>
<a class="indexterm" name="idm46045086621024">
</a>
If you attempt to replicate from an NDB Cluster to a replica
that uses a storage engine that does not handle its own binary
logging, the replication process aborts with the error
<span class="errortext">
Binary logging not possible ... Statement cannot be
written atomically since more than one engine involved and at
least one engine is self-logging
</span>
(Error
<span class="errorcode">
1595
</span>
). It is possible to work around this
issue in one of the following ways:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<b>
Turn off binary logging on the replica.
</b>
This can be accomplished by setting
<a class="link" href="replication-options-binary-log.html#sysvar_sql_log_bin">
<code class="literal">
sql_log_bin = 0
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
<b>
Change the storage engine used for the mysql.ndb_apply_status table.
</b>
Causing this table to use an engine that does not handle its
own binary logging can also eliminate the conflict. This can
be done by issuing a statement such as
<a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
<code class="literal">
ALTER TABLE
mysql.ndb_apply_status ENGINE=MyISAM
</code>
</a>
on the
replica. It is safe to do this when using a storage engine
other than
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
on the replica,
since you do not need to worry about keeping multiple
replicas synchronized.
</p>
</li>
<li class="listitem">
<p>
<b>
Filter out changes to the mysql.ndb_apply_status table on the replica.
</b>
This can be done by starting the replica with
<a class="link" href="replication-options-replica.html#option_mysqld_replicate-ignore-table">
<code class="option">
--replicate-ignore-table=mysql.ndb_apply_status
</code>
</a>
.
If you need for other tables to be ignored by replication,
you might wish to use an appropriate
<a class="link" href="replication-options-replica.html#option_mysqld_replicate-wild-ignore-table">
<code class="option">
--replicate-wild-ignore-table
</code>
</a>
option instead.
</p>
</li>
</ul>
</div>
<div class="important" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Important
</div>
<p>
You should
<span class="emphasis">
<em>
not
</em>
</span>
disable replication or
binary logging of
<code class="literal">
mysql.ndb_apply_status
</code>
or
change the storage engine used for this table when replicating
from one NDB Cluster to another. See
<a class="xref" href="mysql-cluster-replication-issues.html#mysql-cluster-replication-issues-filtering" title="Replication and binary log filtering rules with replication between NDB Clusters">
Replication and binary log filtering rules with replication between NDB
Clusters
</a>
,
for details.
</p>
</div>
<p>
<a name="mysql-cluster-replication-ndb-to-nontransactional">
</a>
<b>
Replication from NDB to a nontransactional storage engine.
</b>
When replicating from
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
to a
nontransactional storage engine such as
<a class="link" href="myisam-storage-engine.html" title="18.2 The MyISAM Storage Engine">
<code class="literal">
MyISAM
</code>
</a>
, you may encounter
unnecessary duplicate key errors when replicating
<a class="link" href="insert-on-duplicate.html" title="15.2.7.2 INSERT ... ON DUPLICATE KEY UPDATE Statement">
<code class="literal">
INSERT ...
ON DUPLICATE KEY UPDATE
</code>
</a>
statements. You can suppress
these by using
<a class="link" href="mysql-cluster-options-variables.html#option_mysqld_ndb-log-update-as-write">
<code class="option">
--ndb-log-update-as-write=0
</code>
</a>
,
which forces updates to be logged as writes, rather than as
updates.
</p>
<p>
<a name="mysql-cluster-replication-issues-tde">
</a>
<b>
NDB Replication and File System Encryption (TDE).
</b>
The use of an encrypted filesystem does not have any effect on
NDB Replication. All of the following scenarios are supported:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Replication of an NDB Cluster having an encrypted file system
to an NDB Cluster whose file system is not encrypted.
</p>
</li>
<li class="listitem">
<p>
Replication of an NDB Cluster whose file system is not
encrypted to an NDB Cluster whose file system is encrypted.
</p>
</li>
<li class="listitem">
<p>
Replication of an NDB Cluster whose file system is encrypted
to a standalone MySQL server using
<a class="link" href="innodb-storage-engine.html" title="Chapter 17 The InnoDB Storage Engine">
<code class="literal">
InnoDB
</code>
</a>
tables which are not
encrypted.
</p>
</li>
<li class="listitem">
<p>
Replication of an NDB Cluster with an unencrypted file system
to a standalone MySQL server using
<code class="literal">
InnoDB
</code>
tables with file sytem encryption.
</p>
</li>
</ul>
</div>
<p>
<a name="mysql-cluster-replication-issues-filtering">
</a>
<b>
Replication and binary log filtering rules with replication between NDB
Clusters.
</b>
If you are using any of the options
<code class="option">
--replicate-do-*
</code>
,
<code class="option">
--replicate-ignore-*
</code>
,
<a class="link" href="replication-options-binary-log.html#option_mysqld_binlog-do-db">
<code class="option">
--binlog-do-db
</code>
</a>
, or
<a class="link" href="replication-options-binary-log.html#option_mysqld_binlog-ignore-db">
<code class="option">
--binlog-ignore-db
</code>
</a>
to filter
databases or tables being replicated, you must take care not to
block replication or binary logging of the
<code class="literal">
mysql.ndb_apply_status
</code>
, which is required for
replication between NDB Clusters to operate properly. In
particular, you must keep in mind the following:
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
Using
<a class="link" href="replication-options-replica.html#option_mysqld_replicate-do-db">
<code class="option">
--replicate-do-db=
<em class="replaceable">
<code>
db_name
</code>
</em>
</code>
</a>
(and no other
<code class="option">
--replicate-do-*
</code>
or
<code class="option">
--replicate-ignore-*
</code>
options) means that
<span class="emphasis">
<em>
only
</em>
</span>
tables in database
<em class="replaceable">
<code>
db_name
</code>
</em>
are replicated. In this
case, you should also use
<a class="link" href="replication-options-replica.html#option_mysqld_replicate-do-db">
<code class="option">
--replicate-do-db=mysql
</code>
</a>
,
<a class="link" href="replication-options-binary-log.html#option_mysqld_binlog-do-db">
<code class="option">
--binlog-do-db=mysql
</code>
</a>
, or
<a class="link" href="replication-options-replica.html#option_mysqld_replicate-do-table">
<code class="option">
--replicate-do-table=mysql.ndb_apply_status
</code>
</a>
to ensure that
<code class="literal">
mysql.ndb_apply_status
</code>
is
populated on replicas.
</p>
<p>
Using
<a class="link" href="replication-options-binary-log.html#option_mysqld_binlog-do-db">
<code class="option">
--binlog-do-db=
<em class="replaceable">
<code>
db_name
</code>
</em>
</code>
</a>
(and no other
<a class="link" href="replication-options-binary-log.html#option_mysqld_binlog-do-db">
<code class="option">
--binlog-do-db
</code>
</a>
options) means that changes
<span class="emphasis">
<em>
only
</em>
</span>
to
tables in database
<em class="replaceable">
<code>
db_name
</code>
</em>
are
written to the binary log. In this case, you should also use
<a class="link" href="replication-options-replica.html#option_mysqld_replicate-do-db">
<code class="option">
--replicate-do-db=mysql
</code>
</a>
,
<a class="link" href="replication-options-binary-log.html#option_mysqld_binlog-do-db">
<code class="option">
--binlog-do-db=mysql
</code>
</a>
, or
<a class="link" href="replication-options-replica.html#option_mysqld_replicate-do-table">
<code class="option">
--replicate-do-table=mysql.ndb_apply_status
</code>
</a>
to ensure that
<code class="literal">
mysql.ndb_apply_status
</code>
is
populated on replicas.
</p>
</li>
<li class="listitem">
<p>
Using
<a class="link" href="replication-options-replica.html#option_mysqld_replicate-ignore-db">
<code class="option">
--replicate-ignore-db=mysql
</code>
</a>
means that no tables in the
<code class="literal">
mysql
</code>
database
are replicated. In this case, you should also use
<a class="link" href="replication-options-replica.html#option_mysqld_replicate-do-table">
<code class="option">
--replicate-do-table=mysql.ndb_apply_status
</code>
</a>
to ensure that
<code class="literal">
mysql.ndb_apply_status
</code>
is
replicated.
</p>
<p>
Using
<a class="link" href="replication-options-binary-log.html#option_mysqld_binlog-ignore-db">
<code class="option">
--binlog-ignore-db=mysql
</code>
</a>
means that no changes to tables in the
<code class="literal">
mysql
</code>
database are written to the binary
log. In this case, you should also use
<a class="link" href="replication-options-replica.html#option_mysqld_replicate-do-table">
<code class="option">
--replicate-do-table=mysql.ndb_apply_status
</code>
</a>
to ensure that
<code class="literal">
mysql.ndb_apply_status
</code>
is
replicated.
</p>
</li>
</ol>
</div>
<p>
You should also remember that each replication rule requires the
following:
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
Its own
<code class="option">
--replicate-do-*
</code>
or
<code class="option">
--replicate-ignore-*
</code>
option, and that
multiple rules cannot be expressed in a single replication
filtering option. For information about these rules, see
<a class="xref" href="replication-options.html" title="19.1.6 Replication and Binary Logging Options and Variables">
Section 19.1.6, “Replication and Binary Logging Options and Variables”
</a>
.
</p>
</li>
<li class="listitem">
<p>
Its own
<a class="link" href="replication-options-binary-log.html#option_mysqld_binlog-do-db">
<code class="option">
--binlog-do-db
</code>
</a>
or
<a class="link" href="replication-options-binary-log.html#option_mysqld_binlog-ignore-db">
<code class="option">
--binlog-ignore-db
</code>
</a>
option, and
that multiple rules cannot be expressed in a single binary log
filtering option. For information about these rules, see
<a class="xref" href="binary-log.html" title="7.4.4 The Binary Log">
Section 7.4.4, “The Binary Log”
</a>
.
</p>
</li>
</ol>
</div>
<p>
If you are replicating an NDB Cluster to a replica that uses a
storage engine other than
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDB
</code>
</a>
, the
considerations just given previously may not apply, as discussed
elsewhere in this section.
</p>
<p>
<a name="mysql-cluster-replication-ipv6">
</a>
<b>
NDB Cluster Replication and IPv6.
</b>
All types of NDB Cluster nodes support IPv6 in NDB
8.4; this includes management nodes, data nodes,
and API or SQL nodes.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
In NDB 8.4, you can disable IPv6 support in the
Linux kernel if you do not intend to use IPv6 addressing for any
NDB Cluster nodes.
</p>
</div>
<p>
<b>
Attribute promotion and demotion.
</b>
NDB Cluster Replication includes support for attribute promotion
and demotion. The implementation of the latter distinguishes
between lossy and non-lossy type conversions, and their use on
the replica can be controlled by setting the global value of the
system variable
<a class="link" href="replication-options-replica.html#sysvar_replica_type_conversions">
<code class="literal">
replica_type_conversions
</code>
</a>
.
</p>
<p>
For more information about attribute promotion and demotion in NDB
Cluster, see
<a class="xref" href="replication-features-differing-tables.html#replication-features-attribute-promotion" title="Row-based replication: attribute promotion and demotion">
Row-based replication: attribute promotion and demotion
</a>
.
</p>
<p>
<code class="literal">
NDB
</code>
, unlike
<a class="link" href="innodb-storage-engine.html" title="Chapter 17 The InnoDB Storage Engine">
<code class="literal">
InnoDB
</code>
</a>
or
<a class="link" href="myisam-storage-engine.html" title="18.2 The MyISAM Storage Engine">
<code class="literal">
MyISAM
</code>
</a>
, does not write changes to
virtual columns to the binary log; however, this has no
detrimental effects on NDB Cluster Replication or replication
between
<code class="literal">
NDB
</code>
and other storage engines. Changes
to stored generated columns are logged.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/telemetry-metrics.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title">
<a name="telemetry-metrics">
</a>
35.4 OpenTelemetry Metrics
</h2>
</div>
</div>
</div>
<div class="toc">
<dl class="toc">
<dt>
<span class="section">
<a href="telemetry-metrics-configuration.html">
35.4.1 Configuring Metrics Telemetry
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="telemetry-metrics-meters.html">
35.4.2 Server Meters
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="telemetry-metrics-meter-metrics.html">
35.4.3 Server Metrics
</a>
</span>
</dt>
</dl>
</div>
<p>
The Server Telemetry Metrics Service and the Server Metrics
Instrument Service enable you to register and query telemetry
meters, metrics, and metric measurements, in order to periodically
export these measurements using the OpenTelemetry protocol.
</p>
<p>
For more information on these services, see Server Telemetry
Metrics Service and the Server Metrics Instrument Service
documentation in the MySQL Server Doxygen Documentation.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/mysql-cluster-ndbinfo-hwinfo.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="mysql-cluster-ndbinfo-hwinfo">
</a>
25.6.17.39 The ndbinfo hwinfo Table
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045089150512">
</a>
<p>
The
<code class="literal">
hwinfo
</code>
table provides information about
the hardware on which a given data node executes.
</p>
<p>
The
<code class="literal">
hwinfo
</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>
Node ID
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
cpu_cnt_max
</code>
</p>
<p>
Number of processors on this host
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
cpu_cnt
</code>
</p>
<p>
Number of processors available to this node
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
num_cpu_cores
</code>
</p>
<p>
Number of CPU cores on this host
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
num_cpu_sockets
</code>
</p>
<p>
Number of CPU sockets on this host
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
HW_memory_size
</code>
</p>
<p>
Amount of memory available on this host
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
model_name
</code>
</p>
<p>
CPU model name
</p>
</li>
</ul>
</div>
<h5>
<a name="idm46045089132880">
</a>
Notes
</h5>
<p>
The
<code class="literal">
hwinfo
</code>
table is available on all
operating systems supported by
<code class="literal">
NDB
</code>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/what-is-crashing.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="what-is-crashing">
</a>
B.3.1 How to Determine What Is Causing a Problem
</h3>
</div>
</div>
</div>
<p>
When you run into a problem, the first thing you should do is to
find out which program or piece of equipment is causing it:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
If you have one of the following symptoms, then it is
probably a hardware problems (such as memory, motherboard,
CPU, or hard disk) or kernel problem:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
The keyboard does not work. This can normally be checked
by pressing the Caps Lock key. If the Caps Lock light
does not change, you have to replace your keyboard.
(Before doing this, you should try to restart your
computer and check all cables to the keyboard.)
</p>
</li>
<li class="listitem">
<p>
The mouse pointer does not move.
</p>
</li>
<li class="listitem">
<p>
The machine does not answer to a remote machine's pings.
</p>
</li>
<li class="listitem">
<p>
Other programs that are not related to MySQL do not
behave correctly.
</p>
</li>
<li class="listitem">
<p>
Your system restarted unexpectedly. (A faulty user-level
program should never be able to take down your system.)
</p>
</li>
</ul>
</div>
<p>
In this case, you should start by checking all your cables
and run some diagnostic tool to check your hardware! You
should also check whether there are any patches, updates, or
service packs for your operating system that could likely
solve your problem. Check also that all your libraries (such
as
<code class="literal">
glibc
</code>
) are up to date.
</p>
<p>
It is always good to use a machine with ECC memory to
discover memory problems early.
</p>
</li>
<li class="listitem">
<p>
If your keyboard is locked up, you may be able to recover by
logging in to your machine from another machine and
executing
<code class="literal">
kbd_mode -a
</code>
.
</p>
</li>
<li class="listitem">
<p>
Please examine your system log file
(
<code class="filename">
/var/log/messages
</code>
or similar) for
reasons for your problem. If you think the problem is in
MySQL, you should also examine MySQL's log files. See
<a class="xref" href="server-logs.html" title="7.4 MySQL Server Logs">
Section 7.4, “MySQL Server Logs”
</a>
.
</p>
</li>
<li class="listitem">
<p>
If you do not think you have hardware problems, you should
try to find out which program is causing problems. Try using
<span class="command">
<strong>
top
</strong>
</span>
,
<span class="command">
<strong>
ps
</strong>
</span>
, Task Manager,
or some similar program, to check which program is taking
all CPU or is locking the machine.
</p>
</li>
<li class="listitem">
<p>
Use
<span class="command">
<strong>
top
</strong>
</span>
,
<span class="command">
<strong>
df
</strong>
</span>
, or a
similar program to check whether you are out of memory, disk
space, file descriptors, or some other critical resource.
</p>
</li>
<li class="listitem">
<p>
If the problem is some runaway process, you can always try
to kill it. If it does not want to die, there is probably a
bug in the operating system.
</p>
</li>
</ul>
</div>
<p>
If you have examined all other possibilities and concluded that
the MySQL server or a MySQL client is causing the problem, it is
time to create a bug report, see
<a class="xref" href="bug-reports.html" title="1.6 How to Report Bugs or Problems">
Section 1.6, “How to Report Bugs or Problems”
</a>
.
In the bug report, try to give a complete description of how the
system is behaving and what you think is happening. Also state
why you think that MySQL is causing the problem. Take into
consideration all the situations described in this chapter.
State any problems exactly how they appear when you examine your
system. Use the
<span class="quote">
“
<span class="quote">
copy and paste
</span>
”
</span>
method for any
output and error messages from programs and log files.
</p>
<p>
Try to describe in detail which program is not working and all
symptoms you see. We have in the past received many bug reports
that state only
<span class="quote">
“
<span class="quote">
the system does not work.
</span>
”
</span>
This
provides us with no information about what could be the problem.
</p>
<p>
If a program fails, it is always useful to know the following
information:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
Has the program in question made a segmentation fault (did
it dump core)?
</p>
</li>
<li class="listitem">
<p>
Is the program taking up all available CPU time? Check with
<span class="command">
<strong>
top
</strong>
</span>
. Let the program run for a while, it
may simply be evaluating something computationally
intensive.
</p>
</li>
<li class="listitem">
<p>
If the
<a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
<span class="command">
<strong>
mysqld
</strong>
</span>
</a>
server is causing problems,
can you get any response from it with
<a class="link" href="mysqladmin.html" title="6.5.2 mysqladmin — A MySQL Server Administration Program">
<span class="command">
<strong>
mysqladmin -u
root ping
</strong>
</span>
</a>
or
<a class="link" href="mysqladmin.html" title="6.5.2 mysqladmin — A MySQL Server Administration Program">
<span class="command">
<strong>
mysqladmin -u root
processlist
</strong>
</span>
</a>
?
</p>
</li>
<li class="listitem">
<p>
What does a client program say when you try to connect to
the MySQL server? (Try with
<a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
<span class="command">
<strong>
mysql
</strong>
</span>
</a>
, for
example.) Does the client jam? Do you get any output from
the program?
</p>
</li>
</ul>
</div>
<p>
When sending a bug report, you should follow the outline
described in
<a class="xref" href="bug-reports.html" title="1.6 How to Report Bugs or Problems">
Section 1.6, “How to Report Bugs or Problems”
</a>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/gis-general-property-functions.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="gis-general-property-functions">
</a>
14.16.7.1 General Geometry Property Functions
</h4>
</div>
</div>
</div>
<p>
The functions listed in this section do not restrict their
argument and accept a geometry value of any type.
</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>
, 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>
If any SRID argument is not within the range of a 32-bit
unsigned integer, an
<a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_data_out_of_range" target="_top">
<code class="literal">
ER_DATA_OUT_OF_RANGE
</code>
</a>
error
occurs.
</p>
</li>
<li class="listitem">
<p>
If any SRID argument refers to an undefined 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 properties:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<a name="function_st-dimension">
</a>
<p>
<a class="link" href="gis-general-property-functions.html#function_st-dimension">
<code class="literal">
ST_Dimension(
<em class="replaceable">
<code>
g
</code>
</em>
)
</code>
</a>
</p>
<a class="indexterm" name="idm46045197547632">
</a>
<p>
Returns the inherent dimension of the geometry value
<em class="replaceable">
<code>
g
</code>
</em>
. The dimension can be −1,
0, 1, or 2. The meaning of these values is given in
<a class="xref" href="gis-class-geometry.html" title="13.4.2.2 Geometry Class">
Section 13.4.2.2, “Geometry Class”
</a>
.
</p>
<p>
<a class="link" href="gis-general-property-functions.html#function_st-dimension">
<code class="literal">
ST_Dimension()
</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="sa54369554"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">ST_Dimension</span><span class="token punctuation">(</span><span class="token function">ST_GeomFromText</span><span class="token punctuation">(</span><span class="token string">'LineString(1 1,2 2)'</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span 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_Dimension(ST_GeomFromText('LineString(1 1,2 2)')) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<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 class="token punctuation">+</span></span></code></pre>
</div>
</li>
<li class="listitem">
<a name="function_st-envelope">
</a>
<p>
<a class="link" href="gis-general-property-functions.html#function_st-envelope">
<code class="literal">
ST_Envelope(
<em class="replaceable">
<code>
g
</code>
</em>
)
</code>
</a>
</p>
<a class="indexterm" name="idm46045197535264">
</a>
<p>
Returns the minimum bounding rectangle (MBR) for the
geometry value
<em class="replaceable">
<code>
g
</code>
</em>
. The result is
returned as a
<code class="literal">
Polygon
</code>
value that is
defined by the corner points of the bounding box:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa23466958"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">POLYGON</span><span class="token punctuation">(</span><span class="token punctuation">(</span>MINX MINY<span class="token punctuation">,</span> MAXX MINY<span class="token punctuation">,</span> MAXX MAXY<span class="token punctuation">,</span> MINX MAXY<span class="token punctuation">,</span> MINX MINY<span class="token punctuation">)</span><span class="token punctuation">)</span></code></pre>
</div>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa46018837"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">ST_AsText</span><span class="token punctuation">(</span><span class="token function">ST_Envelope</span><span class="token punctuation">(</span><span class="token function">ST_GeomFromText</span><span class="token punctuation">(</span><span class="token string">'LineString(1 1,2 2)'</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span 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_Envelope(ST_GeomFromText('LineString(1 1,2 2)'))) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> POLYGON((1 1,2 1,2 2,1 2,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 class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
<p>
If the argument is a point or a vertical or horizontal line
segment,
<a class="link" href="gis-general-property-functions.html#function_st-envelope">
<code class="literal">
ST_Envelope()
</code>
</a>
returns the point or the line segment as its MBR rather than
returning an invalid polygon:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa82926961"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">ST_AsText</span><span class="token punctuation">(</span><span class="token function">ST_Envelope</span><span class="token punctuation">(</span><span class="token function">ST_GeomFromText</span><span class="token punctuation">(</span><span class="token string">'LineString(1 1,1 2)'</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span 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_Envelope(ST_GeomFromText('LineString(1 1,1 2)'))) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> LINESTRING(1 1,1 2) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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 class="link" href="gis-general-property-functions.html#function_st-envelope">
<code class="literal">
ST_Envelope()
</code>
</a>
handles its
arguments as described in the introduction to this section,
with this exception:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
If the geometry has an SRID value for a geographic
spatial reference system (SRS), an
<a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_not_implemented_for_geographic_srs" target="_top">
<code class="literal">
ER_NOT_IMPLEMENTED_FOR_GEOGRAPHIC_SRS
</code>
</a>
error occurs.
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<a name="function_st-geometrytype">
</a>
<p>
<a class="link" href="gis-general-property-functions.html#function_st-geometrytype">
<code class="literal">
ST_GeometryType(
<em class="replaceable">
<code>
g
</code>
</em>
)
</code>
</a>
</p>
<a class="indexterm" name="idm46045197515872">
</a>
<p>
Returns a binary string indicating the name of the geometry
type of which the geometry instance
<em class="replaceable">
<code>
g
</code>
</em>
is a member. The name
corresponds to one of the instantiable
<code class="literal">
Geometry
</code>
subclasses.
</p>
<p>
<a class="link" href="gis-general-property-functions.html#function_st-geometrytype">
<code class="literal">
ST_GeometryType()
</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="sa1317378"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">ST_GeometryType</span><span class="token punctuation">(</span><span class="token function">ST_GeomFromText</span><span class="token punctuation">(</span><span class="token string">'POINT(1 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>
<span class="token output"><span class="token punctuation">|</span> ST_GeometryType(ST_GeomFromText('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>
<span class="token output"><span class="token punctuation">|</span> POINT <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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-isempty">
</a>
<p>
<a class="link" href="gis-general-property-functions.html#function_st-isempty">
<code class="literal">
ST_IsEmpty(
<em class="replaceable">
<code>
g
</code>
</em>
)
</code>
</a>
</p>
<a class="indexterm" name="idm46045197503600">
</a>
<p>
This function is a placeholder that returns 1 for an empty
geometry collection value or 0 otherwise.
</p>
<p>
The only valid empty geometry is represented in the form of
an empty geometry collection value. MySQL does not support
GIS
<code class="literal">
EMPTY
</code>
values such as
<code class="literal">
POINT
EMPTY
</code>
.
</p>
<p>
<a class="link" href="gis-general-property-functions.html#function_st-isempty">
<code class="literal">
ST_IsEmpty()
</code>
</a>
handles its
arguments as described in the introduction to this section.
</p>
</li>
<li class="listitem">
<a name="function_st-issimple">
</a>
<p>
<a class="link" href="gis-general-property-functions.html#function_st-issimple">
<code class="literal">
ST_IsSimple(
<em class="replaceable">
<code>
g
</code>
</em>
)
</code>
</a>
</p>
<a class="indexterm" name="idm46045197493008">
</a>
<p>
Returns 1 if the geometry value
<em class="replaceable">
<code>
g
</code>
</em>
is simple according to the ISO
<em class="citetitle">
SQL/MM Part 3:
Spatial
</em>
standard.
<a class="link" href="gis-general-property-functions.html#function_st-issimple">
<code class="literal">
ST_IsSimple()
</code>
</a>
returns 0 if
the argument is not simple.
</p>
<p>
The descriptions of the instantiable geometric classes given
under
<a class="xref" href="opengis-geometry-model.html" title="13.4.2 The OpenGIS Geometry Model">
Section 13.4.2, “The OpenGIS Geometry Model”
</a>
include the
specific conditions that cause class instances to be
classified as not simple.
</p>
<p>
<a class="link" href="gis-general-property-functions.html#function_st-issimple">
<code class="literal">
ST_IsSimple()
</code>
</a>
handles its
arguments as described in the introduction to this section,
with this exception:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
If the geometry has a geographic SRS with a longitude or
latitude that is out of range, an error occurs:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: square; ">
<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. The exact range limits
deviate slightly due to floating-point arithmetic.
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<a name="function_st-srid">
</a>
<p>
<a class="link" href="gis-general-property-functions.html#function_st-srid">
<code class="literal">
ST_SRID(
<em class="replaceable">
<code>
g
</code>
</em>
[,
<em class="replaceable">
<code>
srid
</code>
</em>
])
</code>
</a>
</p>
<a class="indexterm" name="idm46045197473632">
</a>
<p>
With a single argument representing a valid geometry object
<em class="replaceable">
<code>
g
</code>
</em>
,
<a class="link" href="gis-general-property-functions.html#function_st-srid">
<code class="literal">
ST_SRID()
</code>
</a>
returns an integer
indicating the ID of the spatial reference system (SRS)
associated with
<em class="replaceable">
<code>
g
</code>
</em>
.
</p>
<p>
With the optional second argument representing a valid SRID
value,
<a class="link" href="gis-general-property-functions.html#function_st-srid">
<code class="literal">
ST_SRID()
</code>
</a>
returns an
object with the same type as its first argument with an SRID
value equal to the second argument. This only sets the SRID
value of the object; it does not perform any transformation
of coordinate values.
</p>
<p>
<a class="link" href="gis-general-property-functions.html#function_st-srid">
<code class="literal">
ST_SRID()
</code>
</a>
handles its
arguments as described in the introduction to this section,
with this exception:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
For the single-argument syntax,
<a class="link" href="gis-general-property-functions.html#function_st-srid">
<code class="literal">
ST_SRID()
</code>
</a>
returns the
geometry SRID even if it refers to an undefined 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
does not occur.
</p>
</li>
</ul>
</div>
<p>
<a class="link" href="gis-general-property-functions.html#function_st-srid">
<code class="literal">
ST_SRID(
<em class="replaceable">
<code>
g
</code>
</em>
,
<em class="replaceable">
<code>
target_srid
</code>
</em>
)
</code>
</a>
and
<a class="link" href="spatial-operator-functions.html#function_st-transform">
<code class="literal">
ST_Transform(
<em class="replaceable">
<code>
g
</code>
</em>
,
<em class="replaceable">
<code>
target_srid
</code>
</em>
)
</code>
</a>
differ as
follows:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
<a class="link" href="gis-general-property-functions.html#function_st-srid">
<code class="literal">
ST_SRID()
</code>
</a>
changes the
geometry SRID value without transforming its
coordinates.
</p>
</li>
<li class="listitem">
<p>
<a class="link" href="spatial-operator-functions.html#function_st-transform">
<code class="literal">
ST_Transform()
</code>
</a>
transforms
the geometry coordinates in addition to changing its
SRID value.
</p>
</li>
</ul>
</div>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa74861556"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">@g</span> <span class="token operator">=</span> <span class="token function">ST_GeomFromText</span><span class="token punctuation">(</span><span class="token string">'LineString(1 1,2 2)'</span><span class="token punctuation">,</span> <span class="token number">0</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">ST_SRID</span><span class="token punctuation">(</span><span class="token variable">@g</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>
<span class="token output"><span class="token punctuation">|</span> ST_SRID(@g) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span 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>
<span class="token prompt">mysql></span> <span class="token keyword">SET</span> <span class="token variable">@g</span> <span class="token operator">=</span> <span class="token function">ST_SRID</span><span class="token punctuation">(</span><span class="token variable">@g</span><span class="token punctuation">,</span> <span class="token number">4326</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 function">ST_SRID</span><span class="token punctuation">(</span><span class="token variable">@g</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>
<span class="token output"><span class="token punctuation">|</span> ST_SRID(@g) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 4326 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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>
It is possible to create a geometry in a particular SRID by
passing to
<a class="link" href="gis-general-property-functions.html#function_st-srid">
<code class="literal">
ST_SRID()
</code>
</a>
the
result of one of the MySQL-specific functions for creating
spatial values, along with an SRID value. For example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa77323920"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">@g1</span> <span class="token operator">=</span> <span class="token function">ST_SRID</span><span class="token punctuation">(</span><span class="token function">Point</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 number">4326</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
However, that method creates the geometry in SRID 0, then
casts it to SRID 4326 (WGS 84). A preferable alternative is
to create the geometry with the correct spatial reference
system to begin with. For example:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa77913484"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">@g1</span> <span class="token operator">=</span> <span class="token function">ST_PointFromText</span><span class="token punctuation">(</span><span class="token string">'POINT(1 1)'</span><span class="token punctuation">,</span> <span class="token number">4326</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">SET</span> <span class="token variable">@g1</span> <span class="token operator">=</span> <span class="token function">ST_GeomFromText</span><span class="token punctuation">(</span><span class="token string">'POINT(1 1)'</span><span class="token punctuation">,</span> <span class="token number">4326</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<p>
The two-argument form of
<a class="link" href="gis-general-property-functions.html#function_st-srid">
<code class="literal">
ST_SRID()
</code>
</a>
is useful for tasks
such as correcting or changing the SRS of geometries that
have an incorrect SRID.
</p>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/savepoint.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="savepoint">
</a>
15.3.4 SAVEPOINT, ROLLBACK TO SAVEPOINT, and RELEASE SAVEPOINT Statements
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045178627760">
</a>
<a class="indexterm" name="idm46045178626720">
</a>
<a class="indexterm" name="idm46045178625648">
</a>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa66696333"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">SAVEPOINT</span> <em class="replaceable">identifier</em>
<span class="token keyword">ROLLBACK</span> <span class="token punctuation">[</span><span class="token keyword">WORK</span><span class="token punctuation">]</span> <span class="token keyword">TO</span> <span class="token punctuation">[</span><span class="token keyword">SAVEPOINT</span><span class="token punctuation">]</span> <em class="replaceable">identifier</em>
<span class="token keyword">RELEASE</span> <span class="token keyword">SAVEPOINT</span> <em class="replaceable">identifier</em></code></pre>
</div>
<p>
<code class="literal">
InnoDB
</code>
supports the SQL statements
<a class="link" href="savepoint.html" title="15.3.4 SAVEPOINT, ROLLBACK TO SAVEPOINT, and RELEASE SAVEPOINT Statements">
<code class="literal">
SAVEPOINT
</code>
</a>
,
<a class="link" href="savepoint.html" title="15.3.4 SAVEPOINT, ROLLBACK TO SAVEPOINT, and RELEASE SAVEPOINT Statements">
<code class="literal">
ROLLBACK TO
SAVEPOINT
</code>
</a>
,
<a class="link" href="savepoint.html" title="15.3.4 SAVEPOINT, ROLLBACK TO SAVEPOINT, and RELEASE SAVEPOINT Statements">
<code class="literal">
RELEASE
SAVEPOINT
</code>
</a>
and the optional
<code class="literal">
WORK
</code>
keyword for
<a class="link" href="commit.html" title="15.3.1 START TRANSACTION, COMMIT, and ROLLBACK Statements">
<code class="literal">
ROLLBACK
</code>
</a>
.
</p>
<p>
The
<a class="link" href="savepoint.html" title="15.3.4 SAVEPOINT, ROLLBACK TO SAVEPOINT, and RELEASE SAVEPOINT Statements">
<code class="literal">
SAVEPOINT
</code>
</a>
statement sets a
named transaction savepoint with a name of
<em class="replaceable">
<code>
identifier
</code>
</em>
. If the current transaction
has a savepoint with the same name, the old savepoint is deleted
and a new one is set.
</p>
<p>
The
<a class="link" href="savepoint.html" title="15.3.4 SAVEPOINT, ROLLBACK TO SAVEPOINT, and RELEASE SAVEPOINT Statements">
<code class="literal">
ROLLBACK TO
SAVEPOINT
</code>
</a>
statement rolls back a transaction to the
named savepoint without terminating the transaction. Modifications
that the current transaction made to rows after the savepoint was
set are undone in the rollback, but
<code class="literal">
InnoDB
</code>
does
<span class="emphasis">
<em>
not
</em>
</span>
release the row locks that were stored in
memory after the savepoint. (For a new inserted row, the lock
information is carried by the transaction ID stored in the row;
the lock is not separately stored in memory. In this case, the row
lock is released in the undo.) Savepoints that were set at a later
time than the named savepoint are deleted.
</p>
<p>
If the
<a class="link" href="savepoint.html" title="15.3.4 SAVEPOINT, ROLLBACK TO SAVEPOINT, and RELEASE SAVEPOINT Statements">
<code class="literal">
ROLLBACK TO
SAVEPOINT
</code>
</a>
statement returns the following error, it
means that no savepoint with the specified name exists:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-none"><div class="docs-select-all right" id="sa17695036"><div class="copy-help left">Press ⌘+C to 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 1305 (42000): SAVEPOINT <em class="replaceable">identifier</em> does not exist</code></pre>
</div>
<p>
The
<a class="link" href="savepoint.html" title="15.3.4 SAVEPOINT, ROLLBACK TO SAVEPOINT, and RELEASE SAVEPOINT Statements">
<code class="literal">
RELEASE
SAVEPOINT
</code>
</a>
statement removes the named savepoint from the
set of savepoints of the current transaction. No commit or
rollback occurs. It is an error if the savepoint does not exist.
</p>
<p>
All savepoints of the current transaction are deleted if you
execute a
<a class="link" href="commit.html" title="15.3.1 START TRANSACTION, COMMIT, and ROLLBACK Statements">
<code class="literal">
COMMIT
</code>
</a>
, or a
<a class="link" href="commit.html" title="15.3.1 START TRANSACTION, COMMIT, and ROLLBACK Statements">
<code class="literal">
ROLLBACK
</code>
</a>
that
does not name a savepoint.
</p>
<p>
A new savepoint level is created when a stored function is invoked
or a trigger is activated. The savepoints on previous levels
become unavailable and thus do not conflict with savepoints on the
new level. When the function or trigger terminates, any savepoints
it created are released and the previous savepoint level is
restored.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/mysql-cluster-quick.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="mysql-cluster-quick">
</a>
25.4.1 Quick Test Setup of NDB Cluster
</h3>
</div>
</div>
</div>
<a class="indexterm" name="idm46045122003648">
</a>
<a class="indexterm" name="idm46045122002192">
</a>
<a class="indexterm" name="idm46045122000704">
</a>
<p>
To familiarize you with the basics, we describe the simplest
possible configuration for a functional NDB Cluster. After this,
you should be able to design your desired setup from the
information provided in the other relevant sections of this
chapter.
</p>
<p>
First, you need to create a configuration directory such as
<code class="filename">
/var/lib/mysql-cluster
</code>
, by executing the
following command as the system
<code class="literal">
root
</code>
user:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa96211790"><div class="copy-help left">Press ⌘+C to 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">mkdir</span> /var/lib/mysql-cluster</code></pre>
</div>
<p>
In this directory, create a file named
<code class="filename">
config.ini
</code>
that contains the following
information. Substitute appropriate values for
<code class="literal">
HostName
</code>
and
<code class="literal">
DataDir
</code>
as
necessary for your system.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-ini"><div class="docs-select-all right" id="sa82302769"><div class="copy-help left">Press ⌘+C to 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"># file "config.ini" - showing minimal setup consisting of 1 data node,</span>
<span class="token comment" spellcheck="true"># 1 management server, and 3 MySQL servers.</span>
<span class="token comment" spellcheck="true"># The empty default sections are not required, and are shown only for</span>
<span class="token comment" spellcheck="true"># the sake of completeness.</span>
<span class="token comment" spellcheck="true"># Data nodes must provide a hostname but MySQL Servers are not required</span>
<span class="token comment" spellcheck="true"># to do so.</span>
<span class="token comment" spellcheck="true"># If you do not know the hostname for your machine, use localhost.</span>
<span class="token comment" spellcheck="true"># The DataDir parameter also has a default value, but it is recommended to</span>
<span class="token comment" spellcheck="true"># set it explicitly.</span>
<span class="token comment" spellcheck="true"># [api] and [mgm] are aliases for [mysqld] and [ndb_mgmd], respectively.</span>
<span class="token selector">[ndbd default]</span>
<span class="token constant">NoOfReplicas</span><span class="token attr-value"><span class="token punctuation">=</span> 1</span>
<span class="token selector">[mysqld default]</span>
<span class="token selector">[ndb_mgmd default]</span>
<span class="token selector">[tcp default]</span>
<span class="token selector">[ndb_mgmd]</span>
<span class="token constant">HostName</span><span class="token attr-value"><span class="token punctuation">=</span> myhost.example.com</span>
<span class="token selector">[ndbd]</span>
<span class="token constant">HostName</span><span class="token attr-value"><span class="token punctuation">=</span> myhost.example.com</span>
<span class="token constant">DataDir</span><span class="token attr-value"><span class="token punctuation">=</span> /var/lib/mysql-cluster</span>
<span class="token selector">[mysqld]</span>
<span class="token selector">[mysqld]</span>
<span class="token selector">[mysqld]</span></code></pre>
</div>
<p>
You can now start 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
server. By default, it attempts to read the
<code class="filename">
config.ini
</code>
file in its current working
directory, so change location into the directory where the file is
located and then invoke
<a class="link" href="mysql-cluster-programs-ndb-mgmd.html" title="25.5.4 ndb_mgmd — The NDB Cluster Management Server Daemon">
<span class="command">
<strong>
ndb_mgmd
</strong>
</span>
</a>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa70209928"><div class="copy-help left">Press ⌘+C to 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/mysql-cluster
<span class="token prompt">$> </span><span class="token command">ndb_mgmd</span></code></pre>
</div>
<p>
Then start a single data node by running
<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>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa39743877"><div class="copy-help left">Press ⌘+C to 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">ndbd</span></code></pre>
</div>
<p>
By default,
<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>
looks for the management
server at
<code class="literal">
localhost
</code>
on port 1186.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
If you have installed MySQL from a binary tarball, you must to
specify the path of the
<a class="link" href="mysql-cluster-programs-ndb-mgmd.html" title="25.5.4 ndb_mgmd — The NDB Cluster Management Server Daemon">
<span class="command">
<strong>
ndb_mgmd
</strong>
</span>
</a>
and
<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>
servers explicitly. (Normally, these can
be found in
<code class="filename">
/usr/local/mysql/bin
</code>
.)
</p>
</div>
<p>
Finally, change location to the MySQL data directory (usually
<code class="filename">
/var/lib/mysql
</code>
or
<code class="filename">
/usr/local/mysql/data
</code>
), and make sure that
the
<code class="filename">
my.cnf
</code>
file contains the option necessary
to enable the NDB storage engine:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-ini"><div class="docs-select-all right" id="sa43644783"><div class="copy-help left">Press ⌘+C to 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">ndbcluster</span></code></pre>
</div>
<p>
You can now start the MySQL server as usual:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa11789097"><div class="copy-help left">Press ⌘+C to 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_safe</span> <span class="token constant">--user</span><span class="token attr-value"><span class="token punctuation">=</span>mysql</span> &</code></pre>
</div>
<p>
Wait a moment to make sure the MySQL server is running properly.
If you see the notice
<code class="literal">
mysql ended
</code>
, check the
server's
<code class="filename">
.err
</code>
file to find out what went
wrong.
</p>
<p>
If all has gone well so far, you now can start using the cluster.
Connect to the server and verify that the
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDBCLUSTER
</code>
</a>
storage engine is enabled:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa36151102"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql">$<span class="token operator">></span> mysql
Welcome <span class="token keyword">to</span> the MySQL monitor<span class="token punctuation">.</span> Commands <span class="token keyword">end</span> <span class="token keyword">with</span> <span class="token punctuation">;</span> <span class="token operator">or</span> \g<span class="token punctuation">.</span>
Your MySQL <span class="token keyword">connection</span> id <span class="token operator">is</span> <span class="token number">1</span> <span class="token keyword">to</span> <span class="token keyword">server</span> version: <span class="token number">8.4</span><span class="token punctuation">.</span><span class="token number">3</span>
<span class="token keyword">Type</span> <span class="token string">'help;'</span> <span class="token operator">or</span> <span class="token string">'\h'</span> <span class="token keyword">for</span> <span class="token keyword">help</span><span class="token punctuation">.</span> <span class="token keyword">Type</span> <span class="token string">'\c'</span> <span class="token keyword">to</span> clear the buffer<span class="token punctuation">.</span>
<span class="token prompt">mysql></span> <span class="token keyword">SHOW</span> <span class="token keyword">ENGINES</span>\G
<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> 12. 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> NDBCLUSTER
Support<span class="token punctuation">:</span> YES
Comment<span class="token punctuation">:</span> Clustered, fault-tolerant, memory-based 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> 13. 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> NDB
Support<span class="token punctuation">:</span> YES
Comment<span class="token punctuation">:</span> Alias for NDBCLUSTER
...</span></code></pre>
</div>
<p>
The row numbers shown in the preceding example output may be
different from those shown on your system, depending upon how your
server is configured.
</p>
<p>
Try to create an
<a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
<code class="literal">
NDBCLUSTER
</code>
</a>
table:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa16444736"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql">$<span class="token operator">></span> mysql
<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> ctest <span class="token punctuation">(</span>i <span class="token datatype">INT</span><span class="token punctuation">)</span> <span class="token keyword">ENGINE</span><span class="token operator">=</span><span class="token keyword">NDBCLUSTER</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 0 rows affected (0.09 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">SHOW</span> <span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> ctest \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> ctest
Create Table<span class="token punctuation">:</span> CREATE TABLE `ctest` (
`i` int(11) default NULL
) 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>
<p>
To check that your nodes were set up properly, start the
management client:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa11350256"><div class="copy-help left">Press ⌘+C to 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_mgm</span></code></pre>
</div>
<a class="indexterm" name="idm46045121953184">
</a>
<p>
Use the
<span class="command">
<strong>
SHOW
</strong>
</span>
command from within the management
client to obtain a report on the cluster's status:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-ndbmgm"><div class="docs-select-all right" id="sa85074722"><div class="copy-help left">Press ⌘+C to 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>
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> 1 node<span class="token punctuation">(</span>s<span class="token punctuation">)</span>
id<span class="token operator">=</span>2 @127<span class="token punctuation">.</span>0<span class="token punctuation">.</span>0<span class="token punctuation">.</span>1 <span class="token punctuation">(</span>Version<span class="token operator">:</span> 8<span class="token punctuation">.</span>4<span class="token punctuation">.</span>0<span class="token operator">-</span>ndb<span class="token operator">-</span>8<span class="token punctuation">.</span>4<span class="token punctuation">.</span>0<span class="token punctuation">,</span> Nodegroup<span class="token operator">:</span> 0<span class="token punctuation">,</span> <span class="token operator">*</span><span class="token punctuation">)</span>
<span class="token selector">[ndb_mgmd(MGM)]</span> 1 node<span class="token punctuation">(</span>s<span class="token punctuation">)</span>
id<span class="token operator">=</span>1 @127<span class="token punctuation">.</span>0<span class="token punctuation">.</span>0<span class="token punctuation">.</span>1 <span class="token punctuation">(</span>Version<span class="token operator">:</span> 8<span class="token punctuation">.</span>4<span class="token punctuation">.</span>0<span class="token operator">-</span>ndb<span class="token operator">-</span>8<span class="token punctuation">.</span>4<span class="token punctuation">.</span>0<span class="token punctuation">)</span>
<span class="token selector">[mysqld(API)]</span> 3 node<span class="token punctuation">(</span>s<span class="token punctuation">)</span>
id<span class="token operator">=</span>3 @127<span class="token punctuation">.</span>0<span class="token punctuation">.</span>0<span class="token punctuation">.</span>1 <span class="token punctuation">(</span>Version<span class="token operator">:</span> 8<span class="token punctuation">.</span>4<span class="token punctuation">.</span>0<span class="token operator">-</span>ndb<span class="token operator">-</span>8<span class="token punctuation">.</span>4<span class="token punctuation">.</span>0<span class="token punctuation">)</span>
id<span class="token operator">=</span>4 <span class="token punctuation">(</span>not connected<span class="token punctuation">,</span> accepting connect from any host<span class="token punctuation">)</span>
id<span class="token operator">=</span>5 <span class="token punctuation">(</span>not connected<span class="token punctuation">,</span> accepting connect from any host<span class="token punctuation">)</span></code></pre>
</div>
<p>
At this point, you have successfully set up a working NDB Cluster.
You can now store data in the cluster by using any table created
with
<code class="literal">
ENGINE=NDBCLUSTER
</code>
or its alias
<code class="literal">
ENGINE=NDB
</code>
.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/mysql-cluster-tde-setup.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="mysql-cluster-tde-setup">
</a>
25.6.14.1 NDB File System Encryption Setup and Usage
</h4>
</div>
</div>
</div>
<p>
<span class="emphasis">
<em>
Encryption of file system
</em>
</span>
: To enable
encryption of a previously unencrypted file system, the
following steps are required:
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
Set the required data node parameters in the
<code class="literal">
[ndbd
default]
</code>
section of the
<code class="filename">
config.ini
</code>
file, as shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-ini"><div class="docs-select-all right" id="sa24733928"><div class="copy-help left">Press ⌘+C to 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">[ndbd default]</span>
<span class="token constant">EncryptedFileSystem</span><span class="token attr-value"><span class="token punctuation">=</span> 1</span></code></pre>
</div>
<p>
These parameters must be set as shown on all data nodes.
</p>
</li>
<li class="listitem">
<p>
Start the management server with either
<a class="link" href="mysql-cluster-programs-ndb-mgmd.html#option_ndb_mgmd_initial">
<code class="option">
--initial
</code>
</a>
or
<a class="link" href="mysql-cluster-programs-ndb-mgmd.html#option_ndb_mgmd_reload">
<code class="option">
--reload
</code>
</a>
to cause it to
read the updated configuration file.
</p>
</li>
<li class="listitem">
<p>
Perform a rolling initial start (or restart) of all the data
nodes (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>
):
Start each data node with
<a class="link" href="mysql-cluster-programs-ndbd.html#option_ndbd_initial">
<code class="option">
--initial
</code>
</a>
; in addition, supply
either 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>
,
plus a password, to each data node process. When you supply
the password on the command line, a warning is shown,
similar to this one:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa67561162"><div class="copy-help left">Press ⌘+C to 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">> ndbmtd <span class="token property">-c</span> 127<span class="token punctuation">.</span>0<span class="token punctuation">.</span>0<span class="token punctuation">.</span>1 <span class="token constant">--filesystem-password</span><span class="token attr-value"><span class="token punctuation">=</span>ndbsecret</span>
ndbmtd<span class="token punctuation">:</span> <span class="token punctuation">[</span>Warning<span class="token punctuation">]</span> Using a password on the command line interface can be insecure<span class="token punctuation">.</span>
2022-08-22 16<span class="token punctuation">:</span>17<span class="token punctuation">:</span>58 <span class="token punctuation">[</span>ndbd<span class="token punctuation">]</span> INFO <span class="token property">--</span> Angel connected to <span class="token atrule">'127.0.0.1:1186'</span>
2022-08-22 16<span class="token punctuation">:</span>17<span class="token punctuation">:</span>58 <span class="token punctuation">[</span>ndbd<span class="token punctuation">]</span> INFO <span class="token property">--</span> Angel allocated nodeid<span class="token punctuation">:</span> 5</code></pre>
</div>
<p>
<code class="option">
--filesystem-password
</code>
can accept the
password form a file,
<code class="literal">
tty
</code>
, or
<code class="literal">
stdin
</code>
;
<code class="option">
--filesystem-password-from-stdin
</code>
accepts
the password from
<code class="literal">
stdin
</code>
only. The latter
protects the password from exposure on the process command
line or in the file system, and allows for the possibility
of passing it from another secure application.
</p>
<p>
You can also place the password in a
<code class="filename">
my.cnf
</code>
file that can be read by the
data node process, but not by other users of the system.
Using the same password as in the previous example, the
relevant portion of the file should look like this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-ini"><div class="docs-select-all right" id="sa11886616"><div class="copy-help left">Press ⌘+C to 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">[ndbd]</span>
<span class="token constant">filesystem-password</span><span class="token attr-value"><span class="token punctuation">=</span>ndbsecret</span></code></pre>
</div>
<p>
You can also prompt the user starting the data node process
to supply the encryption password when doing so, by using
the
<a class="link" href="mysql-cluster-programs-ndbd.html#option_ndbd_filesystem-password-from-stdin">
<code class="option">
--filesystem-password-from-stdin
</code>
</a>
option in the
<code class="filename">
my.cnf
</code>
file instead, like
this:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-ini"><div class="docs-select-all right" id="sa18566545"><div class="copy-help left">Press ⌘+C to 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">[ndbd]</span>
<span class="token constant">filesystem-password-from-stdin</span></code></pre>
</div>
<p>
In this case, the user is prompted for the password when
starting the data node process, as shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-ndbmgm"><div class="docs-select-all right" id="sa18121554"><div class="copy-help left">Press ⌘+C to 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 operator">></span> ndbmtd <span class="token operator">-</span>c 127<span class="token punctuation">.</span>0<span class="token punctuation">.</span>0<span class="token punctuation">.</span>1
Enter filesystem password<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">2022-08-22 16:36:00 [ndbd]</span> <span class="token datatype">INFO</span> <span class="token operator">--</span> Angel connected to '127<span class="token punctuation">.</span>0<span class="token punctuation">.</span>0<span class="token punctuation">.</span>1<span class="token operator">:</span>1186'
<span class="token selector">2022-08-22 16:36:00 [ndbd]</span> <span class="token datatype">INFO</span> <span class="token operator">--</span> Angel allocated nodeid<span class="token operator">:</span> 5
<span class="token operator">></span></code></pre>
</div>
<p>
Regardless of the method used, the format of the encryption
password is the same as that used for passwords for
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>
);
the password must be supplied when starting each data node
process; otherwise the data node process cannot start. This
is indicated by the following message in the data node log:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa57750876"><div class="copy-help left">Press ⌘+C to 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">> tail <span class="token property">-n2</span> ndb_5_out<span class="token punctuation">.</span>log
2022-08-22 16<span class="token punctuation">:</span>08<span class="token punctuation">:</span>30 <span class="token punctuation">[</span>ndbd<span class="token punctuation">]</span> INFO <span class="token property">--</span> Data node configured to have encryption but password not provided
2022-08-22 16<span class="token punctuation">:</span>08<span class="token punctuation">:</span>31 <span class="token punctuation">[</span>ndbd<span class="token punctuation">]</span> ALERT <span class="token property">--</span> Node 5<span class="token punctuation">:</span> Forced node shutdown completed<span class="token punctuation">.</span> Occurred during startphase 0<span class="token punctuation">.</span></code></pre>
</div>
<p>
When restarted as just described, each data node clears its
on-disk state, and rebuilds it in encrypted form.
</p>
</li>
</ol>
</div>
<p>
<span class="emphasis">
<em>
Rotation of File system password
</em>
</span>
: To update
the encryption password used by the data nodes, perform a
rolling initial restart of the data nodes, supplying the new
password to each data node when restarting it using
<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>
.
</p>
<p>
<span class="emphasis">
<em>
Decryption of file system
</em>
</span>
: To remove
encryption from an encrypted file system, do the following:
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
In the
<code class="literal">
[ndbd default]
</code>
section of the
<code class="filename">
config.ini
</code>
file, set
<code class="literal">
EncryptedFileSystem = OFF
</code>
.
</p>
</li>
<li class="listitem">
<p>
Restart the management server with
<a class="link" href="mysql-cluster-programs-ndb-mgmd.html#option_ndb_mgmd_initial">
<code class="option">
--initial
</code>
</a>
or
<a class="link" href="mysql-cluster-programs-ndb-mgmd.html#option_ndb_mgmd_reload">
<code class="option">
--reload
</code>
</a>
.
</p>
</li>
<li class="listitem">
<p>
Perform a rolling initial restart of the data nodes. Do
<span class="emphasis">
<em>
not
</em>
</span>
use any password-related options
when restarting the node binaries.
</p>
<p>
When restarted, each data node clears its on-disk state, and
rebuilds it in unencrypted form.
</p>
</li>
</ol>
</div>
<p>
To see whether file system encryption is properly configured,
you can use a query against the
<code class="literal">
ndbinfo
</code>
<a class="link" href="mysql-cluster-ndbinfo-config-values.html" title="25.6.17.12 The ndbinfo config_values Table">
<code class="literal">
config_values
</code>
</a>
and
<a class="link" href="mysql-cluster-ndbinfo-config-params.html" title="25.6.17.11 The ndbinfo config_params Table">
<code class="literal">
config_params
</code>
</a>
tables similar
to this one:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa30908465"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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> v<span class="token punctuation">.</span>node_id <span class="token keyword">AS</span> Node<span class="token punctuation">,</span> p<span class="token punctuation">.</span>param_name <span class="token keyword">AS</span> Parameter<span class="token punctuation">,</span> v<span class="token punctuation">.</span>config_value <span class="token keyword">AS</span> <span class="token keyword">Value</span>
<span class="token prompt"> -></span> <span class="token keyword">FROM</span> ndbinfo<span class="token punctuation">.</span>config_values v
<span class="token prompt"> -></span> <span class="token keyword">JOIN</span> ndbinfo<span class="token punctuation">.</span>config_params p
<span class="token prompt"> -></span> <span class="token keyword">ON</span> v<span class="token punctuation">.</span>config_param<span class="token operator">=</span>p<span class="token punctuation">.</span>param_number
<span class="token prompt"> -></span> <span class="token keyword">WHERE</span> p<span class="token punctuation">.</span>param_name<span class="token operator">=</span><span class="token string">'EncryptedFileSystem'</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> Node <span class="token punctuation">|</span> Parameter <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>
<span class="token output"><span class="token punctuation">|</span> 5 <span class="token punctuation">|</span> EncryptedFileSystem <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> EncryptedFileSystem <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 7 <span class="token punctuation">|</span> EncryptedFileSystem <span class="token punctuation">|</span> 1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 8 <span class="token punctuation">|</span> EncryptedFileSystem <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">4 rows in set (0.10 sec)</span></code></pre>
</div>
<p>
Here,
<a class="link" href="mysql-cluster-ndbd-definition.html#ndbparam-ndbd-encryptedfilesystem">
<code class="literal">
EncryptedFileSystem
</code>
</a>
is
equal to
<code class="literal">
1
</code>
on all data nodes, which means
that filesystem encryption is enabled for this cluster.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/sys-ps-is-account-enabled.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="sys-ps-is-account-enabled">
</a>
30.4.5.9 The ps_is_account_enabled() Function
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045060891392">
</a>
<a class="indexterm" name="idm46045060889888">
</a>
<p>
Returns
<code class="literal">
YES
</code>
or
<code class="literal">
NO
</code>
to
indicate whether Performance Schema instrumentation for a
given account is enabled.
</p>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="sys-ps-is-account-enabled-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_host VARCHAR(60)
</code>
: The host name of
the account to check.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
in_user VARCHAR(32)
</code>
: The user name of
the account to check.
</p>
</li>
</ul>
</div>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="sys-ps-is-account-enabled-return-value">
</a>
Return Value
</h5>
</div>
</div>
</div>
<p>
An
<code class="literal">
ENUM('YES','NO')
</code>
value.
</p>
</div>
<div class="simplesect">
<div class="titlepage">
<div>
<div class="simple">
<h5 class="title">
<a name="sys-ps-is-account-enabled-example">
</a>
Example
</h5>
</div>
</div>
</div>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa92271033"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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>ps_is_account_enabled<span class="token punctuation">(</span><span class="token string">'localhost'</span><span class="token punctuation">,</span> <span class="token string">'root'</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> sys.ps_is_account_enabled('localhost', 'root') <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> YES <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/source-installation.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title">
<a name="source-installation">
</a>
2.8 Installing MySQL from Source
</h2>
</div>
</div>
</div>
<div class="toc">
<dl class="toc">
<dt>
<span class="section">
<a href="source-installation-methods.html">
2.8.1 Source Installation Methods
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="source-installation-prerequisites.html">
2.8.2 Source Installation Prerequisites
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="source-installation-layout.html">
2.8.3 MySQL Layout for Source Installation
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="installing-source-distribution.html">
2.8.4 Installing MySQL Using a Standard Source Distribution
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="installing-development-tree.html">
2.8.5 Installing MySQL Using a Development Source Tree
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="source-ssl-library-configuration.html">
2.8.6 Configuring SSL Library Support
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="source-configuration-options.html">
2.8.7 MySQL Source-Configuration Options
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="compilation-problems.html">
2.8.8 Dealing with Problems Compiling MySQL
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="source-configuration-third-party.html">
2.8.9 MySQL Configuration and Third-Party Tools
</a>
</span>
</dt>
<dt>
<span class="section">
<a href="source-installation-doxygen.html">
2.8.10 Generating MySQL Doxygen Documentation Content
</a>
</span>
</dt>
</dl>
</div>
<a class="indexterm" name="idm46045329722592">
</a>
<a class="indexterm" name="idm46045329721136">
</a>
<a class="indexterm" name="idm46045329719648">
</a>
<p>
Building MySQL from the source code enables you to customize build
parameters, compiler optimizations, and installation location. For a
list of systems on which MySQL is known to run, see
<a class="ulink" href="https://www.mysql.com/support/supportedplatforms/database.html" target="_blank">
https://www.mysql.com/support/supportedplatforms/database.html
</a>
.
</p>
<p>
Before you proceed with an installation from source, check whether
Oracle produces a precompiled binary distribution for your platform
and whether it works for you. We put a great deal of effort into
ensuring that our binaries are built with the best possible options
for optimal performance. Instructions for installing binary
distributions are available in
<a class="xref" href="binary-installation.html" title="2.2 Installing MySQL on Unix/Linux Using Generic Binaries">
Section 2.2, “Installing MySQL on Unix/Linux Using Generic Binaries”
</a>
.
</p>
<a class="indexterm" name="idm46045329715904">
</a>
<p>
If you are interested in building MySQL from a source distribution
using build options the same as or similar to those use by Oracle to
produce binary distributions on your platform, obtain a binary
distribution, unpack it, and look in the
<code class="filename">
docs/INFO_BIN
</code>
file, which contains information
about how that MySQL distribution was configured and compiled.
</p>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Warning
</div>
<p>
Building MySQL with nonstandard options may lead to reduced
functionality, performance, or security.
</p>
</div>
<p>
The MySQL source code contains internal documentation written using
Doxygen. The generated Doxygen content is available at
<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>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/mysql-cluster-ndbinfo-processes.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h4 class="title">
<a name="mysql-cluster-ndbinfo-processes">
</a>
25.6.17.51 The ndbinfo processes Table
</h4>
</div>
</div>
</div>
<a class="indexterm" name="idm46045088252656">
</a>
<p>
This table contains information about NDB Cluster node
processes; each node is represented by the row in the table.
Only nodes that are connected to the cluster are shown in this
table. You can obtain information about nodes that are
configured but not connected to the cluster from the
<a class="link" href="mysql-cluster-ndbinfo-nodes.html" title="25.6.17.48 The ndbinfo nodes Table">
<code class="literal">
nodes
</code>
</a>
and
<a class="link" href="mysql-cluster-ndbinfo-config-nodes.html" title="25.6.17.10 The ndbinfo config_nodes Table">
<code class="literal">
config_nodes
</code>
</a>
tables.
</p>
<p>
The
<code class="literal">
processes
</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 node's unique node ID in the cluster
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
node_type
</code>
</p>
<p>
Type of node (management, data, or API node; see text)
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
node_version
</code>
</p>
<p>
Version of the
<code class="literal">
NDB
</code>
software program
running on this node.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
process_id
</code>
</p>
<p>
This node's process ID
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
angel_process_id
</code>
</p>
<p>
Process ID of this node's angel process
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
process_name
</code>
</p>
<p>
Name of the executable
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
service_URI
</code>
</p>
<p>
Service URI of this node (see text)
</p>
</li>
</ul>
</div>
<h5>
<a name="idm46045088232096">
</a>
Notes
</h5>
<p>
<code class="literal">
node_id
</code>
is the ID assigned to this node in
the cluster.
</p>
<p>
The
<code class="literal">
node_type
</code>
column displays one of the
following three values:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
MGM
</code>
: Management node.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
NDB
</code>
: Data node.
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
API
</code>
: API or SQL node.
</p>
</li>
</ul>
</div>
<p>
For an executable shipped with the NDB Cluster distribution,
<code class="literal">
node_version
</code>
shows the software Cluster
version string, such as
<code class="literal">
8.4.0-ndb-8.4.0
</code>
.
</p>
<p>
<code class="literal">
process_id
</code>
is the node executable's
process ID as shown by the host operating system using a process
display application such as
<span class="command">
<strong>
top
</strong>
</span>
on Linux, or
the Task Manager on Windows platforms.
</p>
<p>
<code class="literal">
angel_process_id
</code>
is the system process ID for
the node's angel process, which ensures that a data node or
SQL is automatically restarted in cases of failures. For
management nodes and API nodes other than SQL nodes, the value
of this column is
<code class="literal">
NULL
</code>
.
</p>
<p>
The
<code class="literal">
process_name
</code>
column shows the name of the
running executable. For management nodes, this is
<code class="literal">
ndb_mgmd
</code>
. For data nodes, this is
<code class="literal">
ndbd
</code>
(single-threaded) or
<code class="literal">
ndbmtd
</code>
(multithreaded). For SQL nodes, this
is
<code class="literal">
mysqld
</code>
. For other types of API nodes, it
is the name of the executable program connected to the cluster;
NDB API applications can set a custom value for this using
<a class="ulink" href="/doc/ndbapi/en/ndb-ndb-cluster-connection.html#ndb-ndb-cluster-connection-set-name" target="_top">
<code class="literal">
Ndb_cluster_connection::set_name()
</code>
</a>
.
</p>
<p>
<code class="literal">
service_URI
</code>
shows the service network
address. For management nodes and data nodes, the scheme used is
<code class="literal">
ndb://
</code>
. For SQL nodes, this is
<code class="literal">
mysql://
</code>
. By default, API nodes other than
SQL nodes use
<code class="literal">
ndb://
</code>
for the scheme; NDB API
applications can set this to a custom value using
<code class="literal">
Ndb_cluster_connection::set_service_uri()
</code>
.
regardless of the node type, the scheme is followed by the IP
address used by the NDB transporter for the node in question.
For management nodes and SQL nodes, this address includes the
port number (usually 1186 for management nodes and 3306 for SQL
nodes). If the SQL node was started with the
<a class="link" href="server-system-variables.html#sysvar_bind_address">
<code class="literal">
bind_address
</code>
</a>
system variable
set, this address is used instead of the transporter address,
unless the bind address is set to
<code class="literal">
*
</code>
,
<code class="literal">
0.0.0.0
</code>
, or
<code class="literal">
::
</code>
.
</p>
<p>
Additional path information may be included in the
<code class="literal">
service_URI
</code>
value for an SQL node reflecting
various configuration options. For example,
<code class="literal">
mysql://198.51.100.3/tmp/mysql.sock
</code>
indicates
that the SQL node was started with the
<a class="link" href="server-system-variables.html#sysvar_skip_networking">
<code class="literal">
skip_networking
</code>
</a>
system variable
enabled, and
<code class="literal">
mysql://198.51.100.3:3306/?server-id=1
</code>
shows
that replication is enabled for this SQL node.
</p>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/json-utility-functions.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="json-utility-functions">
</a>
14.17.8 JSON Utility Functions
</h3>
</div>
</div>
</div>
<p>
This section documents utility functions that act on JSON values,
or strings that can be parsed as JSON values.
<a class="link" href="json-utility-functions.html#function_json-pretty">
<code class="literal">
JSON_PRETTY()
</code>
</a>
prints out a JSON
value in a format that is easy to read.
<a class="link" href="json-utility-functions.html#function_json-storage-size">
<code class="literal">
JSON_STORAGE_SIZE()
</code>
</a>
and
<a class="link" href="json-utility-functions.html#function_json-storage-free">
<code class="literal">
JSON_STORAGE_FREE()
</code>
</a>
show,
respectively, the amount of storage space used by a given JSON
value and the amount of space remaining in a
<code class="literal">
JSON
</code>
column following a partial update.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<a name="function_json-pretty">
</a>
<p>
<a class="link" href="json-utility-functions.html#function_json-pretty">
<code class="literal">
JSON_PRETTY(
<em class="replaceable">
<code>
json_val
</code>
</em>
)
</code>
</a>
</p>
<a class="indexterm" name="idm46045194253936">
</a>
<p>
Provides pretty-printing of JSON values similar to that
implemented in PHP and by other languages and database
systems. The value supplied must be a JSON value or a valid
string representation of a JSON value. Extraneous whitespaces
and newlines present in this value have no effect on the
output. For a
<code class="literal">
NULL
</code>
value, the function
returns
<code class="literal">
NULL
</code>
. If the value is not a JSON
document, or if it cannot be parsed as one, the function fails
with an error.
</p>
<p>
Formatting of the output from this function adheres to the
following rules:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p>
Each array element or object member appears on a separate
line, indented by one additional level as compared to its
parent.
</p>
</li>
<li class="listitem">
<p>
Each level of indentation adds two leading spaces.
</p>
</li>
<li class="listitem">
<p>
A comma separating individual array elements or object
members is printed before the newline that separates the
two elements or members.
</p>
</li>
<li class="listitem">
<p>
The key and the value of an object member are separated by
a colon followed by a space ('
<code class="literal">
:
</code>
').
</p>
</li>
<li class="listitem">
<p>
An empty object or array is printed on a single line. No
space is printed between the opening and closing brace.
</p>
</li>
<li class="listitem">
<p>
Special characters in string scalars and key names are
escaped employing the same rules used by the
<a class="link" href="json-creation-functions.html#function_json-quote">
<code class="literal">
JSON_QUOTE()
</code>
</a>
function.
</p>
</li>
</ul>
</div>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa27010127"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">JSON_PRETTY</span><span class="token punctuation">(</span><span class="token string">'123'</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment" spellcheck="true"># scalar</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span 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_PRETTY('123') <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 123 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><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">JSON_PRETTY</span><span class="token punctuation">(</span><span class="token string">"[1,3,5]"</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment" spellcheck="true"># array</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span 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_PRETTY("[1,3,5]") <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token operator">|</span> <span class="token punctuation">[</span>
<span class="token number">1</span><span class="token punctuation">,</span>
<span class="token number">3</span><span class="token punctuation">,</span>
<span class="token number">5</span>
<span class="token punctuation">]</span> <span class="token operator">|</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><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">JSON_PRETTY</span><span class="token punctuation">(</span><span class="token string">'{"a":"10","b":"15","x":"25"}'</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment" spellcheck="true"># object</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span 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_PRETTY('{"a":"10","b":"15","x":"25"}') <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token operator">|</span> {
<span class="token string">"a"</span>: <span class="token string">"10"</span><span class="token punctuation">,</span>
<span class="token string">"b"</span>: <span class="token string">"15"</span><span class="token punctuation">,</span>
<span class="token string">"x"</span>: <span class="token string">"25"</span>
} <span class="token operator">|</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><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">JSON_PRETTY</span><span class="token punctuation">(</span><span class="token string">'["a",1,{"key1":
'</span><span class="token operator">></span> <span class="token string">"value1"</span>}<span class="token punctuation">,</span><span class="token string">"5"</span><span class="token punctuation">,</span> <span class="token string">"77"</span> <span class="token punctuation">,</span>
<span class="token string">'> {"key2":["value3","valueX",
'</span><span class="token operator">></span> <span class="token string">"valueY"</span><span class="token punctuation">]</span>}<span class="token punctuation">,</span><span class="token string">"j"</span><span class="token punctuation">,</span> <span class="token string">"2"</span> <span class="token punctuation">]</span><span class="token string">')\G # nested arrays and objects
*************************** 1. row ***************************
JSON_PRETTY('</span><span class="token inlinejson"><span class="token punctuation">[</span><span class="token string">"a"</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 property">"key1"</span><span class="token operator">:</span>
<span class="token string">"value1"</span><span class="token punctuation">}</span><span class="token punctuation">,</span><span class="token string">"5"</span><span class="token punctuation">,</span> <span class="token string">"77"</span> <span class="token punctuation">,</span>
<span class="token punctuation">{</span><span class="token property">"key2"</span><span class="token operator">:</span><span class="token punctuation">[</span><span class="token string">"value3"</span><span class="token punctuation">,</span><span class="token string">"valuex"</span><span class="token punctuation">,</span>
<span class="token string">"valuey"</span><span class="token punctuation">]</span><span class="token punctuation">}</span><span class="token punctuation">,</span><span class="token string">"j"</span><span class="token punctuation">,</span> <span class="token string">"2"</span> <span class="token punctuation">]</span>'<span class="token punctuation">)</span><span class="token operator">:</span> <span class="token punctuation">[</span>
<span class="token string">"a"</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 property">"key1"</span><span class="token operator">:</span> <span class="token string">"value1"</span>
<span class="token punctuation">}</span><span class="token punctuation">,</span>
<span class="token string">"5"</span><span class="token punctuation">,</span>
<span class="token string">"77"</span><span class="token punctuation">,</span>
<span class="token punctuation">{</span>
<span class="token property">"key2"</span><span class="token operator">:</span> <span class="token punctuation">[</span>
<span class="token string">"value3"</span><span class="token punctuation">,</span>
<span class="token string">"valuex"</span><span class="token punctuation">,</span>
<span class="token string">"valuey"</span>
<span class="token punctuation">]</span>
<span class="token punctuation">}</span><span class="token punctuation">,</span>
<span class="token string">"j"</span><span class="token punctuation">,</span>
<span class="token string">"2"</span>
<span class="token punctuation">]</span></span></code></pre>
</div>
</li>
<li class="listitem">
<a name="function_json-storage-free">
</a>
<p>
<a class="link" href="json-utility-functions.html#function_json-storage-free">
<code class="literal">
JSON_STORAGE_FREE(
<em class="replaceable">
<code>
json_val
</code>
</em>
)
</code>
</a>
</p>
<a class="indexterm" name="idm46045194228128">
</a>
<p>
For a
<a class="link" href="json.html" title="13.5 The JSON Data Type">
<code class="literal">
JSON
</code>
</a>
column value, this
function shows how much storage space was freed in its binary
representation after it was updated in place using
<a class="link" href="json-modification-functions.html#function_json-set">
<code class="literal">
JSON_SET()
</code>
</a>
,
<a class="link" href="json-modification-functions.html#function_json-replace">
<code class="literal">
JSON_REPLACE()
</code>
</a>
, or
<a class="link" href="json-modification-functions.html#function_json-remove">
<code class="literal">
JSON_REMOVE()
</code>
</a>
. The argument can
also be a valid JSON document or a string which can be parsed
as one—either as a literal value or as the value of a
user variable—in which case the function returns 0. It
returns a positive, nonzero value if the argument is a
<code class="literal">
JSON
</code>
column value which has been updated as
described previously, such that its binary representation
takes up less space than it did prior to the update. For a
<code class="literal">
JSON
</code>
column which has been updated such
that its binary representation is the same as or larger than
before, or if the update was not able to take advantage of a
partial update, it returns 0; it returns
<code class="literal">
NULL
</code>
if the argument is
<code class="literal">
NULL
</code>
.
</p>
<p>
If
<em class="replaceable">
<code>
json_val
</code>
</em>
is not
<code class="literal">
NULL
</code>
, and neither is a valid JSON document
nor can be successfully parsed as one, an error results.
</p>
<p>
In this example, we create a table containing a
<code class="literal">
JSON
</code>
column, then insert a row containing a
JSON object:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa52974016"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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> jtable <span class="token punctuation">(</span>jcol <span class="token datatype">JSON</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 0 rows affected (0.38 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">INSERT</span> <span class="token keyword">INTO</span> jtable <span class="token keyword">VALUES</span>
<span class="token prompt"> -></span> <span class="token punctuation">(</span><span class="token string">'{"a": 10, "b": "wxyz", "c": "[true, false]"}'</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">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> jtable<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> jcol <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span 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": 10, "b": "wxyz", "c": "[true, false]"} <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span 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>
Now we update the column value using
<code class="literal">
JSON_SET()
</code>
such that a partial update can
be performed; in this case, we replace the value pointed to by
the
<code class="literal">
c
</code>
key (the array
<code class="literal">
[true,
false]
</code>
) with one that takes up less space (the
integer
<code class="literal">
1
</code>
):
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa80443634"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">UPDATE</span> jtable
<span class="token prompt"> -></span> <span class="token keyword">SET</span> jcol <span class="token operator">=</span> <span class="token function">JSON_SET</span><span class="token punctuation">(</span>jcol<span class="token punctuation">,</span> <span class="token string">"$.a"</span><span class="token punctuation">,</span> <span class="token number">10</span><span class="token punctuation">,</span> <span class="token string">"$.b"</span><span class="token punctuation">,</span> <span class="token string">"wxyz"</span><span class="token punctuation">,</span> <span class="token string">"$.c"</span><span class="token punctuation">,</span> <span class="token number">1</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 1 row affected (0.03 sec)</span>
<span class="token output">Rows matched: 1 Changed: 1 Warnings: 0</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> jtable<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> jcol <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span 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": 10, "b": "wxyz", "c": 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>
<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">JSON_STORAGE_FREE</span><span class="token punctuation">(</span>jcol<span class="token punctuation">)</span> <span class="token keyword">FROM</span> jtable<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> JSON_STORAGE_FREE(jcol) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 14 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output">1 row in set (0.00 sec)</span></code></pre>
</div>
<p>
The effects of successive partial updates on this free space
are cumulative, as shown in this example using
<code class="literal">
JSON_SET()
</code>
to reduce the space taken up by
the value having key
<code class="literal">
b
</code>
(and making no other
changes):
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa4410044"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">UPDATE</span> jtable
<span class="token prompt"> -></span> <span class="token keyword">SET</span> jcol <span class="token operator">=</span> <span class="token function">JSON_SET</span><span class="token punctuation">(</span>jcol<span class="token punctuation">,</span> <span class="token string">"$.a"</span><span class="token punctuation">,</span> <span class="token number">10</span><span class="token punctuation">,</span> <span class="token string">"$.b"</span><span class="token punctuation">,</span> <span class="token string">"wx"</span><span class="token punctuation">,</span> <span class="token string">"$.c"</span><span class="token punctuation">,</span> <span class="token number">1</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 1 row affected (0.03 sec)</span>
<span class="token output">Rows matched: 1 Changed: 1 Warnings: 0</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">JSON_STORAGE_FREE</span><span class="token punctuation">(</span>jcol<span class="token punctuation">)</span> <span class="token keyword">FROM</span> jtable<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> JSON_STORAGE_FREE(jcol) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 16 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output">1 row in set (0.00 sec)</span></code></pre>
</div>
<p>
Updating the column without using
<code class="literal">
JSON_SET()
</code>
,
<code class="literal">
JSON_REPLACE()
</code>
, or
<code class="literal">
JSON_REMOVE()
</code>
means that the optimizer
cannot perform the update in place; in this case,
<code class="literal">
JSON_STORAGE_FREE()
</code>
returns 0, as shown
here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa95017245"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">UPDATE</span> jtable <span class="token keyword">SET</span> jcol <span class="token operator">=</span> <span class="token string">'{"a": 10, "b": 1}'</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 1 row affected (0.05 sec)</span>
<span class="token output">Rows matched: 1 Changed: 1 Warnings: 0</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token function">JSON_STORAGE_FREE</span><span class="token punctuation">(</span>jcol<span class="token punctuation">)</span> <span class="token keyword">FROM</span> jtable<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> JSON_STORAGE_FREE(jcol) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span 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>
<span class="token output">1 row in set (0.00 sec)</span></code></pre>
</div>
<p>
Partial updates of JSON documents can be performed only on
column values. For a user variable that stores a JSON value,
the value is always completely replaced, even when the update
is performed using
<code class="literal">
JSON_SET()
</code>
:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa93070926"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">@j</span> <span class="token operator">=</span> <span class="token string">'{"a": 10, "b": "wxyz", "c": "[true, false]"}'</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">@j</span> <span class="token operator">=</span> <span class="token function">JSON_SET</span><span class="token punctuation">(</span><span class="token variable">@j</span><span class="token punctuation">,</span> <span class="token string">'$.a'</span><span class="token punctuation">,</span> <span class="token number">10</span><span class="token punctuation">,</span> <span class="token string">'$.b'</span><span class="token punctuation">,</span> <span class="token string">'wxyz'</span><span class="token punctuation">,</span> <span class="token string">'$.c'</span><span class="token punctuation">,</span> <span class="token string">'1'</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 variable">@j</span><span class="token punctuation">,</span> <span class="token function">JSON_STORAGE_FREE</span><span class="token punctuation">(</span><span class="token variable">@j</span><span class="token punctuation">)</span> <span class="token keyword">AS</span> Free<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> @j <span class="token punctuation">|</span> Free <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span 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": 10, "b": "wxyz", "c": "1"} <span class="token punctuation">|</span> 0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output">1 row in set (0.00 sec)</span></code></pre>
</div>
<p>
For a JSON literal, this function always returns 0:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa94593370"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">JSON_STORAGE_FREE</span><span class="token punctuation">(</span><span class="token string">'{"a": 10, "b": "wxyz", "c": "1"}'</span><span class="token punctuation">)</span> <span class="token keyword">AS</span> Free<span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> Free <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span 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>
<span class="token output">1 row in set (0.00 sec)</span></code></pre>
</div>
</li>
<li class="listitem">
<a name="function_json-storage-size">
</a>
<p>
<a class="link" href="json-utility-functions.html#function_json-storage-size">
<code class="literal">
JSON_STORAGE_SIZE(
<em class="replaceable">
<code>
json_val
</code>
</em>
)
</code>
</a>
</p>
<a class="indexterm" name="idm46045194177200">
</a>
<p>
This function returns the number of bytes used to store the
binary representation of a JSON document. When the argument is
a
<code class="literal">
JSON
</code>
column, this is the space used to
store the JSON document as it was inserted into the column,
prior to any partial updates that may have been performed on
it afterwards.
<em class="replaceable">
<code>
json_val
</code>
</em>
must be a
valid JSON document or a string which can be parsed as one. In
the case where it is string, the function returns the amount
of storage space in the JSON binary representation that is
created by parsing the string as JSON and converting it to
binary. It returns
<code class="literal">
NULL
</code>
if the argument is
<code class="literal">
NULL
</code>
.
</p>
<p>
An error results when
<em class="replaceable">
<code>
json_val
</code>
</em>
is
not
<code class="literal">
NULL
</code>
, and is not—or cannot be
successfully parsed as—a JSON document.
</p>
<p>
To illustrate this function's behavior when used with a
<code class="literal">
JSON
</code>
column as its argument, we create a
table named
<code class="literal">
jtable
</code>
containing a
<code class="literal">
JSON
</code>
column
<code class="literal">
jcol
</code>
, insert
a JSON value into the table, then obtain the storage space
used by this column with
<code class="literal">
JSON_STORAGE_SIZE()
</code>
, as shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa24605229"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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> jtable <span class="token punctuation">(</span>jcol <span class="token datatype">JSON</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 0 rows affected (0.42 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">INSERT</span> <span class="token keyword">INTO</span> jtable <span class="token keyword">VALUES</span>
<span class="token prompt"> -></span> <span class="token punctuation">(</span><span class="token string">'{"a": 1000, "b": "wxyz", "c": "[1, 3, 5, 7]"}'</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">SELECT</span>
<span class="token prompt"> -></span> jcol<span class="token punctuation">,</span>
<span class="token prompt"> -></span> <span class="token function">JSON_STORAGE_SIZE</span><span class="token punctuation">(</span>jcol<span class="token punctuation">)</span> <span class="token keyword">AS</span> Size<span class="token punctuation">,</span>
<span class="token prompt"> -></span> <span class="token function">JSON_STORAGE_FREE</span><span class="token punctuation">(</span>jcol<span class="token punctuation">)</span> <span class="token keyword">AS</span> Free
<span class="token prompt"> -></span> <span class="token keyword">FROM</span> jtable<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> jcol <span class="token punctuation">|</span> Size <span class="token punctuation">|</span> Free <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span 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": 1000, "b": "wxyz", "c": "[1, 3, 5, 7]"} <span class="token punctuation">|</span> 47 <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>
<span class="token output">1 row in set (0.00 sec)</span></code></pre>
</div>
<p>
According to the output of
<code class="literal">
JSON_STORAGE_SIZE()
</code>
, the JSON document
inserted into the column takes up 47 bytes. We also checked
the amount of space freed by any previous partial updates of
the column using
<a class="link" href="json-utility-functions.html#function_json-storage-free">
<code class="literal">
JSON_STORAGE_FREE()
</code>
</a>
; since no
updates have yet been performed, this is 0, as expected.
</p>
<p>
Next we perform an
<a class="link" href="update.html" title="15.2.17 UPDATE Statement">
<code class="literal">
UPDATE
</code>
</a>
on
the table that should result in a partial update of the
document stored in
<code class="literal">
jcol
</code>
, and then test the
result as shown here:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa22006261"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">UPDATE</span> jtable <span class="token keyword">SET</span> jcol <span class="token operator">=</span>
<span class="token prompt"> -></span> <span class="token function">JSON_SET</span><span class="token punctuation">(</span>jcol<span class="token punctuation">,</span> <span class="token string">"$.b"</span><span class="token punctuation">,</span> <span class="token string">"a"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 1 row affected (0.04 sec)</span>
<span class="token output">Rows matched: 1 Changed: 1 Warnings: 0</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span>
<span class="token prompt"> -></span> jcol<span class="token punctuation">,</span>
<span class="token prompt"> -></span> <span class="token function">JSON_STORAGE_SIZE</span><span class="token punctuation">(</span>jcol<span class="token punctuation">)</span> <span class="token keyword">AS</span> Size<span class="token punctuation">,</span>
<span class="token prompt"> -></span> <span class="token function">JSON_STORAGE_FREE</span><span class="token punctuation">(</span>jcol<span class="token punctuation">)</span> <span class="token keyword">AS</span> Free
<span class="token prompt"> -></span> <span class="token keyword">FROM</span> jtable<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> jcol <span class="token punctuation">|</span> Size <span class="token punctuation">|</span> Free <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span 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": 1000, "b": "a", "c": "[1, 3, 5, 7]"} <span class="token punctuation">|</span> 47 <span class="token punctuation">|</span> 3 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span 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 value returned by
<code class="literal">
JSON_STORAGE_FREE()
</code>
in the previous query indicates that a partial update of the
JSON document was performed, and that this freed 3 bytes of
space used to store it. The result returned by
<code class="literal">
JSON_STORAGE_SIZE()
</code>
is unchanged by the
partial update.
</p>
<p>
Partial updates are supported for updates using
<a class="link" href="json-modification-functions.html#function_json-set">
<code class="literal">
JSON_SET()
</code>
</a>
,
<a class="link" href="json-modification-functions.html#function_json-replace">
<code class="literal">
JSON_REPLACE()
</code>
</a>
, or
<a class="link" href="json-modification-functions.html#function_json-remove">
<code class="literal">
JSON_REMOVE()
</code>
</a>
. The direct
assignment of a value to a
<code class="literal">
JSON
</code>
column
cannot be partially updated; following such an update,
<code class="literal">
JSON_STORAGE_SIZE()
</code>
always shows the
storage used for the newly-set value:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa1693583"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">UPDATE</span> jtable
<span class="token prompt">mysql></span> <span class="token keyword">SET</span> jcol <span class="token operator">=</span> <span class="token string">'{"a": 4.55, "b": "wxyz", "c": "[true, false]"}'</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 1 row affected (0.04 sec)</span>
<span class="token output">Rows matched: 1 Changed: 1 Warnings: 0</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span>
<span class="token prompt"> -></span> jcol<span class="token punctuation">,</span>
<span class="token prompt"> -></span> <span class="token function">JSON_STORAGE_SIZE</span><span class="token punctuation">(</span>jcol<span class="token punctuation">)</span> <span class="token keyword">AS</span> Size<span class="token punctuation">,</span>
<span class="token prompt"> -></span> <span class="token function">JSON_STORAGE_FREE</span><span class="token punctuation">(</span>jcol<span class="token punctuation">)</span> <span class="token keyword">AS</span> Free
<span class="token prompt"> -></span> <span class="token keyword">FROM</span> jtable<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> jcol <span class="token punctuation">|</span> Size <span class="token punctuation">|</span> Free <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span 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": 4.55, "b": "wxyz", "c": "[true, false]"} <span class="token punctuation">|</span> 56 <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>
<span class="token output">1 row in set (0.00 sec)</span></code></pre>
</div>
<p>
A JSON user variable cannot be partially updated. This means
that this function always shows the space currently used to
store a JSON document in a user variable:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa72757799"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">@j</span> <span class="token operator">=</span> <span class="token string">'[100, "sakila", [1, 3, 5], 425.05]'</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">@j</span><span class="token punctuation">,</span> <span class="token function">JSON_STORAGE_SIZE</span><span class="token punctuation">(</span><span class="token variable">@j</span><span class="token punctuation">)</span> <span class="token keyword">AS</span> Size<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> @j <span class="token punctuation">|</span> Size <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> [100, "sakila", [1, 3, 5], 425.05] <span class="token punctuation">|</span> 45 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output">1 row in set (0.00 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">SET</span> <span class="token variable">@j</span> <span class="token operator">=</span> <span class="token function">JSON_SET</span><span class="token punctuation">(</span><span class="token variable">@j</span><span class="token punctuation">,</span> <span class="token string">'$[1]'</span><span class="token punctuation">,</span> <span class="token string">"json"</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 variable">@j</span><span class="token punctuation">,</span> <span class="token function">JSON_STORAGE_SIZE</span><span class="token punctuation">(</span><span class="token variable">@j</span><span class="token punctuation">)</span> <span class="token keyword">AS</span> Size<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> @j <span class="token punctuation">|</span> Size <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> [100, "json", [1, 3, 5], 425.05] <span class="token punctuation">|</span> 43 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output">1 row in set (0.00 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">SET</span> <span class="token variable">@j</span> <span class="token operator">=</span> <span class="token function">JSON_SET</span><span class="token punctuation">(</span><span class="token variable">@j</span><span class="token punctuation">,</span> <span class="token string">'$[2][0]'</span><span class="token punctuation">,</span> <span class="token function">JSON_ARRAY</span><span class="token punctuation">(</span><span class="token number">10</span><span class="token punctuation">,</span> <span class="token number">20</span><span class="token punctuation">,</span> <span class="token number">30</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token 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">@j</span><span class="token punctuation">,</span> <span class="token function">JSON_STORAGE_SIZE</span><span class="token punctuation">(</span><span class="token variable">@j</span><span class="token punctuation">)</span> <span class="token keyword">AS</span> Size<span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> @j <span class="token punctuation">|</span> Size <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> [100, "json", [[10, 20, 30], 3, 5], 425.05] <span class="token punctuation">|</span> 56 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span 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>
For a JSON literal, this function always returns the current
storage space used:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa99951128"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">JSON_STORAGE_SIZE</span><span class="token punctuation">(</span><span class="token string">'[100, "sakila", [1, 3, 5], 425.05]'</span><span class="token punctuation">)</span> <span class="token keyword">AS</span> A<span class="token punctuation">,</span>
<span class="token prompt"> -></span> <span class="token function">JSON_STORAGE_SIZE</span><span class="token punctuation">(</span><span class="token string">'{"a": 1000, "b": "a", "c": "[1, 3, 5, 7]"}'</span><span class="token punctuation">)</span> <span class="token keyword">AS</span> B<span class="token punctuation">,</span>
<span class="token prompt"> -></span> <span class="token function">JSON_STORAGE_SIZE</span><span class="token punctuation">(</span><span class="token string">'{"a": 1000, "b": "wxyz", "c": "[1, 3, 5, 7]"}'</span><span class="token punctuation">)</span> <span class="token keyword">AS</span> C<span class="token punctuation">,</span>
<span class="token prompt"> -></span> <span class="token function">JSON_STORAGE_SIZE</span><span class="token punctuation">(</span><span class="token string">'[100, "json", [[10, 20, 30], 3, 5], 425.05]'</span><span class="token punctuation">)</span> <span class="token keyword">AS</span> D<span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> A <span class="token punctuation">|</span> B <span class="token punctuation">|</span> C <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 class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> 45 <span class="token punctuation">|</span> 44 <span class="token punctuation">|</span> 47 <span class="token punctuation">|</span> 56 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output">1 row in set (0.00 sec)</span></code></pre>
</div>
</li>
</ul>
</div>
</div>
<br/>
</div>
|
https://dev.mysql.com/doc/refman/8.4/en/innodb-information-schema-metrics-table.html | <div id="docs-body">
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="innodb-information-schema-metrics-table">
</a>
17.15.6 InnoDB INFORMATION_SCHEMA Metrics Table
</h3>
</div>
</div>
</div>
<p>
The
<a class="link" href="information-schema-innodb-metrics-table.html" title="28.4.21 The INFORMATION_SCHEMA INNODB_METRICS Table">
<code class="literal">
INNODB_METRICS
</code>
</a>
table provides
information about
<code class="literal">
InnoDB
</code>
performance and
resource-related counters.
</p>
<p>
<a class="link" href="information-schema-innodb-metrics-table.html" title="28.4.21 The INFORMATION_SCHEMA INNODB_METRICS Table">
<code class="literal">
INNODB_METRICS
</code>
</a>
table columns are
shown below. For column descriptions, see
<a class="xref" href="information-schema-innodb-metrics-table.html" title="28.4.21 The INFORMATION_SCHEMA INNODB_METRICS Table">
Section 28.4.21, “The INFORMATION_SCHEMA INNODB_METRICS Table”
</a>
.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa80148274"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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_METRICS <span class="token keyword">WHERE</span> <span class="token keyword">NAME</span><span class="token operator">=</span><span class="token string">"dml_inserts"</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>
NAME<span class="token punctuation">:</span> dml_inserts
SUBSYSTEM<span class="token punctuation">:</span> dml
COUNT<span class="token punctuation">:</span> 46273
MAX_COUNT<span class="token punctuation">:</span> 46273
MIN_COUNT<span class="token punctuation">:</span> NULL
AVG_COUNT<span class="token punctuation">:</span> 492.2659574468085
COUNT_RESET<span class="token punctuation">:</span> 46273
MAX_COUNT_RESET<span class="token punctuation">:</span> 46273
MIN_COUNT_RESET<span class="token punctuation">:</span> NULL
AVG_COUNT_RESET<span class="token punctuation">:</span> NULL
TIME_ENABLED<span class="token punctuation">:</span> 2014-11-28 16<span class="token punctuation">:</span>07<span class="token punctuation">:</span>53
TIME_DISABLED<span class="token punctuation">:</span> NULL
TIME_ELAPSED<span class="token punctuation">:</span> 94
TIME_RESET<span class="token punctuation">:</span> NULL
STATUS<span class="token punctuation">:</span> enabled
TYPE<span class="token punctuation">:</span> status_counter
COMMENT<span class="token punctuation">:</span> Number of rows inserted</span></code></pre>
</div>
<h4>
<a name="idm46045149950272">
</a>
Enabling, Disabling, and Resetting Counters
</h4>
<p>
You can enable, disable, and reset counters using the following
variables:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a class="link" href="innodb-parameters.html#sysvar_innodb_monitor_enable">
<code class="literal">
innodb_monitor_enable
</code>
</a>
:
Enables counters.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa17101821"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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_monitor_enable <span class="token operator">=</span> <span class="token punctuation">[</span>counter<span class="token operator">-</span><span class="token keyword">name</span><span class="token operator">|</span>module_name<span class="token operator">|</span>pattern<span class="token operator">|</span><span class="token keyword">all</span><span class="token punctuation">]</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
<a class="link" href="innodb-parameters.html#sysvar_innodb_monitor_disable">
<code class="literal">
innodb_monitor_disable
</code>
</a>
:
Disables counters.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa87494770"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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_monitor_disable <span class="token operator">=</span> <span class="token punctuation">[</span>counter<span class="token operator">-</span><span class="token keyword">name</span><span class="token operator">|</span>module_name<span class="token operator">|</span>pattern<span class="token operator">|</span><span class="token keyword">all</span><span class="token punctuation">]</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
<a class="link" href="innodb-parameters.html#sysvar_innodb_monitor_reset">
<code class="literal">
innodb_monitor_reset
</code>
</a>
: Resets
counter values to zero.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa80747560"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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_monitor_reset <span class="token operator">=</span> <span class="token punctuation">[</span>counter<span class="token operator">-</span><span class="token keyword">name</span><span class="token operator">|</span>module_name<span class="token operator">|</span>pattern<span class="token operator">|</span><span class="token keyword">all</span><span class="token punctuation">]</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
<a class="link" href="innodb-parameters.html#sysvar_innodb_monitor_reset_all">
<code class="literal">
innodb_monitor_reset_all
</code>
</a>
:
Resets all counter values. A counter must be disabled before
using
<a class="link" href="innodb-parameters.html#sysvar_innodb_monitor_reset_all">
<code class="literal">
innodb_monitor_reset_all
</code>
</a>
.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa1003410"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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_monitor_reset_all <span class="token operator">=</span> <span class="token punctuation">[</span>counter<span class="token operator">-</span><span class="token keyword">name</span><span class="token operator">|</span>module_name<span class="token operator">|</span>pattern<span class="token operator">|</span><span class="token keyword">all</span><span class="token punctuation">]</span><span class="token punctuation">;</span></code></pre>
</div>
</li>
</ul>
</div>
<p>
Counters and counter modules can also be enabled at startup using
the MySQL server configuration file. For example, to enable the
<code class="literal">
log
</code>
module,
<code class="literal">
metadata_table_handles_opened
</code>
and
<code class="literal">
metadata_table_handles_closed
</code>
counters, enter
the following line in the
<code class="literal">
[mysqld]
</code>
section of
the MySQL server configuration file.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-ini"><div class="docs-select-all right" id="sa64800018"><div class="copy-help left">Press ⌘+C to 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_monitor_enable</span> <span class="token attr-value"><span class="token punctuation">=</span> log,metadata_table_handles_opened,metadata_table_handles_closed</span></code></pre>
</div>
<p>
When enabling multiple counters or modules in a configuration
file, specify the
<a class="link" href="innodb-parameters.html#sysvar_innodb_monitor_enable">
<code class="literal">
innodb_monitor_enable
</code>
</a>
variable
followed by counter and module names separated by a comma, as
shown above. Only the
<a class="link" href="innodb-parameters.html#sysvar_innodb_monitor_enable">
<code class="literal">
innodb_monitor_enable
</code>
</a>
variable
can be used in a configuration file. The
<a class="link" href="innodb-parameters.html#sysvar_innodb_monitor_disable">
<code class="literal">
innodb_monitor_disable
</code>
</a>
and
<a class="link" href="innodb-parameters.html#sysvar_innodb_monitor_reset">
<code class="literal">
innodb_monitor_reset
</code>
</a>
variables
are supported on the command line only.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
Because each counter adds a degree of runtime overhead, use
counters conservatively on production servers to diagnose
specific issues or monitor specific functionality. A test or
development server is recommended for more extensive use of
counters.
</p>
</div>
<h4>
<a name="idm46045149923760">
</a>
Counters
</h4>
<p>
The list of available counters is subject to change. Query the
Information Schema
<a class="link" href="information-schema-innodb-metrics-table.html" title="28.4.21 The INFORMATION_SCHEMA INNODB_METRICS Table">
<code class="literal">
INNODB_METRICS
</code>
</a>
table for counters available in your MySQL server version.
</p>
<p>
The counters enabled by default correspond to those shown in
<a class="link" href="show-engine.html" title="15.7.7.16 SHOW ENGINE Statement">
<code class="literal">
SHOW ENGINE INNODB
STATUS
</code>
</a>
output. Counters shown in
<a class="link" href="show-engine.html" title="15.7.7.16 SHOW ENGINE Statement">
<code class="literal">
SHOW ENGINE INNODB
STATUS
</code>
</a>
output are always enabled at a system level but
can be disabled for the
<a class="link" href="information-schema-innodb-metrics-table.html" title="28.4.21 The INFORMATION_SCHEMA INNODB_METRICS Table">
<code class="literal">
INNODB_METRICS
</code>
</a>
table. Counter status
is not persistent. Unless configured otherwise, counters revert to
their default enabled or disabled status when the server is
restarted.
</p>
<p>
If you run programs that would be affected by the addition or
removal of counters, it is recommended that you review the
releases notes and query the
<a class="link" href="information-schema-innodb-metrics-table.html" title="28.4.21 The INFORMATION_SCHEMA INNODB_METRICS Table">
<code class="literal">
INNODB_METRICS
</code>
</a>
table to identify
those changes as part of your upgrade process.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa91955213"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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> subsystem<span class="token punctuation">,</span> <span class="token keyword">status</span> <span class="token keyword">FROM</span> INFORMATION_SCHEMA<span class="token punctuation">.</span>INNODB_METRICS <span class="token keyword">ORDER</span> <span class="token keyword">BY</span> <span class="token keyword">NAME</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span 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> subsystem <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 class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> adaptive_hash_pages_added <span class="token punctuation">|</span> adaptive_hash_index <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> adaptive_hash_pages_removed <span class="token punctuation">|</span> adaptive_hash_index <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> adaptive_hash_rows_added <span class="token punctuation">|</span> adaptive_hash_index <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> adaptive_hash_rows_deleted_no_hash_entry <span class="token punctuation">|</span> adaptive_hash_index <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> adaptive_hash_rows_removed <span class="token punctuation">|</span> adaptive_hash_index <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> adaptive_hash_rows_updated <span class="token punctuation">|</span> adaptive_hash_index <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> adaptive_hash_searches <span class="token punctuation">|</span> adaptive_hash_index <span class="token punctuation">|</span> enabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> adaptive_hash_searches_btree <span class="token punctuation">|</span> adaptive_hash_index <span class="token punctuation">|</span> enabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_data_reads <span class="token punctuation">|</span> buffer <span class="token punctuation">|</span> enabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_data_written <span class="token punctuation">|</span> buffer <span class="token punctuation">|</span> enabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_flush_adaptive <span class="token punctuation">|</span> buffer <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_flush_adaptive_avg_pass <span class="token punctuation">|</span> buffer <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_flush_adaptive_avg_time_est <span class="token punctuation">|</span> buffer <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_flush_adaptive_avg_time_slot <span class="token punctuation">|</span> buffer <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_flush_adaptive_avg_time_thread <span class="token punctuation">|</span> buffer <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_flush_adaptive_pages <span class="token punctuation">|</span> buffer <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_flush_adaptive_total_pages <span class="token punctuation">|</span> buffer <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_flush_avg_page_rate <span class="token punctuation">|</span> buffer <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_flush_avg_pass <span class="token punctuation">|</span> buffer <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_flush_avg_time <span class="token punctuation">|</span> buffer <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_flush_background <span class="token punctuation">|</span> buffer <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_flush_background_pages <span class="token punctuation">|</span> buffer <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_flush_background_total_pages <span class="token punctuation">|</span> buffer <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_flush_batches <span class="token punctuation">|</span> buffer <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_flush_batch_num_scan <span class="token punctuation">|</span> buffer <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_flush_batch_pages <span class="token punctuation">|</span> buffer <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_flush_batch_scanned <span class="token punctuation">|</span> buffer <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_flush_batch_scanned_per_call <span class="token punctuation">|</span> buffer <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_flush_batch_total_pages <span class="token punctuation">|</span> buffer <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_flush_lsn_avg_rate <span class="token punctuation">|</span> buffer <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_flush_neighbor <span class="token punctuation">|</span> buffer <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_flush_neighbor_pages <span class="token punctuation">|</span> buffer <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_flush_neighbor_total_pages <span class="token punctuation">|</span> buffer <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_flush_n_to_flush_by_age <span class="token punctuation">|</span> buffer <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_flush_n_to_flush_by_dirty_page <span class="token punctuation">|</span> buffer <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_flush_n_to_flush_requested <span class="token punctuation">|</span> buffer <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_flush_pct_for_dirty <span class="token punctuation">|</span> buffer <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_flush_pct_for_lsn <span class="token punctuation">|</span> buffer <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_flush_sync <span class="token punctuation">|</span> buffer <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_flush_sync_pages <span class="token punctuation">|</span> buffer <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_flush_sync_total_pages <span class="token punctuation">|</span> buffer <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_flush_sync_waits <span class="token punctuation">|</span> buffer <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_LRU_batches_evict <span class="token punctuation">|</span> buffer <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_LRU_batches_flush <span class="token punctuation">|</span> buffer <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_LRU_batch_evict_pages <span class="token punctuation">|</span> buffer <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_LRU_batch_evict_total_pages <span class="token punctuation">|</span> buffer <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_LRU_batch_flush_avg_pass <span class="token punctuation">|</span> buffer <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_LRU_batch_flush_avg_time_est <span class="token punctuation">|</span> buffer <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_LRU_batch_flush_avg_time_slot <span class="token punctuation">|</span> buffer <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_LRU_batch_flush_avg_time_thread <span class="token punctuation">|</span> buffer <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_LRU_batch_flush_pages <span class="token punctuation">|</span> buffer <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_LRU_batch_flush_total_pages <span class="token punctuation">|</span> buffer <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_LRU_batch_num_scan <span class="token punctuation">|</span> buffer <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_LRU_batch_scanned <span class="token punctuation">|</span> buffer <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_LRU_batch_scanned_per_call <span class="token punctuation">|</span> buffer <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_LRU_get_free_loops <span class="token punctuation">|</span> buffer <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_LRU_get_free_search <span class="token punctuation">|</span> Buffer <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_LRU_get_free_waits <span class="token punctuation">|</span> buffer <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_LRU_search_num_scan <span class="token punctuation">|</span> buffer <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_LRU_search_scanned <span class="token punctuation">|</span> buffer <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_LRU_search_scanned_per_call <span class="token punctuation">|</span> buffer <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_LRU_single_flush_failure_count <span class="token punctuation">|</span> Buffer <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_LRU_single_flush_num_scan <span class="token punctuation">|</span> buffer <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_LRU_single_flush_scanned <span class="token punctuation">|</span> buffer <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_LRU_single_flush_scanned_per_call <span class="token punctuation">|</span> buffer <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_LRU_unzip_search_num_scan <span class="token punctuation">|</span> buffer <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_LRU_unzip_search_scanned <span class="token punctuation">|</span> buffer <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_LRU_unzip_search_scanned_per_call <span class="token punctuation">|</span> buffer <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_pages_created <span class="token punctuation">|</span> buffer <span class="token punctuation">|</span> enabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_pages_read <span class="token punctuation">|</span> buffer <span class="token punctuation">|</span> enabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_pages_written <span class="token punctuation">|</span> buffer <span class="token punctuation">|</span> enabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_page_read_blob <span class="token punctuation">|</span> buffer_page_io <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_page_read_fsp_hdr <span class="token punctuation">|</span> buffer_page_io <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_page_read_ibuf_bitmap <span class="token punctuation">|</span> buffer_page_io <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_page_read_ibuf_free_list <span class="token punctuation">|</span> buffer_page_io <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_page_read_index_ibuf_leaf <span class="token punctuation">|</span> buffer_page_io <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_page_read_index_ibuf_non_leaf <span class="token punctuation">|</span> buffer_page_io <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_page_read_index_inode <span class="token punctuation">|</span> buffer_page_io <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_page_read_index_leaf <span class="token punctuation">|</span> buffer_page_io <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_page_read_index_non_leaf <span class="token punctuation">|</span> buffer_page_io <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_page_read_other <span class="token punctuation">|</span> buffer_page_io <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_page_read_rseg_array <span class="token punctuation">|</span> buffer_page_io <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_page_read_system_page <span class="token punctuation">|</span> buffer_page_io <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_page_read_trx_system <span class="token punctuation">|</span> buffer_page_io <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_page_read_undo_log <span class="token punctuation">|</span> buffer_page_io <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_page_read_xdes <span class="token punctuation">|</span> buffer_page_io <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_page_read_zblob <span class="token punctuation">|</span> buffer_page_io <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_page_read_zblob2 <span class="token punctuation">|</span> buffer_page_io <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_page_written_blob <span class="token punctuation">|</span> buffer_page_io <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_page_written_fsp_hdr <span class="token punctuation">|</span> buffer_page_io <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_page_written_ibuf_bitmap <span class="token punctuation">|</span> buffer_page_io <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_page_written_ibuf_free_list <span class="token punctuation">|</span> buffer_page_io <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_page_written_index_ibuf_leaf <span class="token punctuation">|</span> buffer_page_io <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_page_written_index_ibuf_non_leaf <span class="token punctuation">|</span> buffer_page_io <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_page_written_index_inode <span class="token punctuation">|</span> buffer_page_io <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_page_written_index_leaf <span class="token punctuation">|</span> buffer_page_io <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_page_written_index_non_leaf <span class="token punctuation">|</span> buffer_page_io <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_page_written_on_log_no_waits <span class="token punctuation">|</span> buffer_page_io <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_page_written_on_log_waits <span class="token punctuation">|</span> buffer_page_io <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_page_written_on_log_wait_loops <span class="token punctuation">|</span> buffer_page_io <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_page_written_other <span class="token punctuation">|</span> buffer_page_io <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_page_written_rseg_array <span class="token punctuation">|</span> buffer_page_io <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_page_written_system_page <span class="token punctuation">|</span> buffer_page_io <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_page_written_trx_system <span class="token punctuation">|</span> buffer_page_io <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_page_written_undo_log <span class="token punctuation">|</span> buffer_page_io <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_page_written_xdes <span class="token punctuation">|</span> buffer_page_io <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_page_written_zblob <span class="token punctuation">|</span> buffer_page_io <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_page_written_zblob2 <span class="token punctuation">|</span> buffer_page_io <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_pool_bytes_data <span class="token punctuation">|</span> buffer <span class="token punctuation">|</span> enabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_pool_bytes_dirty <span class="token punctuation">|</span> buffer <span class="token punctuation">|</span> enabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_pool_pages_data <span class="token punctuation">|</span> buffer <span class="token punctuation">|</span> enabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_pool_pages_dirty <span class="token punctuation">|</span> buffer <span class="token punctuation">|</span> enabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_pool_pages_free <span class="token punctuation">|</span> buffer <span class="token punctuation">|</span> enabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_pool_pages_misc <span class="token punctuation">|</span> buffer <span class="token punctuation">|</span> enabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_pool_pages_total <span class="token punctuation">|</span> buffer <span class="token punctuation">|</span> enabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_pool_reads <span class="token punctuation">|</span> buffer <span class="token punctuation">|</span> enabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_pool_read_ahead <span class="token punctuation">|</span> buffer <span class="token punctuation">|</span> enabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_pool_read_ahead_evicted <span class="token punctuation">|</span> buffer <span class="token punctuation">|</span> enabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_pool_read_requests <span class="token punctuation">|</span> buffer <span class="token punctuation">|</span> enabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_pool_size <span class="token punctuation">|</span> server <span class="token punctuation">|</span> enabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_pool_wait_free <span class="token punctuation">|</span> buffer <span class="token punctuation">|</span> enabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> buffer_pool_write_requests <span class="token punctuation">|</span> buffer <span class="token punctuation">|</span> enabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> compression_pad_decrements <span class="token punctuation">|</span> compression <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> compression_pad_increments <span class="token punctuation">|</span> compression <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> compress_pages_compressed <span class="token punctuation">|</span> compression <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> compress_pages_decompressed <span class="token punctuation">|</span> compression <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> cpu_n <span class="token punctuation">|</span> cpu <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> cpu_stime_abs <span class="token punctuation">|</span> cpu <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> cpu_stime_pct <span class="token punctuation">|</span> cpu <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> cpu_utime_abs <span class="token punctuation">|</span> cpu <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> cpu_utime_pct <span class="token punctuation">|</span> cpu <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> dblwr_async_requests <span class="token punctuation">|</span> dblwr <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> dblwr_flush_requests <span class="token punctuation">|</span> dblwr <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> dblwr_flush_wait_events <span class="token punctuation">|</span> dblwr <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> dblwr_sync_requests <span class="token punctuation">|</span> dblwr <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> ddl_background_drop_tables <span class="token punctuation">|</span> ddl <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> ddl_log_file_alter_table <span class="token punctuation">|</span> ddl <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> ddl_online_create_index <span class="token punctuation">|</span> ddl <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> ddl_pending_alter_table <span class="token punctuation">|</span> ddl <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> ddl_sort_file_alter_table <span class="token punctuation">|</span> ddl <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> dml_deletes <span class="token punctuation">|</span> dml <span class="token punctuation">|</span> enabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> dml_inserts <span class="token punctuation">|</span> dml <span class="token punctuation">|</span> enabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> dml_reads <span class="token punctuation">|</span> dml <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> dml_system_deletes <span class="token punctuation">|</span> dml <span class="token punctuation">|</span> enabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> dml_system_inserts <span class="token punctuation">|</span> dml <span class="token punctuation">|</span> enabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> dml_system_reads <span class="token punctuation">|</span> dml <span class="token punctuation">|</span> enabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> dml_system_updates <span class="token punctuation">|</span> dml <span class="token punctuation">|</span> enabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> dml_updates <span class="token punctuation">|</span> dml <span class="token punctuation">|</span> enabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> file_num_open_files <span class="token punctuation">|</span> file_system <span class="token punctuation">|</span> enabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> ibuf_merges <span class="token punctuation">|</span> change_buffer <span class="token punctuation">|</span> enabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> ibuf_merges_delete <span class="token punctuation">|</span> change_buffer <span class="token punctuation">|</span> enabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> ibuf_merges_delete_mark <span class="token punctuation">|</span> change_buffer <span class="token punctuation">|</span> enabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> ibuf_merges_discard_delete <span class="token punctuation">|</span> change_buffer <span class="token punctuation">|</span> enabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> ibuf_merges_discard_delete_mark <span class="token punctuation">|</span> change_buffer <span class="token punctuation">|</span> enabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> ibuf_merges_discard_insert <span class="token punctuation">|</span> change_buffer <span class="token punctuation">|</span> enabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> ibuf_merges_insert <span class="token punctuation">|</span> change_buffer <span class="token punctuation">|</span> enabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> ibuf_size <span class="token punctuation">|</span> change_buffer <span class="token punctuation">|</span> enabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> icp_attempts <span class="token punctuation">|</span> icp <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> icp_match <span class="token punctuation">|</span> icp <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> icp_no_match <span class="token punctuation">|</span> icp <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> icp_out_of_range <span class="token punctuation">|</span> icp <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> index_page_discards <span class="token punctuation">|</span> index <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> index_page_merge_attempts <span class="token punctuation">|</span> index <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> index_page_merge_successful <span class="token punctuation">|</span> index <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> index_page_reorg_attempts <span class="token punctuation">|</span> index <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> index_page_reorg_successful <span class="token punctuation">|</span> index <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> index_page_splits <span class="token punctuation">|</span> index <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> innodb_activity_count <span class="token punctuation">|</span> server <span class="token punctuation">|</span> enabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> innodb_background_drop_table_usec <span class="token punctuation">|</span> server <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> innodb_dblwr_pages_written <span class="token punctuation">|</span> server <span class="token punctuation">|</span> enabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> innodb_dblwr_writes <span class="token punctuation">|</span> server <span class="token punctuation">|</span> enabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> innodb_dict_lru_count <span class="token punctuation">|</span> server <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> innodb_dict_lru_usec <span class="token punctuation">|</span> server <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> innodb_ibuf_merge_usec <span class="token punctuation">|</span> server <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> innodb_master_active_loops <span class="token punctuation">|</span> server <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> innodb_master_idle_loops <span class="token punctuation">|</span> server <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> innodb_master_purge_usec <span class="token punctuation">|</span> server <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> innodb_master_thread_sleeps <span class="token punctuation">|</span> server <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> innodb_mem_validate_usec <span class="token punctuation">|</span> server <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> innodb_page_size <span class="token punctuation">|</span> server <span class="token punctuation">|</span> enabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> innodb_rwlock_sx_os_waits <span class="token punctuation">|</span> server <span class="token punctuation">|</span> enabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> innodb_rwlock_sx_spin_rounds <span class="token punctuation">|</span> server <span class="token punctuation">|</span> enabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> innodb_rwlock_sx_spin_waits <span class="token punctuation">|</span> server <span class="token punctuation">|</span> enabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> innodb_rwlock_s_os_waits <span class="token punctuation">|</span> server <span class="token punctuation">|</span> enabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> innodb_rwlock_s_spin_rounds <span class="token punctuation">|</span> server <span class="token punctuation">|</span> enabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> innodb_rwlock_s_spin_waits <span class="token punctuation">|</span> server <span class="token punctuation">|</span> enabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> innodb_rwlock_x_os_waits <span class="token punctuation">|</span> server <span class="token punctuation">|</span> enabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> innodb_rwlock_x_spin_rounds <span class="token punctuation">|</span> server <span class="token punctuation">|</span> enabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> innodb_rwlock_x_spin_waits <span class="token punctuation">|</span> server <span class="token punctuation">|</span> enabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> lock_deadlocks <span class="token punctuation">|</span> lock <span class="token punctuation">|</span> enabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> lock_deadlock_false_positives <span class="token punctuation">|</span> lock <span class="token punctuation">|</span> enabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> lock_deadlock_rounds <span class="token punctuation">|</span> lock <span class="token punctuation">|</span> enabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> lock_rec_grant_attempts <span class="token punctuation">|</span> lock <span class="token punctuation">|</span> enabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> lock_rec_locks <span class="token punctuation">|</span> lock <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> lock_rec_lock_created <span class="token punctuation">|</span> lock <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> lock_rec_lock_removed <span class="token punctuation">|</span> lock <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> lock_rec_lock_requests <span class="token punctuation">|</span> lock <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> lock_rec_lock_waits <span class="token punctuation">|</span> lock <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> lock_rec_release_attempts <span class="token punctuation">|</span> lock <span class="token punctuation">|</span> enabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> lock_row_lock_current_waits <span class="token punctuation">|</span> lock <span class="token punctuation">|</span> enabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> lock_row_lock_time <span class="token punctuation">|</span> lock <span class="token punctuation">|</span> enabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> lock_row_lock_time_avg <span class="token punctuation">|</span> lock <span class="token punctuation">|</span> enabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> lock_row_lock_time_max <span class="token punctuation">|</span> lock <span class="token punctuation">|</span> enabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> lock_row_lock_waits <span class="token punctuation">|</span> lock <span class="token punctuation">|</span> enabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> lock_schedule_refreshes <span class="token punctuation">|</span> lock <span class="token punctuation">|</span> enabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> lock_table_locks <span class="token punctuation">|</span> lock <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> lock_table_lock_created <span class="token punctuation">|</span> lock <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> lock_table_lock_removed <span class="token punctuation">|</span> lock <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> lock_table_lock_waits <span class="token punctuation">|</span> lock <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> lock_threads_waiting <span class="token punctuation">|</span> lock <span class="token punctuation">|</span> enabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> lock_timeouts <span class="token punctuation">|</span> lock <span class="token punctuation">|</span> enabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> log_checkpoints <span class="token punctuation">|</span> log <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> log_concurrency_margin <span class="token punctuation">|</span> log <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> log_flusher_no_waits <span class="token punctuation">|</span> log <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> log_flusher_waits <span class="token punctuation">|</span> log <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> log_flusher_wait_loops <span class="token punctuation">|</span> log <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> log_flush_avg_time <span class="token punctuation">|</span> log <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> log_flush_lsn_avg_rate <span class="token punctuation">|</span> log <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> log_flush_max_time <span class="token punctuation">|</span> log <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> log_flush_notifier_no_waits <span class="token punctuation">|</span> log <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> log_flush_notifier_waits <span class="token punctuation">|</span> log <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> log_flush_notifier_wait_loops <span class="token punctuation">|</span> log <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> log_flush_total_time <span class="token punctuation">|</span> log <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> log_free_space <span class="token punctuation">|</span> log <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> log_full_block_writes <span class="token punctuation">|</span> log <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> log_lsn_archived <span class="token punctuation">|</span> log <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> log_lsn_buf_dirty_pages_added <span class="token punctuation">|</span> log <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> log_lsn_buf_pool_oldest_approx <span class="token punctuation">|</span> log <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> log_lsn_buf_pool_oldest_lwm <span class="token punctuation">|</span> log <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> log_lsn_checkpoint_age <span class="token punctuation">|</span> log <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> log_lsn_current <span class="token punctuation">|</span> log <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> log_lsn_last_checkpoint <span class="token punctuation">|</span> log <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> log_lsn_last_flush <span class="token punctuation">|</span> log <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> log_max_modified_age_async <span class="token punctuation">|</span> log <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> log_max_modified_age_sync <span class="token punctuation">|</span> log <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> log_next_file <span class="token punctuation">|</span> log <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> log_on_buffer_space_no_waits <span class="token punctuation">|</span> log <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> log_on_buffer_space_waits <span class="token punctuation">|</span> log <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> log_on_buffer_space_wait_loops <span class="token punctuation">|</span> log <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> log_on_file_space_no_waits <span class="token punctuation">|</span> log <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> log_on_file_space_waits <span class="token punctuation">|</span> log <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> log_on_file_space_wait_loops <span class="token punctuation">|</span> log <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> log_on_flush_no_waits <span class="token punctuation">|</span> log <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> log_on_flush_waits <span class="token punctuation">|</span> log <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> log_on_flush_wait_loops <span class="token punctuation">|</span> log <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> log_on_recent_closed_wait_loops <span class="token punctuation">|</span> log <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> log_on_recent_written_wait_loops <span class="token punctuation">|</span> log <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> log_on_write_no_waits <span class="token punctuation">|</span> log <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> log_on_write_waits <span class="token punctuation">|</span> log <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> log_on_write_wait_loops <span class="token punctuation">|</span> log <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> log_padded <span class="token punctuation">|</span> log <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> log_partial_block_writes <span class="token punctuation">|</span> log <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> log_waits <span class="token punctuation">|</span> log <span class="token punctuation">|</span> enabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> log_writer_no_waits <span class="token punctuation">|</span> log <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> log_writer_on_archiver_waits <span class="token punctuation">|</span> log <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> log_writer_on_file_space_waits <span class="token punctuation">|</span> log <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> log_writer_waits <span class="token punctuation">|</span> log <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> log_writer_wait_loops <span class="token punctuation">|</span> log <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> log_writes <span class="token punctuation">|</span> log <span class="token punctuation">|</span> enabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> log_write_notifier_no_waits <span class="token punctuation">|</span> log <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> log_write_notifier_waits <span class="token punctuation">|</span> log <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> log_write_notifier_wait_loops <span class="token punctuation">|</span> log <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> log_write_requests <span class="token punctuation">|</span> log <span class="token punctuation">|</span> enabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> log_write_to_file_requests_interval <span class="token punctuation">|</span> log <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> metadata_table_handles_closed <span class="token punctuation">|</span> metadata <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> metadata_table_handles_opened <span class="token punctuation">|</span> metadata <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> metadata_table_reference_count <span class="token punctuation">|</span> metadata <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> module_cpu <span class="token punctuation">|</span> cpu <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> module_dblwr <span class="token punctuation">|</span> dblwr <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> module_page_track <span class="token punctuation">|</span> page_track <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> os_data_fsyncs <span class="token punctuation">|</span> os <span class="token punctuation">|</span> enabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> os_data_reads <span class="token punctuation">|</span> os <span class="token punctuation">|</span> enabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> os_data_writes <span class="token punctuation">|</span> os <span class="token punctuation">|</span> enabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> os_log_bytes_written <span class="token punctuation">|</span> os <span class="token punctuation">|</span> enabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> os_log_fsyncs <span class="token punctuation">|</span> os <span class="token punctuation">|</span> enabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> os_log_pending_fsyncs <span class="token punctuation">|</span> os <span class="token punctuation">|</span> enabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> os_log_pending_writes <span class="token punctuation">|</span> os <span class="token punctuation">|</span> enabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> os_pending_reads <span class="token punctuation">|</span> os <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> os_pending_writes <span class="token punctuation">|</span> os <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> page_track_checkpoint_partial_flush_request <span class="token punctuation">|</span> page_track <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> page_track_full_block_writes <span class="token punctuation">|</span> page_track <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> page_track_partial_block_writes <span class="token punctuation">|</span> page_track <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> page_track_resets <span class="token punctuation">|</span> page_track <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> purge_del_mark_records <span class="token punctuation">|</span> purge <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> purge_dml_delay_usec <span class="token punctuation">|</span> purge <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> purge_invoked <span class="token punctuation">|</span> purge <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> purge_resume_count <span class="token punctuation">|</span> purge <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> purge_stop_count <span class="token punctuation">|</span> purge <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> purge_truncate_history_count <span class="token punctuation">|</span> purge <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> purge_truncate_history_usec <span class="token punctuation">|</span> purge <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> purge_undo_log_pages <span class="token punctuation">|</span> purge <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> purge_upd_exist_or_extern_records <span class="token punctuation">|</span> purge <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> sampled_pages_read <span class="token punctuation">|</span> sampling <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> sampled_pages_skipped <span class="token punctuation">|</span> sampling <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> trx_active_transactions <span class="token punctuation">|</span> transaction <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> trx_allocations <span class="token punctuation">|</span> transaction <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> trx_commits_insert_update <span class="token punctuation">|</span> transaction <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> trx_nl_ro_commits <span class="token punctuation">|</span> transaction <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> trx_on_log_no_waits <span class="token punctuation">|</span> transaction <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> trx_on_log_waits <span class="token punctuation">|</span> transaction <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> trx_on_log_wait_loops <span class="token punctuation">|</span> transaction <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> trx_rollbacks <span class="token punctuation">|</span> transaction <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> trx_rollbacks_savepoint <span class="token punctuation">|</span> transaction <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> trx_rollback_active <span class="token punctuation">|</span> transaction <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> trx_ro_commits <span class="token punctuation">|</span> transaction <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> trx_rseg_current_size <span class="token punctuation">|</span> transaction <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> trx_rseg_history_len <span class="token punctuation">|</span> transaction <span class="token punctuation">|</span> enabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> trx_rw_commits <span class="token punctuation">|</span> transaction <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> trx_undo_slots_cached <span class="token punctuation">|</span> transaction <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> trx_undo_slots_used <span class="token punctuation">|</span> transaction <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> undo_truncate_count <span class="token punctuation">|</span> undo <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> undo_truncate_done_logging_count <span class="token punctuation">|</span> undo <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> undo_truncate_start_logging_count <span class="token punctuation">|</span> undo <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> undo_truncate_usec <span class="token punctuation">|</span> undo <span class="token punctuation">|</span> disabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output">314 rows in set (0.00 sec)</span></code></pre>
</div>
<h4>
<a name="idm46045149884192">
</a>
Counter Modules
</h4>
<p>
Each counter is associated with a particular module. Module names
can be used to enable, disable, or reset all counters for a
particular subsystem. For example, use
<code class="literal">
module_dml
</code>
to enable all counters associated
with the
<code class="literal">
dml
</code>
subsystem.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa30337191"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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_monitor_enable <span class="token operator">=</span> module_dml<span class="token punctuation">;</span>
<span class="token prompt">mysql></span> <span class="token keyword">SELECT</span> <span class="token keyword">name</span><span class="token punctuation">,</span> subsystem<span class="token punctuation">,</span> <span class="token keyword">status</span> <span class="token keyword">FROM</span> INFORMATION_SCHEMA<span class="token punctuation">.</span>INNODB_METRICS
<span class="token keyword">WHERE</span> subsystem <span class="token operator">=</span><span class="token string">'dml'</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> name <span class="token punctuation">|</span> subsystem <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>
<span class="token output"><span class="token punctuation">|</span> dml_reads <span class="token punctuation">|</span> dml <span class="token punctuation">|</span> enabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> dml_inserts <span class="token punctuation">|</span> dml <span class="token punctuation">|</span> enabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> dml_deletes <span class="token punctuation">|</span> dml <span class="token punctuation">|</span> enabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> dml_updates <span class="token punctuation">|</span> dml <span class="token punctuation">|</span> enabled <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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>
Module names can be used with
<a class="link" href="innodb-parameters.html#sysvar_innodb_monitor_enable">
<code class="literal">
innodb_monitor_enable
</code>
</a>
and related
variables.
</p>
<p>
Module names and corresponding
<code class="literal">
SUBSYSTEM
</code>
names
are listed below.
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<code class="literal">
module_adaptive_hash
</code>
(subsystem =
<code class="literal">
adaptive_hash_index
</code>
)
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
module_buffer
</code>
(subsystem =
<code class="literal">
buffer
</code>
)
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
module_buffer_page
</code>
(subsystem =
<code class="literal">
buffer_page_io
</code>
)
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
module_compress
</code>
(subsystem =
<code class="literal">
compression
</code>
)
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
module_ddl
</code>
(subsystem =
<code class="literal">
ddl
</code>
)
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
module_dml
</code>
(subsystem =
<code class="literal">
dml
</code>
)
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
module_file
</code>
(subsystem =
<code class="literal">
file_system
</code>
)
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
module_ibuf_system
</code>
(subsystem =
<code class="literal">
change_buffer
</code>
)
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
module_icp
</code>
(subsystem =
<code class="literal">
icp
</code>
)
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
module_index
</code>
(subsystem =
<code class="literal">
index
</code>
)
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
module_innodb
</code>
(subsystem =
<code class="literal">
innodb
</code>
)
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
module_lock
</code>
(subsystem =
<code class="literal">
lock
</code>
)
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
module_log
</code>
(subsystem =
<code class="literal">
log
</code>
)
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
module_metadata
</code>
(subsystem =
<code class="literal">
metadata
</code>
)
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
module_os
</code>
(subsystem =
<code class="literal">
os
</code>
)
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
module_purge
</code>
(subsystem =
<code class="literal">
purge
</code>
)
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
module_trx
</code>
(subsystem =
<code class="literal">
transaction
</code>
)
</p>
</li>
<li class="listitem">
<p>
<code class="literal">
module_undo
</code>
(subsystem =
<code class="literal">
undo
</code>
)
</p>
</li>
</ul>
</div>
<div class="example">
<a name="innodb-information-schema-metrics-table-example">
</a>
<p class="title">
<b>
Example 17.11 Working with INNODB_METRICS Table Counters
</b>
</p>
<div class="example-contents">
<p>
This example demonstrates enabling, disabling, and resetting a
counter, and querying counter data in the
<a class="link" href="information-schema-innodb-metrics-table.html" title="28.4.21 The INFORMATION_SCHEMA INNODB_METRICS Table">
<code class="literal">
INNODB_METRICS
</code>
</a>
table.
</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>
Create a simple
<code class="literal">
InnoDB
</code>
table:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa94391970"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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 punctuation">)</span> <span class="token keyword">ENGINE</span><span class="token operator">=</span>INNODB<span class="token punctuation">;</span>
<span class="token output">Query OK, 0 rows affected (0.02 sec)</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
Enable the
<code class="literal">
dml_inserts
</code>
counter.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa3611800"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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_monitor_enable <span class="token operator">=</span> dml_inserts<span class="token punctuation">;</span>
<span class="token output">Query OK, 0 rows affected (0.01 sec)</span></code></pre>
</div>
<p>
A description of the
<code class="literal">
dml_inserts
</code>
counter
can be found in the
<code class="literal">
COMMENT
</code>
column of the
<code class="literal">
INNODB_METRICS
</code>
table:
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa46185012"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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">COMMENT</span> <span class="token keyword">FROM</span> INFORMATION_SCHEMA<span class="token punctuation">.</span>INNODB_METRICS <span class="token keyword">WHERE</span> <span class="token keyword">NAME</span><span class="token operator">=</span><span class="token string">"dml_inserts"</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> NAME <span class="token punctuation">|</span> COMMENT <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> dml_inserts <span class="token punctuation">|</span> Number of rows inserted <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
</div>
</li>
<li class="listitem">
<p>
Query the
<a class="link" href="information-schema-innodb-metrics-table.html" title="28.4.21 The INFORMATION_SCHEMA INNODB_METRICS Table">
<code class="literal">
INNODB_METRICS
</code>
</a>
table
for the
<code class="literal">
dml_inserts
</code>
counter data. Because
no DML operations have been performed, the counter values
are zero or NULL. The
<code class="literal">
TIME_ENABLED
</code>
and
<code class="literal">
TIME_ELAPSED
</code>
values indicate when the
counter was last enabled and how many seconds have elapsed
since that time.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa84259900"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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_METRICS <span class="token keyword">WHERE</span> <span class="token keyword">NAME</span><span class="token operator">=</span><span class="token string">"dml_inserts"</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>
NAME<span class="token punctuation">:</span> dml_inserts
SUBSYSTEM<span class="token punctuation">:</span> dml
COUNT<span class="token punctuation">:</span> 0
MAX_COUNT<span class="token punctuation">:</span> 0
MIN_COUNT<span class="token punctuation">:</span> NULL
AVG_COUNT<span class="token punctuation">:</span> 0
COUNT_RESET<span class="token punctuation">:</span> 0
MAX_COUNT_RESET<span class="token punctuation">:</span> 0
MIN_COUNT_RESET<span class="token punctuation">:</span> NULL
AVG_COUNT_RESET<span class="token punctuation">:</span> NULL
TIME_ENABLED<span class="token punctuation">:</span> 2014-12-04 14<span class="token punctuation">:</span>18<span class="token punctuation">:</span>28
TIME_DISABLED<span class="token punctuation">:</span> NULL
TIME_ELAPSED<span class="token punctuation">:</span> 28
TIME_RESET<span class="token punctuation">:</span> NULL
STATUS<span class="token punctuation">:</span> enabled
TYPE<span class="token punctuation">:</span> status_counter
COMMENT<span class="token punctuation">:</span> Number of rows inserted</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
Insert three rows of data into the table.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa20749815"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql></span> <span class="token keyword">INSERT</span> <span class="token keyword">INTO</span> t1 <span class="token keyword">values</span><span class="token punctuation">(</span><span class="token number">1</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 1 row affected (0.00 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">INSERT</span> <span class="token keyword">INTO</span> t1 <span class="token keyword">values</span><span class="token punctuation">(</span><span class="token number">2</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 1 row affected (0.00 sec)</span>
<span class="token prompt">mysql></span> <span class="token keyword">INSERT</span> <span class="token keyword">INTO</span> t1 <span class="token keyword">values</span><span class="token punctuation">(</span><span class="token number">3</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 1 row affected (0.00 sec)</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
Query the
<a class="link" href="information-schema-innodb-metrics-table.html" title="28.4.21 The INFORMATION_SCHEMA INNODB_METRICS Table">
<code class="literal">
INNODB_METRICS
</code>
</a>
table
again for the
<code class="literal">
dml_inserts
</code>
counter data. A
number of counter values have now incremented including
<code class="literal">
COUNT
</code>
,
<code class="literal">
MAX_COUNT
</code>
,
<code class="literal">
AVG_COUNT
</code>
, and
<code class="literal">
COUNT_RESET
</code>
. Refer to the
<a class="link" href="information-schema-innodb-metrics-table.html" title="28.4.21 The INFORMATION_SCHEMA INNODB_METRICS Table">
<code class="literal">
INNODB_METRICS
</code>
</a>
table definition
for descriptions of these values.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa43876000"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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_METRICS <span class="token keyword">WHERE</span> <span class="token keyword">NAME</span><span class="token operator">=</span><span class="token string">"dml_inserts"</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>
NAME<span class="token punctuation">:</span> dml_inserts
SUBSYSTEM<span class="token punctuation">:</span> dml
COUNT<span class="token punctuation">:</span> 3
MAX_COUNT<span class="token punctuation">:</span> 3
MIN_COUNT<span class="token punctuation">:</span> NULL
AVG_COUNT<span class="token punctuation">:</span> 0.046153846153846156
COUNT_RESET<span class="token punctuation">:</span> 3
MAX_COUNT_RESET<span class="token punctuation">:</span> 3
MIN_COUNT_RESET<span class="token punctuation">:</span> NULL
AVG_COUNT_RESET<span class="token punctuation">:</span> NULL
TIME_ENABLED<span class="token punctuation">:</span> 2014-12-04 14<span class="token punctuation">:</span>18<span class="token punctuation">:</span>28
TIME_DISABLED<span class="token punctuation">:</span> NULL
TIME_ELAPSED<span class="token punctuation">:</span> 65
TIME_RESET<span class="token punctuation">:</span> NULL
STATUS<span class="token punctuation">:</span> enabled
TYPE<span class="token punctuation">:</span> status_counter
COMMENT<span class="token punctuation">:</span> Number of rows inserted</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
Reset the
<code class="literal">
dml_inserts
</code>
counter and query
the
<a class="link" href="information-schema-innodb-metrics-table.html" title="28.4.21 The INFORMATION_SCHEMA INNODB_METRICS Table">
<code class="literal">
INNODB_METRICS
</code>
</a>
table again
for the
<code class="literal">
dml_inserts
</code>
counter data. The
<code class="literal">
%_RESET
</code>
values that were reported
previously, such as
<code class="literal">
COUNT_RESET
</code>
and
<code class="literal">
MAX_RESET
</code>
, are set back to zero. Values
such as
<code class="literal">
COUNT
</code>
,
<code class="literal">
MAX_COUNT
</code>
, and
<code class="literal">
AVG_COUNT
</code>
, which cumulatively collect
data from the time the counter is enabled, are unaffected by
the reset.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa24772519"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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_monitor_reset <span class="token operator">=</span> dml_inserts<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 operator">*</span> <span class="token keyword">FROM</span> INFORMATION_SCHEMA<span class="token punctuation">.</span>INNODB_METRICS <span class="token keyword">WHERE</span> <span class="token keyword">NAME</span><span class="token operator">=</span><span class="token string">"dml_inserts"</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>
NAME<span class="token punctuation">:</span> dml_inserts
SUBSYSTEM<span class="token punctuation">:</span> dml
COUNT<span class="token punctuation">:</span> 3
MAX_COUNT<span class="token punctuation">:</span> 3
MIN_COUNT<span class="token punctuation">:</span> NULL
AVG_COUNT<span class="token punctuation">:</span> 0.03529411764705882
COUNT_RESET<span class="token punctuation">:</span> 0
MAX_COUNT_RESET<span class="token punctuation">:</span> 0
MIN_COUNT_RESET<span class="token punctuation">:</span> NULL
AVG_COUNT_RESET<span class="token punctuation">:</span> 0
TIME_ENABLED<span class="token punctuation">:</span> 2014-12-04 14<span class="token punctuation">:</span>18<span class="token punctuation">:</span>28
TIME_DISABLED<span class="token punctuation">:</span> NULL
TIME_ELAPSED<span class="token punctuation">:</span> 85
TIME_RESET<span class="token punctuation">:</span> 2014-12-04 14<span class="token punctuation">:</span>19<span class="token punctuation">:</span>44
STATUS<span class="token punctuation">:</span> enabled
TYPE<span class="token punctuation">:</span> status_counter
COMMENT<span class="token punctuation">:</span> Number of rows inserted</span></code></pre>
</div>
</li>
<li class="listitem">
<p>
To reset all counter values, you must first disable the
counter. Disabling the counter sets the
<code class="literal">
STATUS
</code>
value to
<code class="literal">
disabled
</code>
.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa67105841"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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_monitor_disable <span class="token operator">=</span> dml_inserts<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 operator">*</span> <span class="token keyword">FROM</span> INFORMATION_SCHEMA<span class="token punctuation">.</span>INNODB_METRICS <span class="token keyword">WHERE</span> <span class="token keyword">NAME</span><span class="token operator">=</span><span class="token string">"dml_inserts"</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>
NAME<span class="token punctuation">:</span> dml_inserts
SUBSYSTEM<span class="token punctuation">:</span> dml
COUNT<span class="token punctuation">:</span> 3
MAX_COUNT<span class="token punctuation">:</span> 3
MIN_COUNT<span class="token punctuation">:</span> NULL
AVG_COUNT<span class="token punctuation">:</span> 0.030612244897959183
COUNT_RESET<span class="token punctuation">:</span> 0
MAX_COUNT_RESET<span class="token punctuation">:</span> 0
MIN_COUNT_RESET<span class="token punctuation">:</span> NULL
AVG_COUNT_RESET<span class="token punctuation">:</span> 0
TIME_ENABLED<span class="token punctuation">:</span> 2014-12-04 14<span class="token punctuation">:</span>18<span class="token punctuation">:</span>28
TIME_DISABLED<span class="token punctuation">:</span> 2014-12-04 14<span class="token punctuation">:</span>20<span class="token punctuation">:</span>06
TIME_ELAPSED<span class="token punctuation">:</span> 98
TIME_RESET<span class="token punctuation">:</span> NULL
STATUS<span class="token punctuation">:</span> disabled
TYPE<span class="token punctuation">:</span> status_counter
COMMENT<span class="token punctuation">:</span> Number of rows inserted</span></code></pre>
</div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<div class="admon-title">
Note
</div>
<p>
Wildcard match is supported for counter and module names.
For example, instead of specifying the full
<code class="literal">
dml_inserts
</code>
counter name, you can
specify
<code class="literal">
dml_i%
</code>
. You can also enable,
disable, or reset multiple counters or modules at once
using a wildcard match. For example, specify
<code class="literal">
dml_%
</code>
to enable, disable, or reset all
counters that begin with
<code class="literal">
dml_
</code>
.
</p>
</div>
</li>
<li class="listitem">
<p>
After the counter is disabled, you can reset all counter
values using the
<a class="link" href="innodb-parameters.html#sysvar_innodb_monitor_reset_all">
<code class="literal">
innodb_monitor_reset_all
</code>
</a>
option. All values are set to zero or NULL.
</p>
<div class="copytoclipboard-wrapper">
<pre class="programlisting language-sql"><div class="docs-select-all right" id="sa53861441"><div class="copy-help left">Press ⌘+C to copy</div> <div class="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_monitor_reset_all <span class="token operator">=</span> dml_inserts<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 operator">*</span> <span class="token keyword">FROM</span> INFORMATION_SCHEMA<span class="token punctuation">.</span>INNODB_METRICS <span class="token keyword">WHERE</span> <span class="token keyword">NAME</span><span class="token operator">=</span><span class="token string">"dml_inserts"</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>
NAME<span class="token punctuation">:</span> dml_inserts
SUBSYSTEM<span class="token punctuation">:</span> dml
COUNT<span class="token punctuation">:</span> 0
MAX_COUNT<span class="token punctuation">:</span> NULL
MIN_COUNT<span class="token punctuation">:</span> NULL
AVG_COUNT<span class="token punctuation">:</span> NULL
COUNT_RESET<span class="token punctuation">:</span> 0
MAX_COUNT_RESET<span class="token punctuation">:</span> NULL
MIN_COUNT_RESET<span class="token punctuation">:</span> NULL
AVG_COUNT_RESET<span class="token punctuation">:</span> NULL
TIME_ENABLED<span class="token punctuation">:</span> NULL
TIME_DISABLED<span class="token punctuation">:</span> NULL
TIME_ELAPSED<span class="token punctuation">:</span> NULL
TIME_RESET<span class="token punctuation">:</span> NULL
STATUS<span class="token punctuation">:</span> disabled
TYPE<span class="token punctuation">:</span> status_counter
COMMENT<span class="token punctuation">:</span> Number of rows inserted</span></code></pre>
</div>
</li>
</ol>
</div>
</div>
</div>
<br class="example-break"/>
</div>
<br/>
</div>
|